IBM Support

InfoSphere Information Server: kafka\data\1\__consumer_offsets-0 に多数のログファイル (Windows版)

Question & Answer


Question

InfoSphere Information Server 11.7.1 の Windows 版をインストールしたところ、kafka\data\1\__consumer_offset_0 のディレクトリに多数の .log や .index が出力されています。この数を減らすことはできませんか?
※ AIX, Linux 版での対応手順は Technote 6612223 を参照してください。

Cause

デフォルトの設定では、生成後 168時間経過したログファイルが削除されるようになっています。この経過時間では多数のログファイルが生成される可能性があるので、経過時間を短くします。

Answer

(1) InfoSphere Information Server のインストールフォルダーに移動します。(例 C:\IBM\InformationServer)
> cd C:\IBM\InformationServer
(2) shared-open-source\kafka\conf に移動して、server1.properties のバックアップを取ります。
> cd shared-open-source\kafka\conf
> copy server1.properties server1.properties.orig
(3) server1.properties をエディターで開きます。(Unix の改行コードに対応したエディタを使用します。)
(4) 下記の行を変更して保存します。(例、経過時間を 168時間から 1 時間に変更)
log.retention.hours=168
→ log.retention.hours=1
log.cleaner.enable=true
→ log.cleaner.enable=false
(5) shared-open-source\kafka\install\bin\windows に移動して下記のコマンドを実行します。実行後の警告は無視してかまいません。実行前に Technote 7103248 を参照して、Kafka のバージョンを確認します。
ディレクトリの移動
> cd ..\..\..
> cd shared-open-source\kafka\install\bin\windows
「cleanup.policy」の変更
Kafka 2.x 以前の場合
> kafka-topics.bat --zookeeper localhost:52181 --topic __consumer_offsets --alter --config cleanup.policy=delete
Kafka 3.x 以後の場合
> kafka-configs.bat --bootstrap-server localhost:59092 --alter --entity-type topics --entity-name __consumer_offsets --add-config cleanup.policy=delete
「cleanup.policy」の確認
> kafka-configs.bat --bootstrap-server localhost:59092 --describe --entity-type topics --entity-name __consumer_offsets
「cleanup.policy=delete」という文字列が出力されていれば設定が反映されています。
(6) shared-open-source\bin に移動して Shared Open Source サービスを再起動します。
> cd ..\..\..\..\..
> cd shared-open-source\bin
> stop-windows-services.bat
> start-windows-services.bat
(7) log.retention.hours で設定した経過時間後に、shared-open-source\kafka\data\1\__consumer_offsets-0 に移動して、ログファイルの数が減っていることを確認します。
注記1:
update-config.bat を実行すると server1.properties が初期化されてしまいますが、cleanup.policy の設定は保持されたままなので、対策は不要です。再設定の必要が生じた場合は、再度、手順(1)から行ってください。
注記2:
・初期値が「log.cleaner.enable=false」であっても、自動パージが無効になっているときは、この手順を行ってください。
・ディスク空き容量に応じて、「log.retention.hours」の値を小さくしてください。
更新履歴:
2019-10-06: 初版
2023-12-28: kafka のバージョンチェックを追加
2024-08-07: update-config の記述を追加

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSZJPZ","label":"IBM InfoSphere Information Server"},"Component":"","Platform":[{"code":"PF033","label":"Windows"}],"Version":"11.7.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
06 August 2024

UID

ibm10886275