Apache ZooKeeper:修订间差异

来自Gea-Suan Lin's Wiki
跳到导航 跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
第38行: 第38行:
</syntaxhighlight>
</syntaxhighlight>


  修改 設定檔 目錄:
  告訴系統應該要讀哪個 設定檔 目錄


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
第45行: 第45行:
</syntaxhighlight>
</syntaxhighlight>


 然後設定開機啟動:
 然後設定 開機 啟動:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">

2019年3月1日 (五) 16:50的版本

ZooKeeper是一套基於Java的分散式Key-Value系統。

安裝

Ubuntu 18.04所內附的ZooKeeper已經夠新,可以直接安裝使用:

sudo apt install -y zookeeper zookeeperd

其中zookeeper是程式本體,而zookeeperd是開機時跑起的script。

設定

先把/etc/zookeeper/conf_example/的內容複製一份到/etc/zookeeper/conf_production/下:

sudo cp -R /etc/zookeeper/conf_example/ /etc/zookeeper/conf_production/

每台機器的/etc/zookeeper/conf_production/myid都需要不同,可以從1255

1

這邊要列出所有機器/etc/zookeeper/conf_production/zoo.cfg

tickTime=2000
dataDir=/var/lib/zookeeper/
clientPort=2181
initLimit=5
syncLimit=2
server.1=172.31.x:2888:3888
server.2=172.31.x:2888:3888
server.3=172.31.x:2888:3888

告訴系統應該要讀哪個設定檔(目錄):

sudo update-alternatives --install /etc/zookeeper/conf zookeeper-conf /etc/zookeeper/conf_production 1
sudo update-alternatives --set zookeeper-conf /etc/zookeeper/conf_production

然後設定在開機時啟動:

sudo systemctl enable zookeeper

可以重開機,或是直接跑起來:

sudo service zookeeper start

測試

echo stat | nc 127.0.0.1 2181

外部連結