Zookeeper入门学习(二)--Zookeeper环境搭建
来源:互联网 发布:淘宝联盟分享店铺 编辑:程序博客网 时间:2024/05/21 02:34
一、Zookeeper环境搭建
- (1)搭建linux服务器,略;
- (2)下载zookeeper安装包到linux并解压,下面的介绍中将zookeeper解压到opt目录下,http://zookeeper.apache.org/
(3)配置zookeeper/conf/zoo_sample.cfg(此文件为zookeeper的默认配置文件,备份前最好备份一份)
# The number of milliseconds of each tick# The number of milliseconds of each tick# The number of milliseconds of each tick# sending a request and getting an acknowledgement# 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=/var/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#server.id=host:port:port id为服务器的ID,host是服务器的Ip地址,后面的第一个port#为Follower服务器与Leader服务器通信的端口,第二个port专门用于leader选举投票通信用,#这两个端口可以任意填写,只要可用即可server.1=192.168.153.129:2888:3888server.2=192.168.153.132:2888:3888server.3=192.168.153.133:2888:3888
(4)在/var下创建zookeeper目录,要与第三步中的dataDir配置的目录相同
- (5)在/opt/zookeeper/bin下使用./zkServer.sh start启动服务,(停止者使用./zkServer.sh stop)
(6)启动服务和可以使用telnet命令进行测试启动是否成功,例如:telnet 192.168.153.129 2181, 然后输入stat回车,如果出现:
root@liumeng-1:/opt/zookeeper/bin# telnet 192.168.153.129 2181Trying 192.168.153.129...Connected to 192.168.153.129.Escape character is '^]'.statThis ZooKeeper instance is not currently serving requestsConnection closed by foreign host.
表示当期集群服务对外提供服务,因为在zookeeper只有在超过集群内服务器数量+1的服务器上的zookeeper服务已经启动时才可以对外提供服务。比如上述配置中配了3台机器,那么则至少需要有两台服务器已经启动之后才能对外提供服务。
root@liumeng-1:/opt/zookeeper/bin# telnet 192.168.153.132 2181Trying 192.168.153.132...Connected to 192.168.153.132.Escape character is '^]'.statZookeeper version: 3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMTClients: /192.168.153.129:56480[0](queued=0,recved=1,sent=0)Latency min/avg/max: 0/0/0Received: 2Sent: 1Connections: 1Outstanding: 0Zxid: 0x100000000Mode: leaderNode count: 4Connection closed by foreign host.
出现以上信息则表示服务启动成功,其中从Mode中可以看出,192.168.153.132为leader
0 0
- Zookeeper入门学习(二)--Zookeeper环境搭建
- Zookeeper源码学习环境搭建
- zookeeper环境搭建(1)
- zookeeper小入门(二)
- Zookeeper学习之集群环境搭建
- ZooKeeper环境的搭建
- zookeeper集群环境搭建
- zookeeper环境的搭建
- Maven搭建Zookeeper环境
- zookeeper 集群环境搭建
- Zookeeper环境搭建_me
- zookeeper环境搭建
- dubbox+zookeeper环境搭建
- zookeeper集群环境搭建
- zookeeper-02-环境搭建
- zookeeper环境搭建详解
- zookeeper环境搭建
- Zookeeper环境搭建
- @Configuration、@Bean
- 量化投资策略回测框架(一):胜率的估算
- netezza 数据库几个常用的日期处理函数
- 自定义控件<一>
- leetcode-215-Kth Largest Element in an Array
- Zookeeper入门学习(二)--Zookeeper环境搭建
- PHP static局部静态变量和全局静态变量总结
- java io操作之InputStream,OutputStream
- S4 1610 smartforms取消使用word编辑器
- 大数据|Spark技术在京东智能供应链预测的应用案例深度剖析
- C++第四次作业
- 关于《抑郁症》
- Linux 终端配置
- 技术管理序列3 -- 技术的价值究竟何在?-- 价值模型