博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
zookeeper 集群安装
阅读量:6863 次
发布时间:2019-06-26

本文共 3132 字,大约阅读时间需要 10 分钟。

  hot3.png

今天闲来无事,重新安装zookeeper 环境。由于个人有几台虚拟主机。总共四台服务器。

其中选择三台做zookeeper集群。具体ip如下:

IP地址  主机名称
100.xx.xx.31 master
100.xx.xx.72 slave1 
100.xx.xx.122 slave2

如合配置主机名,可以修改linux hosts文件。具体文件路径: /var/hosts,内容如下:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
100.xx.xx.31   xxxx-xxxx
100.xx.xx.31   master
100.xx.xx.72   slave1
100.xx.xx.122  slave2
~              

修改完上述配置过后,下载zookeeper, 我下载的版本:zookeeper-3.4.9  

下载完成,直接解压,zookeeper 目录结构:

drwxr-xr-x 10 1001 1001    4096 Aug 23 15:42 .

drwxr-xr-x  6 root root    4096 Dec  4 12:20 ..
drwxr-xr-x  2 1001 1001    4096 Dec  4 02:07 bin
-rw-rw-r--  1 1001 1001   83539 Aug 23 15:39 build.xml
-rw-rw-r--  1 1001 1001   90824 Aug 23 15:39 CHANGES.txt
drwxr-xr-x  2 1001 1001    4096 Dec  4 02:04 conf
drwxr-xr-x 10 1001 1001    4096 Aug 23 15:39 contrib
drwxr-xr-x  2 1001 1001    4096 Aug 23 15:44 dist-maven
drwxr-xr-x  6 1001 1001    4096 Aug 23 15:40 docs
-rw-rw-r--  1 1001 1001    1953 Aug 23 15:39 ivysettings.xml
-rw-rw-r--  1 1001 1001    3499 Aug 23 15:39 ivy.xml
drwxr-xr-x  4 1001 1001    4096 Aug 23 15:40 lib
-rw-rw-r--  1 1001 1001   11938 Aug 23 15:39 LICENSE.txt
-rw-rw-r--  1 1001 1001     171 Aug 23 15:39 NOTICE.txt
-rw-rw-r--  1 1001 1001    1770 Aug 23 15:39 README_packaging.txt
-rw-rw-r--  1 1001 1001    1585 Aug 23 15:39 README.txt
drwxr-xr-x  5 1001 1001    4096 Aug 23 15:39 recipes
drwxr-xr-x  8 1001 1001    4096 Aug 23 15:40 src
-rw-rw-r--  1 1001 1001 1368238 Aug 23 15:39 zookeeper-3.4.9.jar
-rw-rw-r--  1 1001 1001     819 Aug 23 15:42 zookeeper-3.4.9.jar.asc
-rw-rw-r--  1 1001 1001      33 Aug 23 15:39 zookeeper-3.4.9.jar.md5
-rw-rw-r--  1 1001 1001      41 Aug 23 15:39 zookeeper-3.4.9.jar.sha1  

找到conf 目录

cp zoo_sample.cfg   zoo.cfg

修改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=/var/work/data/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.1=master:2888:3888
server.2=slave1:2888:3888
server.3=slave2:2888:3888
~                            

根据需要调整你要修改标好的配置。

需要说明下zookeeper  几个端口的意思:

zookeeper监听三个端口: 2181用来监听zookeeper客户端连接, 2888, 如果是领导者, 用来监听跟随者连接, 3888用来在选举领导者阶段, 用来监听其他服务器的连接。

配置文件修改完成后,需要创建myid 文件,myid 文件存在data目录下,本次安装data目录:/var/work/data/zookeeper 

根据zoo.cfg 配置,分别在不同server 上myid写入:1,2,3 。

ok, 基本搞定,接下来启动zookeeper . 

[root   bin]# ./zkServer.sh  start     

停用zookeeper 

[root bin]# ./zkServer.sh  stoo

大功告成,下次我们再分享zookeeper 详细配置。  

 

 

             

 

转载于:https://my.oschina.net/lilw/blog/799655

你可能感兴趣的文章
第三方开始菜单软件使微软 Windows 10 升级时崩溃
查看>>
产品打包工具的制作,ant,编译源码,打jar包,打tag,打war包,备份release版本等...
查看>>
SourceForge 停止在被遗弃项目捆绑第三方软件
查看>>
第六天:定义范围
查看>>
《UNIX环境高级编程(第3版)》——1.7 出错处理
查看>>
《3D打印:正在到来的工业革命(第2版)》——1.6节先驱者们在做什么
查看>>
《软件定义网络:基于OpenFlow的SDN》一一2.5 本章总结
查看>>
《抓住听众心理——演讲者要知道的100件事》一20.人们学习的最优长度是20分钟...
查看>>
《JUnit实战(第2版)》—第2章2.1节探索JUnit核心
查看>>
Docker背后的内核知识:命名空间资源隔离
查看>>
《圣殿祭司的ASP.NET4.0专家技术手册》---- 1-13 ClientBuilderManager类别的编译功能...
查看>>
《Java编码指南:编写安全可靠程序的75条建议(英文版)》—— 2.7 修复错误...
查看>>
《Redis入门指南(第2版)》一3.2 字符串类型
查看>>
《Adobe Flash Professional CC经典教程》——1.3 使用“库”面板
查看>>
《Android应用开发入门经典(第3版)》——导读
查看>>
xmemcached发布1.3.6
查看>>
《Nmap渗透测试指南》—第6章6.4节IP欺骗
查看>>
Samba 系列(九):将 CentOS 7 桌面系统加入到 Samba4 AD 域环境中
查看>>
《精通自动化测试框架设计》目录—导读
查看>>
全球投资者为阿里尖叫!阿里CEO张勇详解天猫商业新力量
查看>>