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

Edge for Private Cloud v. 4.16.09

4 文字コマンド

Apache ZooKeeper には、ZooKeeper の投票者ノードとオブザーバー ノードの現在のステータスを判断するのに役立つ「4 文字コマンド」がいくつかあります。これらのコマンドは、「nc」、「telnet」、または特定のポートにコマンドを送信できる別のユーティリティを使用して呼び出すことができます。4 文字のコマンドの詳細については、以下をご覧ください。

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

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

  1. /opt/apigee/customer/application/zookeeper.properties を編集して、次のプロパティを設定します。このファイルが存在しない場合は作成します。
  2. zookeeper.properties で次のプロパティを設定します。
    # スナップショット数を設定します。この例では 10 に設定します。
    conf_zoo_autopurge.snapretaincount=10

    # パージ間隔を設定します。この例では、240 時間に設定します。
    conf_zoo_autopurge.purgeinterval=240
  3. ファイルが「apigee」ユーザーによって所有されていることを確認します。
    > chown apigee:apigee /opt/apigee/customer/application/zookeeper.properties
  4. 次のコマンドを使用して ZooKeeper を再起動します。
    $ /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper restart

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

Apache Zookeeper のログファイルは /opt/apigee/var/log/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. 次のコマンドを使用して ZooKeeper を再起動します。
    $ /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper restart