Apache ZooKeeper:修订间差异
跳到导航
跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
(→首段) |
(→安裝) |
||
第3行: | 第3行: | ||
== 安裝 == | == 安裝 == | ||
[[Ubuntu]] 18.04所內附的ZooKeeper已經夠新,可以直接安裝使用: | 在[[Ubuntu]] 18.04所內附的ZooKeeper已經夠新,可以直接安裝使用: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
第9行: | 第9行: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
其中<code>zookeeperd</code>是開機時的script。 | 其中<code>zookeeper</code>是程式本體,而<code>zookeeperd</code>是開機時 跑起 的script。 | ||
== 設定 == | == 設定 == |
2019年3月1日 (五) 16:49的版本
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
都需要不同,可以从1
到255
:
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
外部链接
- 官方网站 (英文)