Apache Zookeeper のメンテナンス タスク

4 文字のコマンド

Apache ZooKeeper には、ZooKeeper のボーターノードとオブザーバ ノードの現在のステータスの判断に役立つ「4 文字のコマンド」がいくつかあります。これらのコマンドは、nctelnet、または特定のポートにコマンドを送信できる別のユーティリティを使用して呼び出すことができます。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

これらのプロパティに異なる値を設定するには:

  1. /opt/apigee/customer/application/zookeeper.properties を編集して次のプロパティを設定します。このファイルが存在しない場合は作成します。
  2. 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
  3. ファイルの所有者を「apigee」ユーザーにします。
    chown apigee:apigee /opt/apigee/customer/application/zookeeper.properties
  4. コマンド
    /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper restart
    を使用して、ZooKeeper を再起動します。

ログファイルのメンテナンス

Apache Zookeeper のログファイルは /opt/apigee/var/log/apache-zookeeper に保持されます。通常、ログファイルのメンテナンスは必要ありませんが、ZooKeeper ログの数が多すぎる場合やログが非常に大きい場合は、ZooKeeper の log4j プロパティを変更して、最大ファイルサイズとファイル数を設定できます。

  1. /opt/apigee/customer/application/zookeeper.properties を編集して次のプロパティを設定します。このファイルが存在しない場合は作成します。
  2. zookeeper.properties で次のプロパティを設定します。
    conf_log4j_log4j.appender.rollingfile.maxfilesize=10MB
    # max file size
    conf_log4j_log4j.appender.rollingfile.maxbackupindex=50 # max open files
  3. ファイルの所有者を「apigee」ユーザーにします。
    chown apigee:apigee /opt/apigee/customer/application/zookeeper.properties
  4. コマンド
    /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper restart
    を使用して、ZooKeeper を再起動します。