CentOS7下安装配置zookeeper集群
来源:互联网 发布:软件英文名称 编辑:程序博客网 时间:2024/06/05 08:36
1、在做zookeeper集群之前需要有至少三台centos机器或虚拟机
2、去zookeeper官网下载对应的压缩包,我下载的是目前最新的zookeeper-3.5.2-alpha.tar.gz,将该压缩包放到usr目 录下,用
tar -zxf zookeeper-3.5.2-alpha.tar.gz
命令将该压缩包解压到当前目录下
3、在解压后的目录下新建两个新目录,分别是data和log,等下在下一步中需要用到
4、将解压后的目录下的conf目录中的zoo_sample.cfg 复制一份,并命名为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=/usr/zookeeper-3.5.2-alpha/data# 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=60dataLogDir=/usr/zookeeper-3.5.2-alpha/logserver.1=192.168.202.66:2888:3888server.2=192.168.202.67:2888:3888server.3=192.168.202.68:2888:3888# 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=1
5、在第3步中新建的data目录中新建名为myid的文件,文件内容是上面配置文件中server.x的x,也即是1、2、3这样 的一个数字,这个文件3台机器里面都需要新建,所以需要根据配置上的内容分别存入1 2 3 ,不能弄错了
6、将zookeeper加入到path路径中,在/etc/profile中加入
export PATH=$PATH:/usr/zookeeper-3.5.2-alpha/bin
再用
source /etc/profile
刷新配置文件
这样就可以在任何位置使用zookeeper的命名
7、到目前为止需要做的事情已经做好了,可以来分别启动3台机器中的zookeeper了,用如下命令来启动
1)如果没有配置第6步的内容,则需要进去到zookeeper目录下的bin目录中 ,用
./zkServer.sh start
来启动zookeeper
2)如果配置了第6步的内容,则可以在任何位置使用
zkServer.sh start
来启动zookeeper
8、启动zookeeper之后,可以进去到zookeeper的logs目录下,用
tail -f zookeeper-root-server-localhost.localdomain.out
来查看日志,zookeeper-root-server-localhost.localdomain.out是logs目录的输出日志文件,不知道各个版本的 zookeeper是不是都叫这个名字。
9、最后可以使用 zkServer.sh status 命令来查看zookeeper服务的状态,如果现实如下内容,则说明zookeeper已经 启动成功
ZooKeeper JMX enabled by defaultUsing config: /usr/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfgClient port found: 2181. Client address: localhost.Mode: follower
ZooKeeper JMX enabled by defaultUsing config: /usr/zookeeper-3.5.2-alpha/bin/../conf/zoo.cfgClient port found: 2181. Client address: localhost.Mode: leader
10、如果在启动zookeeper后发现输出的日志中有报错,那么可能有这么两个原因
1)可能是防火墙没关,或者没有将zookeeper的需要用到的相关的端口号从防火墙中排出,可以使用下面的命令 来关闭防火墙
systemctl status firewalld.service #检查防火墙状态systemctl stop firewalld.service #关闭防火墙systemctl disable firewalld.service #禁止开机启动防火墙
- CentOS7下安装配置zookeeper集群
- CentOS7安装配置zookeeper集群
- centos7.2 安装zookeeper并配置zookeeper集群
- 原创:centos7.1下 ZooKeeper 集群安装配置+Python实战范例
- zookeeper在linux centos7下的集群介绍和配置
- Linux Centos7下ZooKeeper集群安装详细步骤
- Linux Centos7下ZooKeeper集群安装详细步骤
- Linux下zookeeper集群安装配置
- centos7 下安装zookeeper
- zookeeper集群安装配置
- ZooKeeper集群安装配置
- zookeeper集群安装配置
- zookeeper集群配置安装
- zookeeper集群安装配置
- zookeeper集群配置安装
- Zookeeper集群安装配置
- zookeeper集群安装配置
- Centos7之Zookeeper安装配置
- NodeJS基本
- 自定义浏览器滚动条样式
- android启动第一个界面时即闪屏的核心代码(3种方式)
- hdfs性能调优
- Spring Security入门篇——标签sec:authorize的使用
- CentOS7下安装配置zookeeper集群
- get_object_vars
- 4.创建Testng测试工程
- 解决winform窗体闪烁问题
- Nginx发布1.9.0版本,新增支持TCP代理和负载均衡的stream模块
- 欢迎使用CSDN-markdown编辑器
- hdu5489(最长上升子序列变形)
- django 知识总结
- 八数码