4 文字コマンド
Apache ZooKeeper には、ZooKeeper の投票者ノードとオブザーバー ノードの現在のステータスを判断するのに役立つ「4 文字コマンド」がいくつかあります。これらのコマンドは、nc、telnet、または特定のポートにコマンドを送信できる別のユーティリティを使用して呼び出すことができます。4 文字コマンドの詳細については、Apache ZooKeeper コマンド リファレンスをご覧ください。
古いスナップショット ファイルを削除する
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で次のプロパティを設定します。# Set the snapshot count. In this example set it to 10: conf_zoo_autopurge.snapretaincount=10 # Set the purge interval. In this example, set is to 240 hours: conf_zoo_autopurge.purgeinterval=240- ファイルの所有者が「apigee」ユーザーであることを確認します。
chown 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/apache-zookeeper に保存されます。通常、ログファイルのメンテナンスは必要ありませんが、ZooKeeper ログの数が多すぎる場合や、ログが非常に大きい場合は、ZooKeeper の log4j プロパティを変更して、最大ファイルサイズとファイル数を設定できます。
/opt/apigee/customer/application/zookeeper.propertiesを編集して、次のプロパティを設定します。このファイルが存在しない場合は作成します。zookeeper.propertiesで次のプロパティを設定します。conf_log4j_log4j.appender.rollingfile.maxfilesize=10MB # max file size conf_log4j_log4j.appender.rollingfile.maxbackupindex=50 # max open files- ファイルの所有者が「apigee」ユーザーであることを確認します。
chown apigee:apigee /opt/apigee/customer/application/zookeeper.properties
- 次のコマンドを使用して ZooKeeper を再起動します。
/opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper restart