版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
【移动应用开发技术】Zookeeper快速部署文档
Zookeeper主结点配置:hostnamezookeeper1sed-i.ori's#HOSTNAME=localhost.localdomain#HOSTNAME=zookeeper1#g'/etc/sysconfig/networktee>>/etc/hosts<<-eof11zookeeper112zookeeper2eof
/etc/init.d/iptablesstopchkconfigiptablesoffsed-i.ori's#SELINUX=enforcing#SELINUX=disabled#g'/etc/sysconfig/selinuxsetenforce0
cd/software/mkdir-p/applicationtarxfjdk-7u67-linux-x64.tar.gz-C/application/ln-s/application/jdk1.7.0_67//application/jdktee>>/etc/profile<<-eof###JAVA_HOMEexportJAVA_HOME=/application/jdkexportPATH=$JAVA_HOME/bin:$PATHeofsource/etc/profilejava-version
cd/software/tarxfzookeeper-3.4.9.tar.gz-C/application/ln-s/application/zookeeper-3.4.9//application/zookeepermkdir-p/application/zookeeper/dataecho"1">>/application/zookeeper/data/myidcp/application/zookeeper/conf/zoo_sample.cfg/application/zookeeper/conf/zoo.cfgsed-i's#dataDir=/tmp/zookeeper#dataDir=/application/zookeeper/data#g'/application/zookeeper/conf/zoo.cfgtee>>/application/zookeeper/conf/zoo.cfg<<-eofserver.1=zookeeper1:2888:3888server.2=zookeeper2:2888:3888eof
tee>>/etc/profile<<-eof##ZOOKEEPER_HOMEexportZOOKEEPER_HOME=/application/zookeeperexportPATH=$ZOOKEEPER_HOME/bin:$PATHeofsource/etc/profile
备节点的配置:hostnamezookeeper2sed-i.ori's#HOSTNAME=localhost.localdomain#HOSTNAME=zookeeper2#g'/etc/sysconfig/networktee>>/etc/hosts<<-eof11zookeeper112zookeeper2eof
/etc/init.d/iptablesstopchkconfigiptablesoffsed-i.ori's#SELINUX=enforcing#SELINUX=disabled#g'/etc/sysconfig/selinuxsetenforce0mkdir-p/application
主节点上将配置目录拷贝到另外一台机器上:scp-r/application/jdk1.7.0_67/root@12:/applicationscp-r/application/zookeeper-3.4.9root@12:/application
备节点继续配置:ln-s/application/jdk1.7.0_67//application/jdktee>>/etc/profile<<-eofexportJAVA_HOME=/application/jdkexportPATH=$JAVA_HOME/bin:$PATHeofsource/etc/profilejava-version
ln-s/application/zookeeper-3.4.9//application/zookeepertee>>/etc/profile<<-eof##ZOOKEEPER_HOMEexportZOOKEEPER_HOME=/application/zookeeperexportPATH=$ZOOKEEPER_HOME/bin:$PATHeofsource/etc/profileecho"2">/application/zookeeper/data/myid
-->将1修改为2
启动ZK:多台ZK不能间隔太久启动,否则容易认不到对方zkServer.shstart
查看:[root@zookeeper1~]#ps-ef|grepzookeeperroot
1491
1
014:53pts/2
00:00:01/application/jdk/bin/java-Dzookeeper.log.dir=.-Dzookeeper.root.logger=INFO,CONSOLE-cp/application/zookeeper/bin/../build/classes:/application/zookeeper/bin/../build/lib/*.jar:/application/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/application/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/application/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/application/zookeeper/bin/../lib/log4j-1.2.16.jar:/application/zookeeper/bin/../lib/jline-0.9.94.jar:/application/zookeeper/bin/../zookeeper-3.4.9.jar:/application/zookeeper/bin/../src/java/lib/*.jar:/application/zookeeper/bin/../conf:-Dcom.sun.management.jmxremote-Dcom.sun.management.jmxremote.local.only=falseorg.apache.zookeeper.server.quorum.QuorumPeerMain/application/zookeeper/bin/../conf/zoo.cfg
[root@zookeeper1~]#netstat-lntupActiveInternetconnections(onlyservers)ProtoRecv-QSend-QLocalAddress
ForeignAddress
State
PID/Programname
tcp
0
0:22
:*
LISTEN
920/sshd
tcp
0
0:25
:*
LISTEN
997/master
tcp
0
0::ffff:11:3888
:::*
LISTEN
1491/java
tcp
0
0:::22
:::*
LISTEN
920/sshd
tcp
0
0::1:25
:::*
LISTEN
997/master
tcp
0
0:::51106
:::*
LISTEN
1491/java
tcp
0
0:::2181
:::*
LISTEN
1491/java
[root@zookeeper2~]#zkServer.shstatusZooKeeperJMXenabledbydefaultUsingconfig:/application/zookeeper/bin/../conf/zoo.cfgMode:leader
-->另一端是follower
[root@zookeeper2~]#jps1441Jps1370QuorumPeerMain
-->这个就是zookeeper进程
查看日志:[root@zookeeper1~]#cat/root/zookeeper.out2017-05-2514:53:45,599[myid:]-INFO
[main:QuorumPeerConfig@124]-Readingconfigurationfrom:/application/zookeeper/bin/../conf/zoo.cfg2017-05-2514:53:45,620[myid:]-INFO
[main:QuorumPeer$QuorumServer@149]-Resolvedhostname:zookeeper1toaddress:zookeeper1/112017-05-2514:53:45,620[myid:]-INFO
[main:QuorumPeer$QuorumServer@149]-Resolvedhostname:zookeeper2toaddress:zookeeper2/122017-05-2514:53:45,621[myid:]-WARN
[main:QuorumPeerConfig@305]-Noserverfailurewillbetolerated.Youneedatleast3servers.2017-05-2514:53:45,622[myid:]-INFO
[main:QuorumPeerConfig@352]-Defaultingtomajorityquorums2017-05-2514:53:45,627[myid:1]-INFO
[main:DatadirCleanupManager@78]-autopurge.snapRetainCountsetto32017-05-2514:53:45,627[myid:1]-INFO
[main:DatadirCleanupManager@79]-autopurge.purgeIntervalsetto02017-05-2514:53:45,627[myid:1]-INFO
[main:DatadirCleanupManager@101]-Purgetaskisnotscheduled.2017-05-2514:53:45,645[myid:1]-INFO
[main:QuorumPeerMain@127]-Startingquorumpeer2017-05-2514:53:45,659[myid:1]-INFO
[main:NIOServerCnxnFactory@89]-bindingtoport/:21812017-05-2514:53:45,677[myid:1]-INFO
[main:QuorumPeer@1019]-tickTimesetto20002017-05-2514:53:45,677[myid:1]-INFO
[main:QuorumPeer@1039]-minSessionTimeoutsetto-12017-05-2514:53:45,678[myid:1]-INFO
[main:QuorumPeer@1050]-maxSessionTimeoutsetto-12017-05-2514:53:45,678[myid:1]-INFO
[main:QuorumPeer@1065]-initLimitsetto102017-05-2514:53:45,713[myid:1]-INFO
[main:QuorumPeer@533]-currentEpochnotfound!Creatingwithareasonabledefaultof0.Thisshouldonlyhappenwhenyouareupgradingyourinstallation2017-05-2514:53:45,718[myid:1]-INFO
[main:QuorumPeer@548]-acceptedEpochnotfound!Creatingwithareasonabledefaultof0.Thisshouldonlyhappenwhenyouareupgradingyourinstallation2017-05-2514:53:45,731[myid:1]-INFO
[ListenerThread:QuorumCnxManager$Listener@534]-Myelectionbindport:zookeeper1/11:38882017-05-2514:53:45,745[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer@774]-LOOKING2017-05-2514:53:45,748[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@818]-Newelection.Myid=
1,proposedzxid=0x02017-05-2514:53:45,752[myid:1]-INFO
[WorkerReceiver[myid=1]:FastLeaderElection@600]-Notification:1(messageformatversion),1(n.leader),0x0(n.zxid),0x1(n.round),LOOKING(n.state),1(n.sid),0x0(n.peerEpoch)LOOKING(mystate)2017-05-2514:53:45,758[myid:1]-WARN
[WorkerSender[myid=1]:QuorumCnxManager@400]-Cannotopenchannelto2atelectionaddresszookeeper2/12:3888.ConnectException:Connectionrefused
.PlainSocketImpl.socketConnect(NativeMethod)
.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
.SocksSocketImpl.connect(SocksSocketImpl.java:392)
.Socket.connect(Socket.java:579)
atorg.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:381)
atorg.apache.zookeeper.server.quorum.QuorumCnxManager.toSend(QuorumCnxManager.java:354)
atorg.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerScess(FastLeaderElection.java:452)
atorg.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.run(FastLeaderElection.java:433)
atjava.lang.Thread.run(Thread.java:745)2017-05-2514:53:45,761[myid:1]-INFO
[WorkerSender[myid=1]:QuorumPeer$QuorumServer@149]-Resolvedhostname:zookeeper2toaddress:zookeeper2/122017-05-2514:53:45,804[myid:1]-INFO
[zookeeper1/11:3888:QuorumCnxManager$Listener@541]-Receivedconnectionrequest/12:571292017-05-2514:53:45,816[myid:1]-INFO
[WorkerReceiver[myid=1]:FastLeaderElection@600]-Notification:1(messageformatversion),2(n.leader),0x0(n.zxid),0x1(n.round),LOOKING(n.state),2(n.sid),0x0(n.peerEpoch)LOOKING(mystate)2017-05-2514:53:45,817[myid:1]-INFO
[WorkerReceiver[myid=1]:FastLeaderElection@600]-Notification:1(messageformatversion),2(n.leader),0x0(n.zxid),0x1(n.round),LOOKING(n.state),1(n.sid),0x0(n.peerEpoch)LOOKING(mystate)2017-05-2514:53:46,019[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer@844]-FOLLOWING2017-05-2514:53:46,024[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Learner@86]-TCPNoDelaysetto:true2017-05-2514:53:46,032[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:zookeeper.version=3.4.9-1757313,builton08/23/201606:50GMT2017-05-2514:53:46,032[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:=zookeeper12017-05-2514:53:46,032[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:java.version=1.7.0_672017-05-2514:53:46,032[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:java.vendor=OracleCorporation2017-05-2514:53:46,032[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:java.home=/application/jdk1.7.0_67/jre2017-05-2514:53:46,032[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:java.class.path=/application/zookeeper/bin/../build/classes:/application/zookeeper/bin/../build/lib/*.jar:/application/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/application/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/application/zookeeper/bin/../lib/netty-3.10.5.Final.jar:/application/zookeeper/bin/../lib/log4j-1.2.16.jar:/application/zookeeper/bin/../lib/jline-0.9.94.jar:/application/zookeeper/bin/../zookeeper-3.4.9.jar:/application/zookeeper/bin/../src/java/lib/*.jar:/application/zookeeper/bin/../conf:2017-05-2514:53:46,032[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib2017-05-2514:53:46,033[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:java.io.tmpdir=/tmp2017-05-2514:53:46,033[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:piler=<NA>2017-05-2514:53:46,033[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:=Linux2017-05-2514:53:46,033[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:os.arch=amd642017-05-2514:53:46,033[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:os.version=2.6.32-431.el6.x86_642017-05-2514:53:46,033[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:=root2017-05-2514:53:46,033[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:user.home=/root2017-05-2514:53:46,033[myid:1]-INFO
[QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Environment@100]-Serverenvironment:user.dir=/root2017-05-2514:53:46,035
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024高考历史一轮复习专题九20世纪世界经济体制的创新与调整世界经济的全球化趋势第21讲苏联社会主义建设的经验与教训课时作业含解析人民版
- 教育机构出纳人员劳动合同
- 建筑试验工程合同
- 校园教学楼外立面改造合同
- 环保组织租赁合同
- 无人机研发基地施工合同
- 地热开发静压桩施工合同
- 试用期工作合同样本
- 盐城市家居建材市场租赁合同
- 检察院检察官招聘协议
- 第五节 错觉课件
- 2024-2030年陕西省煤炭行业市场发展分析及发展前景预测研究报告
- 【课件】Unit+3+SectionB+1a-2b+课件人教版英语七年级上册
- 干部人事档案任前审核登记表范表
- 期中阶段测试卷(六)-2024-2025学年语文三年级上册统编版
- 国开2024年《中国法律史》平时作业1-3答案
- (外研版)初中英语语法汇总[新版]
- 李燕璇植树问题卡通版5
- 有砟轨道铺设的施工讲解
- 烟草专卖食堂燃气泄露及火灾事故现场应急处置方案
- 国家电网公司十八项反措
评论
0/150
提交评论