快乐的星期六

时间:2018-04-13 06:27:21来源:杰瑞文章网点击:作文字数:400字
ActiveMQ集群的搭建(高可用) 使用ZooKeeper+ActiveMQ搭建高可用集群。 1 前提准备 ZooKeeper集群 ActiveMQ安装包:apache-activemq-5.11.1-bin.tar.gz 2 集群架构 2.1 架构图 01-架构图.png 2.2 ZooKeeper集群 ZooKeeper01 ZooKeeper02 ZooKeeper03 192.168.1.4 192.168.1.5 192.168.1.6 2.3 ActiveMQ集群 ActiveMQ01 ActiveMQ02 ActiveMQ03 192.168.1.4 192.168.1.5 192.168.1.6 3 搭建集群 3.1 解压安装包 分别在三台服务器上进行解压操作: [root@Server01 lcp]# pwd /home/lcp [root@Server01 lcp]# mkdir activemq [root@Server01 lcp]# tar -zxf software/apache-activemq-5.11.1-bin.tar.gz -C activemq/ 3.2 配置节点名 每一个ActiveMQ集群应该有一个统一的名字,所以我们需要修改配置文件“activemq.xml”,将三台服务器的节点名brokerName统一为“ActiveMQ-Cluster”。 3.3 修改持久化适配器 修改配置文件“activemq.xml”,使用性能比较好的LevelDB替换掉默认的KahaDB,具体配置如下: 配置项说明: directory:持久化数据存放地址 replicas:集群中节点的个数 bind:集群通信端口 zkAddress:ZooKeeper集群地址 hostname:当前服务器的IP地址,如果集群启动的时候报未知主机名错误,那么就需要配置主机名到IP地址的映射关系。 zkPath:ZooKeeper数据挂载点 至此,ActiveMQ的高可用集群搭建完成。 4 启动集群 前提:ZooKeeper集群已启动 分别启动三台ActiveMQ服务器: [root@Server01 bin]# pwd /home/lcp/activemq/apache-activemq-5.11.1/bin [root@Server01 bin]# ./activemq start INFO: Loading '/home/lcp/activemq/apache-activemq-5.11.1/bin/env' INFO: Using java '/home/lcp/jdk/jdk1.7.0_75/bin/java' INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details INFO: pidfile created : '/home/lcp/activemq/apache-activemq-5.11.1/data/activemq.pid' (pid '2521') 在启动过程中,可以在activemq.log文件中查看启动日志: [root@Server01 data]# pwd /home/lcp/activemq/apache-activemq-5.11.1/data [root@Server01 data]# ll total 20 -rwxrwxrwx. 1 root root 10222 Feb 4 06:47 activemq.log -rw-r--r--. 1 root root 5 Feb 4 06:47 activemq.pid -rw-r--r--. 1 root root 0 Feb 4 06:35 audit.log drwxr-xr-x. 4 root root 4096 Feb 4 06:47 leveldb [root@Server01 data]# tail -f activemq.log 集群启动成功后,ActiveMQ会往ZooKeeper中注册集群信息。为了方便,我们使用ZooInspector工具来查看具体的内容。 第一条注册信息: 02-第一条注册信息.png 第二条注册信息: 03-第二条注册信息.png 第三条注册信息: 04-第三条注册信息.png 从以上三条注册信息的内容我们可以看出,ActiveMQ01(192.168.1.4)被选举为主节点,并对外提供服务,其余两个节点作为从节点,处于待机状态,不提供服务。 知道了ActiveMQ集群的主节点后,我们可以使用浏览器来访问它的管理页面,查看它是否能正常提供服务。 05-主节点管理页面.png 5 测试集群的高可用性 关掉主节点ActiveMQ01: [root@Server01 bin]# ./activemq stop 查看失败转移情况: 06-失败转移结果.png 07-新的主节点管理页面.png 从结果可以看出,原来的从节点ActiveMQ02(192.168.1.5)被ZooKeeper选举成新的主节点,持续对外提供服务。由此可见,本次搭建的集群具备高可用性。
作文投稿

快乐的星期六一文由杰瑞文章网免费提供,本站为公益性作文网站,此作文为网上收集或网友提供,版权归原作者所有,如果侵犯了您的权益,请及时与我们联系,我们会立即删除!

杰瑞文章网友情提示:请不要直接抄作文用来交作业。你可以学习、借鉴、期待你写出更好的作文。

说说你对这篇作文的看法吧

最新发表的关于快乐的作文

    SQL Error: select id,classid,ttid,onclick,plnum,totaldown,newspath,filename,userid,username,firsttitle,isgood,ispic,istop,isqf,ismember,isurl,truetime,lastdotime,havehtml,groupid,userfen,titlefont,titleurl,stb,fstb,restb,keyboard,eckuid,title,ftitle,newstime,titlepic,smalltext,writer,diggtop from ***_ecms_news where (classid='269') order by newstime desc limit 10

最受欢迎的关于快乐的作文

    SQL Error: select id,classid,ttid,onclick,plnum,totaldown,newspath,filename,userid,username,firsttitle,isgood,ispic,istop,isqf,ismember,isurl,truetime,lastdotime,havehtml,groupid,userfen,titlefont,titleurl,stb,fstb,restb,keyboard,eckuid,title,ftitle,newstime,titlepic,smalltext,writer,diggtop from ***_ecms_news where (classid='269') order by onclick desc limit 10