ubuntu16配置ZooKeeper集群(这里用的是Zookeeper3.4.10)
2018-01-30 13:05
375 查看
1.安装jdk:https://my.oschina.net/u/3316387/blog/1615301\
2.下载ZooKeeper:https://archive.apache.org/dist/zookeeper/,然后早/opt下创建一个目录zookeeper,将下载好的文件解压到这个目录。
3.在zookeeper目录下创建data,dataLog两个目录
4.在data下创建文件myid,并写入1,其他的机器分别写上2,3......可以随便定义。
5.进入/opt/zookeeper/zookeeper-3.4.10/conf/,创建文件zoo.cfg,写入以下代码:
# The number of milliseconds of each tick
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 an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
# dataDir=/tmp/zookeeper
# the port at which the clients will connect
clientPort=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=1
dataDir=/opt/zookeeper/data
dataLogDir=/opt/zookeeper/dataLog
server.1=192.168.1.201:2888:3888
server.2=192.168.1.202:2888:3888
server.3=192.168.1.203:2888:3888
说明:dataDir和dataLogDir需要自己创建,目录可以自己制定,对应即可。server.1中的这个1需要和192.168.1.201这个机器上的dataDir目录中的myid文件中的数值对应。server.2中的这个2需要和192.168.1.202这个机器上的dataDir目录中的myid文件中的数值对应。当然,数值你可以随便用,只要对应即可。2888和3888的端口号也可以随便用,因为在不同机器上,用成一样也无所谓。
6.进入/opt/zookeeper/zookeeper-3.4.10/bin/,编辑zkServer.sh 在程序的开头添加上:
export JAVA_HOME=/usr/lib/jvm/jdk1.8
export PATH=$JAVA_HOME/bin:$PATH
不添加会出现以下错误:
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
7.最后启动zookeeper
sudo /opt/zookeeper/zookeeper-3.4.10/bin/zkServer.sh start
查看状态
sudo /opt/zookeeper/zookeeper-3.4.10/bin/zkServer.sh status
2.下载ZooKeeper:https://archive.apache.org/dist/zookeeper/,然后早/opt下创建一个目录zookeeper,将下载好的文件解压到这个目录。
3.在zookeeper目录下创建data,dataLog两个目录
4.在data下创建文件myid,并写入1,其他的机器分别写上2,3......可以随便定义。
5.进入/opt/zookeeper/zookeeper-3.4.10/conf/,创建文件zoo.cfg,写入以下代码:
# The number of milliseconds of each tick
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 an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
# dataDir=/tmp/zookeeper
# the port at which the clients will connect
clientPort=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=1
dataDir=/opt/zookeeper/data
dataLogDir=/opt/zookeeper/dataLog
server.1=192.168.1.201:2888:3888
server.2=192.168.1.202:2888:3888
server.3=192.168.1.203:2888:3888
说明:dataDir和dataLogDir需要自己创建,目录可以自己制定,对应即可。server.1中的这个1需要和192.168.1.201这个机器上的dataDir目录中的myid文件中的数值对应。server.2中的这个2需要和192.168.1.202这个机器上的dataDir目录中的myid文件中的数值对应。当然,数值你可以随便用,只要对应即可。2888和3888的端口号也可以随便用,因为在不同机器上,用成一样也无所谓。
6.进入/opt/zookeeper/zookeeper-3.4.10/bin/,编辑zkServer.sh 在程序的开头添加上:
export JAVA_HOME=/usr/lib/jvm/jdk1.8
export PATH=$JAVA_HOME/bin:$PATH
不添加会出现以下错误:
JMX enabled by default
Using config: /usr/local/zookeeper-3.4.6/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
7.最后启动zookeeper
sudo /opt/zookeeper/zookeeper-3.4.10/bin/zkServer.sh start
查看状态
sudo /opt/zookeeper/zookeeper-3.4.10/bin/zkServer.sh status
相关文章推荐
- Ubuntu 安装Zookeeper并使用集群配置
- Zookeeper3.4.10集群模式安装和配置
- Ubuntu 13 Zookeeper 集群配置
- ZooKeeper-3.3.4集群安装配置
- ZooKeeper集群的安装、配置整理
- ZooKeeper-3.3.4集群安装配置
- ArcGIS for Server的安装及站点中的集群配置 分类: ArcGIS for server 2015-07-18 14:14 16人阅读 评论(0) 收藏
- ZooKeeper集群的安装、配置、高可用测试
- Hadoop集群安装配置教程_Hadoop2.6.0_Ubuntu/CentOS
- zookeeper集群安装配置
- ubuntu16 配置vscode 编译c++程序
- zookeeper系列(三)——伪集群配置
- Zookeeper的集群配置和Java测试程序
- ZooKeeper的介绍及集群的安装与配置
- ZooKeeper高可用集群的安装及配置
- hadoop-1.0.4 hbase-0.94.10 zookeeper-3.4.5集群配置
- zookeeper在linux centos7下的集群介绍和配置
- DUBBO-ZOOKEEPER-SPRING-MAVEN-TOMCAT集群配置~
- 如何配置zookeeper单机伪集群
- Hadoop+Hbase+Zookeeper集群配置