3台机器部署zookeeper-3.4.10集群
来源:互联网 发布:福岛 知乎 编辑:程序博客网 时间:2024/05/07 10:11
一. 环境介绍
三台主机,主机名和ip分别为:
ubuntu1 10.3.19.171
ubuntu2 10.3.19.172
ubuntu3 10.3.19.173
三台主机的登录用户名是bigdata,home目录是/home/bigdata
现在三台主机上部署zookeeper集群。
二.在ubuntu1机器上安装zookeeper
1. 解压复制安装包
bigdata@ubuntu1:~/download$ tar -zxvf zookeeper-3.4.10.tar.gz
bigdata@ubuntu1:~/download$ mv zookeeper-3.4.10 ../run/
bigdata@ubuntu1:~/download$ cd ../run/bigdata@ubuntu1:~/run$ ln -s zookeeper-3.4.10 zookeeper
2. 修改配置文件
bigdata@ubuntu1:~/run/zookeeper/conf$ pwd/home/bigdata/run/zookeeper/confbigdata@ubuntu1:~/run/zookeeper/conf$ lsconfiguration.xsl log4j.properties zoo_sample.cfg
bigdata@ubuntu1:~/run/zookeeper/conf$ cp zoo_sample.cfg zoo.cfg
创建tmp目录
bigdata@ubuntu1:~/run/zookeeper/conf$ mkdir /home/bigdata/run/zookeeper/dataDir
bigdata@ubuntu1:~/run/zookeeper/conf$ cat 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=/home/bigdata/run/zookeeper/dataDir# 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.## http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance## 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=10.3.19.171:2888:3888server.2=10.3.19.172:2888:3888server.3=10.3.19.173:2888:3888bigdata@ubuntu1:~/run/zookeeper/conf$
bigdata@ubuntu1:~/run/zookeeper/conf$ touch /home/bigdata/run/zookeeper/dataDir/myid
bigdata@ubuntu1:~/run/zookeeper/conf$ cat /home/bigdata/run/zookeeper/dataDir/myid1bigdata@ubuntu1:~/run/zookeeper/conf$
至此, 在ubunt1上安装zookeeper已完毕,接着在ubuntu2 和ubuntu3上安装zookeeper。
3. 在ubuntu2 ubuntu3机器上安装zookeeper
为了安装配置方便,直接将ubuntu1上已安装好的zookeeper, 打包后拷贝到ubuntu2 ubuntu3机器上, 如下:
bigdata@ubuntu1:~/run$ tar -zcvf zookeeper-3.4.10.tar.gz zookeeper-3.4.10/
bigdata@ubuntu1:~/run$ scp zookeeper-3.4.10.tar.gz ubuntu2:/home/bigdata/run/
bigdata@ubuntu1:~/run$ scp zookeeper-3.4.10.tar.gz ubuntu3:/home/bigdata/run/在ubuntu2 ubuntu3上将其解压,并创建软件连接。ubuntu2上操作如下,ubuntu3类似
bigdata@ubuntu2:~/run$ tar -zxvf zookeeper-3.4.10.tar.gz
bigdata@ubuntu2:~/run$ ln -s zookeeper-3.4.10 zookeeper
修改ubuntu2中,zookeeper的配置文件, 将/home/bigdata/run/zookeeper/dataDir/myid值修改为2
bigdata@ubuntu2:~/run/zookeeper/dataDir$ cat /home/bigdata/run/zookeeper/dataDir/myid 2
修改ubuntu3中,zookeeper的配置文件, 将/home/bigdata/run/zookeeper/dataDir/myid值修改为3
bigdata@ubuntu2:~/run/zookeeper/dataDir$ cat /home/bigdata/run/zookeeper/dataDir/myid 3
至此,zookeeper已安装到了ubuntu1 ubuntu2 ubuntu3 三台机器上。
4. 启动zookeeper
在 三台机器上分别执行执动脚本:bigdata@ubuntu1:~/run/zookeeper/bin$ ./zkServer.sh status查看zookeeper状态:
bigdata@ubuntu1:~/run/zookeeper/bin$ ./zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: /home/bigdata/run/zookeeper/bin/../conf/zoo.cfgMode: follower停止zookeeper
bigdata@ubuntu1:~/run/zookeeper/bin$ ./zkServer.sh stop
a. 查看状态时,可能报错如下, 其原因是其它的两台机器的zookeeper未启动
bigdata@ubuntu1:~/run/zookeeper/bin$ ./zkServer.sh statusZooKeeper JMX enabled by defaultUsing config: /home/bigdata/run/zookeeper/bin/../conf/zoo.cfgError contacting service. It is probably not running.启动另外两台机器的zookeeper, 即没有此报错。
0 0
- 3台机器部署zookeeper-3.4.10集群
- 3台机器部署storm-1.1.0集群
- 3台机器部署presto-server-0.173集群
- (10)Zookeeper 3.4.9 集群部署
- 一台机器上安装zookeeper+kafka集群
- zookeeper集群某台机器故障替换步骤
- windows ZooKeeper 集群部署
- Zookeeper分布式集群部署
- Zookeeper分布式集群部署
- Zookeeper集群部署
- Zookeeper集群配置部署
- zookeeper集群部署
- Zookeeper集群的部署
- ZooKeeper集群部署流程
- ZooKeeper集群环境部署
- Zookeeper分布式集群部署
- zookeeper集群部署---
- zookeeper简介,集群部署
- nyoj 120 校园网络
- Matlab安装过程
- FFMPEG跨平台iOS&Android高级教程
- ORACLE11G RAC expdp报错ORA-39002 ORA-39070 ORA-29283 ORA-06512
- 数据缓存(图片)
- 3台机器部署zookeeper-3.4.10集群
- CS231n系列课程Lecture6: Training Neural Networks, Part 2
- JAVA集合框架——Iterator
- Linux生成密钥
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- 分数加减法
- [P2472]蜥蜴
- LeetCode 3. Longest Substring Without Repeating Characters 滑动窗口
- 离开工具自己手写一个servlet