zookeepr 單機偽叢集配置

來源:互聯網
上載者:User

1. 要在單機下搭建群集,簡單的就是分別解壓複製N個目錄。

2. 每個目錄,分配配置對應的data 和 myid ,其中myid 用來表明當前啟動是哪個zookeeper

3. 設定檔的群集屬性

server.1=127.0.0.1:2881:3881
server.2=127.0.0.1:2882:3883
server.3=127.0.0.1:2883:3883
server.4=127.0.0.1:2884:3884
server.5=127.0.0.1:2885:3885

4. (我被坑的地方)每個zookeeper 服務有三個連接埠,clientPort=2181,這個用於指明給用戶端應用串連的端

(例如java 程式訪問就是這個連接埠)

    server.1=127.0.0.1:2881:3881 ,其中2881 用於群集間的伺服器進行資料通訊,3881 用於群集剛啟動時 

或leader 當機時 進行選舉。

完整的設定檔(單機環境,5個執行個體的連接埠都要不一樣)

# 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=D:/data/zookeeper/server5/data
# the port at which the clients will connect
clientPort=2185
#
# 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=127.0.0.1:2881:3881
server.2=127.0.0.1:2882:3883
server.3=127.0.0.1:2883:3883
server.4=127.0.0.1:2884:3884
server.5=127.0.0.1:2885:3885

附上完整的設定檔 https://swtools.googlecode.com/git/linux/zookeeper/zookeeper.zip

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.