以三個虛擬機為例創建集群
Zookeeper集群節點數量要是奇數

上傳Zookeeper.tar.gz 到Linux(推薦使用Xftp 4)
解壓到/export/server (自定義目錄方便查找)
修改zookeeper文件中的zoo_sample.cfg為 zoo.cfg(方便使用)
環境變量配置編輯 .bashrc 文件, 在文件末尾添加以下環境變量配置:ZooKeeper Env
export ZOOKEEPER_HOME=/opt/zookeeper
export PATH=$PATH:$ZOOKEEPER_HOME/bin配置zoo.cfg(重點)dataDir配置路徑進行修改
在文件末尾添加 server.id=host:port:port
示例
server.1=master:2888:3888
server.2=slave01:2888:3888
server.3=slave02:2888:3888Server ID, 用來標識服務器在集群中的序號
ZooKeeper 集群中, 每臺服務器上的 zoo.cfg 配置文件內容一致。
創建myid文件(識別服務器)
如下
# 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=/export/data/zkdata
# 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=slave01:2888:3888
server.3=slave02:2888:3888
剩余節點配置最后將修改好的zookeeper文件 使用 scp命令復制到剩下兩個節點中
在/export/server路徑下執行
修改myid
初次寫,如有錯誤,還請指正
你是否還在尋找穩定的海外服務器提供商?創新互聯www.cdcxhl.cn海外機房具備T級流量清洗系統配攻擊溯源,準確流量調度確保服務器高可用性,企業級服務器適合批量采購,新人活動首月15元起,快前往官網查看詳情吧
文章標題:LinuxCentos7Zookeeper安轉(集群)-創新互聯
文章轉載:http://www.yijiale78.com/article48/cdjhep.html
成都網站建設公司_創新互聯,為您提供搜索引擎優化、App設計、網站營銷、動態網站、電子商務、自適應網站
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯