Zookeeper3.4.10集群模式安装和配置
来源:互联网 发布:mysql insert return 编辑:程序博客网 时间:2024/06/05 17:38
Zookeeper集群模式安装和配置
主要参考了网上的教程,把我自己安装过程写下来,方便自己,也方便别人。
1、下载zookeeper-3.4.10.tar.gz:
https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/stable/ ,我下载的版本是3.4.10。
2、解压缩zookeeper-3.4.10.tar.gz:
tar -zxvf zookeeper-3.4.10.tar.gz
我的解压目录为:/usr,减压后/usr/ zookeeper-3.4.10即为安装目录:
3、修改zookeeper配置文件:
进入zookeeper配置文件目录,复制zoo_sample.cfg 文件的并命名为为 zoo.cfg
cd /usr/zookeeper-3.4.10/conf
cp zoo_sample.cfg zoo.cfg
4、用 vim 打开 zoo.cfg 文件并修改其内容为如下:
# The number of milliseconds of each tick
#zookeeper 定义的基准时间间隔,单位:毫秒
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting anacknowledgement
syncLimit=5
# the directory where the snapshot isstored.
# do not use /tmp for storage, /tmp here isjust
# example sakes.
#dataDir=/tmp/zookeeper
# 数据文件夹
dataDir=/usr/zookeeper-3.4.10/data
# 日志文件夹
dataLogDir=/usr/zookeeper-3.4.10/data/logs
# the port at which the clients willconnect
# 客户端访问zookeeper 的端口号
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle moreclients
#配置集群服务器
server.1=master:2888:3888
server.2=slaver1:2888:3888
server.3=slaver2:2888:3888
maxClientCnxns=60
#
# Be sure to read the maintenance sectionof the
# administrator guide before turning onautopurge.
#
#http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain indataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable autopurge feature
#autopurge.purgeInterval=1
保存并关闭 zoo.cfg 文件。
server.A=B:C:D:其中 A 是一个数字,表示这个是第几号服务器;B 是这个服务器的 ip 地址;C 表示的是这个服务器与集群中的 Leader 服务器交换信息的端口;D 表示的是万一集群中的 Leader 服务器挂了,需要一个端口来重新进行选举,选出一个新的 Leader,而这个端口就是用来执行选举时服务器相互通信的端口。如果是伪集群的配置方式,由于 B 都是一样,所以不同的 Zookeeper 实例通信端口号不能一样,所以要给它们分配不同的端口号。
5、创建zoo.cfg配置文件中的data目录和logs目录
cd /usr/zookeeper-3.4.10/
mkdir data
cd data
mkdir logs
6、在data目录下创建myid文件
在dataDir目录下创建一个myid文件,然后分别在myid文件中按照zoo.cfg文件的server.A中A的数值,在不同机器上的该文件中填写相应的值。
7、用 vim 打开 /etc/ 目录下的配置文件 profile:
vim /etc/profile
并在其尾部追加如下内容:
export ZOOKEEPER_HOME=/usr/zookeeper-3.4.10/
export PATH=$ZOOKEEPER_HOME/bin:$PATH
使 /etc/ 目录下的 profile 文件即可生效:
source /etc/profile
8、按照上述方法同样在另外2台机器上面配置或者直接将该机器上面的文件拷贝到另外的2台机器上面 ,我这里采用的是复制
scp -r /usr/zookeeper-3.4.10slaver1:/usr/zookeeper-3.4.10
scp -r /usr/zookeeper-3.4.10slaver2:/usr/zookeeper-3.4.10
9、修改另外2台服务器myid文件中的值。
10、启动zookeeper 服务:
zkServer.sh start
如打印如下信息则表明启动成功:
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.10/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
13、查询zookeeper 状态:
zkServer.sh status
14、关闭zookeeper 服务:
zkServer.sh stop
如打印如下信息则表明成功关闭:
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.10/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
15、重启zookeeper 服务:
zkServer.sh restart
如打印如下信息则表明重启成功:
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.10/bin/../conf/zoo.cfg
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.10/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
ZooKeeper JMX enabled by default
Using config: /usr/zookeeper-3.4.10/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
- Zookeeper3.4.10集群模式安装和配置
- zookeeper3.4.9集群模式安装部署
- centos7配置安装zookeeper3.4.10
- zookeeper3.4.10安装与配置
- Linux安装zookeeper集群(CentOS7+Zookeeper3.4.10)
- zookeeper3.4.6集群安装
- Zookeeper3.4.6与Kafka0.8.1.1集群安装和配置详细步骤
- ZooKeeper集群安装与配置(ZooKeeper3.4.6)
- centos7安装zookeeper3.4.9集群
- Zookeeper3.4.5配置安装
- 关于zookeeper3.4.10集群版安装个人自总结
- zookeeper伪集群模式安装和配置
- Zookeeper3.4.6安装配置文档
- Kafka 0.9+Zookeeper3.4.6集群搭建、配置
- zookeeper3.4.6分布式集群安装部署记录
- Zookeeper3.4.9、Hbase1.3.1、Pig0.16.0安装及配置(基于Hadoop2.7.3集群)
- CentOS6.5 安装ZooKeeper3.4.10
- zookeeper的集群模式下的安装和配置
- MySQL常用命令
- 一些字符串的冷知识点
- mysql 5.7.20win64 安装
- linux下使用crontab定时备份MYSQL数据库的方法
- (Android四大组件)---BroadcastReceiver
- Zookeeper3.4.10集群模式安装和配置
- hdu 5978 To begin or not to begin(概率期望)
- 异常
- opencv小程序——添加小胡子
- 3秒钟不懂你砍我:网络请求
- 运行游戏时出现0xc000007b错误的解决方法
- pgsql9.1 基于wal的 pitr 恢复
- Cassandra的timestamp类型
- 第三章 求1!+1/2!+1/3!+1/4!+....的前20项和