1. 程式人生 > >windows下 zookeeper 叢集的安裝、配置、部署

windows下 zookeeper 叢集的安裝、配置、部署

 前提:配置Java環境      

        zookeeper 單臺和叢集的區別在於配置檔案(conf/zoo.cfg)的配置不同,還有dataDir的目錄需要新建一個沒有檔案型別的檔案myid,並起myid裡面的值輸入對應配置中server.後面的數值。附上我配置的檔案資訊 https://download.csdn.net/download/qq_38428623/10691734    我是在我的機器上部署的,所以屬於是偽叢集。

具體步驟如下: 1、進去conf目錄,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=../tmp/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.x=y:z:m server.1=127.0.0.1:2280:2281 server.2=127.0.0.1:2380:2381 server.3=127.0.0.1:2480:2481

server.x=y:z:m(其中x為myid寫的值,而且時數值型別,其主要也是用於選舉leader的值之一,y為當前機器的ip地址,z為心跳埠,m為資料交換的埠,比如選舉leader時的埠)。

2、進去配置檔案中dataDir配置的目錄,在目錄下新建一個檔名字叫 myid,並且開啟myid檔案裡面的值輸入配置檔案中 server.後面的數值

複製一份程式並且重新命名,按照上面的步驟操作一邊,其實也可以複製配置檔案,但是我是直接複製程式,最終的結果: