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

Edge for Private Cloud v4.19.01

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. 次のコマンドを使用して ZooKeeper を再起動します。
    /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper restart

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

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. 次のコマンドを使用して ZooKeeper を再起動します。
    /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper restart