JEESZ-Zookeeper集群安装
1. 在根目录创建zookeeper文件夹(service1、service2、service3都创建)# mkdir zookeeper通过Xshell上传文件到service1服务器:上传zookeeper-3.4.6.tar.gz到/software文件夹2.远程copy将service1下的/software/zookeeper-3.4.6.tar.gz到service2、service3# scp -r /software/zookeeper-3.4.6.tar.gz root@192.168.2.212:/software/# scp -r /software/zookeeper-3.4.6.tar.gz root@192.168.2.213:/software/3.copy /software/zookeeper-3.4.6.tar.gz到/zookeeper/目录(service1、service2、service3都执行)# cp /software/zookeeper-3.4.6.tar.gz /zookeeper/4.安装解压zookeeper-3.4.6.tar.gz(service1、service2、service3都执行)# cd /zookeeper/# tar -zxvf zookeeper-3.4.6.tar.gz5.在/zookeeper创建两个目录:zkdata、zkdatalog(service1、service2、service3都创建)# mkdir zkdata# mkdir zkdatalog6.进入/zookeeper/zookeeper-3.4.6/conf/目录# cd /zookeeper/zookeeper-3.4.6/conf/# lsconfiguration.xsllog4j.propertieszoo.cfgzoo_sample.cfg7. 修改zoo.cfg文件# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial# synchronization phase can takeinitLimit=10# The number of ticks that can pass between# sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just# example sakes.dataDir=/zookeeper/zkdatadataLogDir=/zookeeper/zkdatalog# the port at which the clients will connectclientPort=2181# the maximum number of client connections.# increase this if you need to handle more clients#maxClientCnxns=60## Be sure to read the maintenance section of the# administrator guide before turning on autopurge.#### The number of snapshots to retain in dataDir#autopurge.snapRetainCount=3# Purge task interval in hours# Set to "0" to disable auto purge feature#autopurge.purgeInterval=1server.1=192.168.2.211:12888:13888server.2=192.168.2.212:12888:13888server.3=192.168.2.213:12888:138888. 同步修改service2、service3的zoo.cfg配置9. myid文件写入(进入/zookeeper/zkdata目录下)# cd /zookeeper/zkdata# echo 1 > myid10. myid文件写入service2、service3echo 2 > myidecho 3 > myid11.查看zk命令:# cd /zookeeper/zookeeper-3.4.6/bin/# lsREADME.txtzkCleanup.shzkCli.cmdzkCli.shzkEnv.cmdzkEnv.shzkServer.cmdzkServer.shzookeeper.out12.执行zkServer.sh查看详细命令:# ./zkServer.shJMX enabled by defaultUsing config: /zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfgUsage: ./zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}13. 在service1、service2、service3分别启动zk服务# ./zkServer.sh start14. jps查看zk进程# jps31483 QuorumPeerMain31664 Jps15. 分别在service1、service2、service3查看zk状态(可以看到leader和follower节点)# ./zkServer.sh statusJMX enabled by defaultUsing config: /zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfgMode: follower# ./zkServer.sh statusJMX enabled by defaultUsing config: /zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfgMode: leader16. 看到leader和follower节点已经安装成功分布式的一些解决方案,有愿意了解的朋友可以找我们团队探讨 。愿意了解框架技术或者源码的朋友直接加求求:2042849237更多详细源码参考来源:http://minglisoft.cn/technology
页:
[1]