1. 程式人生 > >偽分散式安裝zookeeper

偽分散式安裝zookeeper

  1. cd ..; tar -zxvf softs/zookeeper-3.4.5-cdh5.3.6.tar.gz
  2. mv zookeeper-3.4.5-cdh5.3.6 zk-pseudo-distributed
  3. rm zookeeper; ln -s zk-pseudo-distributed zookeeper
  4. cd zookeeper/conf
  5. copy三方zk的配置檔案: cp zoo_sample.cfg zoo1.cfg cp zoo_sample.cfg zoo2.cfg cp zoo_sample.cfg zoo3.cfg
  6. 配置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
  7. 配置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
  8. 配置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
  9. 分別在dataDir指定的資料夾中建立檔案myid,myid檔案內容為對應server的id號,即server後面的數字(範圍為[0,255],一個zk叢集中不允許有重複的)。 必須手動建立對應的log資料夾
  10. 新增環境變數 vim ~/.bash_profile export ZOOKEEPER_HOME=/home/hadoop/bigdater/zookeeper/ export PATH=PATH:ZOOKEEPER_HOME/bin source ~/.bash_profile
  11. 啟動,分別使用不同的配置檔案啟動zk服務(在zk的home根目錄) zkServer.sh start conf/zoo1.cfg zkServer.sh start conf/zoo2.cfg zkServer.sh start conf/zoo3.cfg
  12. 檢視,分別使用不同的配置檔案檢視zk服務(在zk的home根目錄) zkServer.sh status conf/zoo1.cfg zkServer.sh status conf/zoo2.cfg zkServer.sh status conf/zoo3.cfg