一、zookeeper簡介與應用場景
zookeeper 是乙個開源的分布式的,為分布式應用提供協調服務的 apache 專案.提供的服務包括:統一命名服務、統一配置管理、統一集群管理、伺服器節點動態上下線、軟負載均衡等.
zookeeper的主要有單機、偽集群、集群三種部署方式.
三、建立乙個安裝目錄(我這裡想安裝在 /usr/local/zookeeper下面)
四、解壓
1、切換到 /opt目錄下面,然後執行命令解壓
// 解壓檔案到 /usr/local/zookeeper目錄下
tar -zxvf zookeeper-3.4.14.tar.gz -c /usr/local/zookeeper
2、解壓後的目錄結構如下
五、建立配置檔案
1、建立乙個zookeeper的配置檔案zoo.cfg,可複製conf/zoo_sample.cfg作為配置檔案
2、zoo.cfg配置檔案簡介
# the number of milliseconds of each tick
# ticktime:客戶端與伺服器、伺服器與伺服器之間維持心跳的時間間隔,也就是每乙個ticktime會傳送一次心跳,單位為毫秒
ticktime=2000
# the number of ticks that the initial
# synchronization phase can take
# initlimit:集群中leader和follow初始化連線時最多能容忍的心跳數
# 也就是初始化過程中,如果leader和follow在 (10*ticktime)的時間內還沒有連線上,則認為連線失敗
initlimit=10
# the number of ticks that can pass between
# sending a request and getting an acknowledgement
# synclimit:同步通訊實現,leader和follow伺服器之間傳送請求和接收應答最多能容忍的心跳數
# 也就是leader和follow如果傳送的請求在 (5*ticktime)的時間沒沒有應答,那麼就認為leader和follow之間連線失敗
synclimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
# datadir:zookeeper儲存日誌檔案的目錄
datadir=/tmp/zookeeper
# the port at which the clients will connect
# clientport:客戶端連線zookeeper伺服器的埠,zookeeper會監控這個埠
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.
# # 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.n=yyy:a:b
# n:伺服器編號,每一台伺服器的編號都是唯一的
# yyy:伺服器的ip位址
# a:lf通訊的埠,伺服器與zookeeper集群中leader交換資訊的埠
# b:選舉埠,集群中每一台伺服器的a埠都是一樣的,集群中的每一台伺服器的b埠也是一樣的
# 但是當採用偽集群的時候,由於ip位址都是一樣的,只能是a埠和b埠不一樣.
zookeper安裝 ZooKeeper安裝例項
獲取zookeeper 3.4.9.tar.gz安裝包 1 建立 usr local services zookeeper 資料夾 mkdir p usr local services zookeeper 2 進入到 usr local services zookeeper 目錄中 cd usr l...
zookeper簡單使用備忘
最近用zookeeper搞了個黑名單系統,把在學習zookeeper的過程看過的資料整理記錄一下 一 安裝配置 解壓得到的檔案 配置檔案位於conf目錄下 zoo.cfg,一台伺服器使用多個zookeeper服務時,可以設定多個配置檔案 呼叫指令碼位於bin目錄下 zkcleanup.sh 清除zo...
搭建zookeper管理solr集群
以兩台伺服器為例 wget 在10.0.1.201伺服器上 1 進入 home 目錄下 隨便選擇目錄 將zookeeper 3.4.9.tar.gz壓縮檔案放入該目錄下 執行命令 tar zxvf zookeeper 3.4.9.tar.gz 解壓zookeeper安裝包zookeeper 3.4....