Apache ZooKeeper:修订间差异
跳到导航
跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
(→硬體) |
(→硬體) |
||
第5行: | 第5行: | ||
在測試環境下,ZooKeeper可以只使用<code>t3.nano</code>(512 MB的記憶體),另外手動加上512 MB的Swap執行。 | 在測試環境下,ZooKeeper可以只使用<code>t3.nano</code>(512 MB的記憶體),另外手動加上512 MB的Swap執行。 | ||
在正式環境下,[[Confluent]]官方的建議是4 GB的記憶體與64 GB以上的SSD{{Cite web |url=https://docs.confluent.io/platform/current/zookeeper/deployment.html |title=Running ZooKeeper in Production |language=en |accessdate=2021-05-18}}。 | 在正式環境下,[[Confluent]]官方的建議是4 GB的記憶體與64 GB以上的SSD<ref>{{Cite web |url=https://docs.confluent.io/platform/current/zookeeper/deployment.html |title=Running ZooKeeper in Production |language=en |accessdate=2021-05-18}}</ref> 。 | ||
== 安裝 == | == 安裝 == |
2021年5月18日 (二) 14:38的最新版本
ZooKeeper是一套基于Java的分散式Key-Value系统。
硬件
在测试环境下,ZooKeeper可以只使用t3.nano
(512 MB的内存),另外手动加上512 MB的Swap执行。
在正式环境下,Confluent官方的建议是4 GB的内存与64 GB以上的SSD[1]。
安装
在Ubuntu的系统内有提供ZooKeeper套件,另外在Confluent的套件中也有提供(通常会在配合Apache Kafka时使用)。
这边会使用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
相关连结
参考文献
- ↑ Running ZooKeeper in Production. [2021-05-18] (English).
外部链接
- 官方网站 (英文)