偽分散式安裝zookeeper
阿新 • • 發佈:2018-12-10
- cd ..; tar -zxvf softs/zookeeper-3.4.5-cdh5.3.6.tar.gz
- mv zookeeper-3.4.5-cdh5.3.6 zk-pseudo-distributed
- rm zookeeper; ln -s zk-pseudo-distributed zookeeper
- cd zookeeper/conf
- copy三方zk的配置檔案: cp zoo_sample.cfg zoo1.cfg cp zoo_sample.cfg zoo2.cfg cp zoo_sample.cfg zoo3.cfg
- 配置zoo1.cfg的檔案內容 tickTime=2000 initLimit=10 syncLimit=5 dataDir=/home/hadoop/bigdater/zookeeper/zk/data1 dataLogDir=/home/hadoop/bigdater/zookeeper/zk/log1 clientPort=2181 server.1=hh:2287:3387 server.2=hh:2288:3388 server.3=hh:2289:3389
- 配置zoo2.cfg的檔案內容 tickTime=2000 initLimit=10 syncLimit=5 dataDir=/home/hadoop/bigdater/zookeeper/zk/data2 dataLogDir=/home/hadoop/bigdater/zookeeper/zk/log2 clientPort=2182 server.1=hh:2287:3387 server.2=hh:2288:3388 server.3=hh:2289:3389
- 配置zoo3.cfg的檔案內容 tickTime=2000 initLimit=10 syncLimit=5 dataDir=/home/hadoop/bigdater/zookeeper/zk/data3 dataLogDir=/home/hadoop/bigdater/zookeeper/zk/log3 clientPort=2183 server.1=hh:2287:3387 server.2=hh:2288:3388 server.3=hh:2289:3389
- 分別在dataDir指定的資料夾中建立檔案myid,myid檔案內容為對應server的id號,即server後面的數字(範圍為[0,255],一個zk叢集中不允許有重複的)。 必須手動建立對應的log資料夾
- 新增環境變數 vim ~/.bash_profile export ZOOKEEPER_HOME=/home/hadoop/bigdater/zookeeper/ export PATH=ZOOKEEPER_HOME/bin source ~/.bash_profile
- 啟動,分別使用不同的配置檔案啟動zk服務(在zk的home根目錄) zkServer.sh start conf/zoo1.cfg zkServer.sh start conf/zoo2.cfg zkServer.sh start conf/zoo3.cfg
- 檢視,分別使用不同的配置檔案檢視zk服務(在zk的home根目錄) zkServer.sh status conf/zoo1.cfg zkServer.sh status conf/zoo2.cfg zkServer.sh status conf/zoo3.cfg