私有雲的邊緣 4.17.09 版
四字母指令
Apache ZooKeeper 提供多個「四個字母」指令,可協助您判斷 ZooKeeper 選民和觀察者節點的目前狀態。您可以使用「nc」、「telnet」或其他可傳送指令至特定通訊埠的公用程式,來叫用這些指令。如要進一步瞭解四字母指令,請前往:
http://zookeeper.apache.org/doc/r3.1.2/zookeeperAdmin.html#sc_zkCommands.
移除舊的快照檔案
Apache ZooKeeper 定期執行維護,自動執行定期維護,移除隨著系統更新而累積的舊快照檔案。下列 /opt/apigee/apigee-zookeeper/conf/zoo.cfg 中的設定可控管這項程序:
## The number of snapshots to retain in dataDir: autopurge.snapRetainCount=5 # Purge task interval in hours. # Set to "0" to disable auto purge feature. autopurge.purgeInterval=120
如要將這些屬性設為不同的值,請按照下列指示操作:
- 編輯 /opt/apigee/customer/application/zookeeper.properties 以設定下列屬性。如果該檔案不存在,請建立一個。
- 在 zookeeper.properties 中設定下列屬性:
# 設定快照數量。以下範例設為 10:
conf_zoo_autopurge.snapretaincount=10
# 設定清除間隔。在這個範例中,設為 240 小時:
conf_zoo_autopurge.purgeinterval=240 - 確認檔案為「apigee」使用者擁有:
> chown apigee:apigee:apigee /opt/apigee/customer/application/zookeeper.properties - 使用下列指令重新啟動 ZooKeeper:
$ /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper restart
記錄檔維護
Apache Zookeeper 記錄檔會保留在 /opt/apigee/var/log/zookeeper。一般而言,不需要維護記錄檔。如果發現 ZooKeeper 記錄檔數量過多,或是記錄過大,您可以修改 ZooKeeper 的 log4j 屬性,設定檔案大小上限和檔案計數上限。
- 編輯 /opt/apigee/customer/application/zookeeper.properties 以設定下列屬性。如果該檔案不存在,請建立一個。
- 在 zookeeper.properties 中設定下列屬性:
conf_log4j_log4j.appender.rollingfile.maxfilesize=10MB # 檔案大小上限
conf_log4j_log4j.appender.rollingfile.maxbackupindex=50 # 個開啟檔案數量上限 - 確認檔案為「apigee」使用者擁有:
> chown apigee:apigee:apigee /opt/apigee/customer/application/zookeeper.properties - 使用下列指令重新啟動 ZooKeeper:
$ /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper restart