5.9. トピック設定の変更

kafka-configs.sh ツールを使用して、トピック設定を変更することができます。kafka-configs.sh は AMQ Streams ディストリビューションの一部で、bin ディレクトリーにあります。

前提条件

  • AMQ Streams クラスターがインストールされ、実行されている。
  • トピック mytopic が存在する。

トピック設定の変更

  1. kafka-configs.sh ツールを使用して、現在の設定を取得します。

    • --zookeeper オプションで ZooKeeper の URL を指定します。
    • --entity-typetopic として、--entity-name をトピックの名前に設定します。
    • --describe オプション: 現在の設定を取得するために使用します。

      bin/kafka-configs.sh --zookeeper <ZooKeeperAddress> --entity-type topics --entity-name <TopicName> --describe

      mytopic という名前のトピックの設定を取得するコマンドの例

      bin/kafka-configs.sh --zookeeper zoo1.my-domain.com:2181 --entity-type topics --entity-name mytopic --describe

  2. kafka-configs.sh ツールを使用して、現在の設定を変更します。

    • --zookeeper オプションで ZooKeeper URL を指定します。
    • --entity-typetopic として、--entity-name をトピックの名前に設定します。
    • --alter オプション: 現在の設定を変更するのに使用します。
    • --add-config オプション: 追加または変更するオプションを指定します。

      bin/kafka-configs.sh --zookeeper <ZooKeeperAddress> --entity-type topics --entity-name <TopicName> --alter --add-config <Option>=<Value>

      mytopic という名前のトピックの設定を変更するコマンドの例

      bin/kafka-configs.sh --zookeeper zoo1.my-domain.com:2181 --entity-type topics --entity-name mytopic --alter --add-config min.insync.replicas=1

  3. kafka-configs.sh ツールを使用して、既存の設定オプションを削除します。

    • --zookeeper オプションで ZooKeeper URL を指定します。
    • --entity-typetopic として、--entity-name をトピックの名前に設定します。
    • --delete-config オプション: 既存の設定オプションを削除するのに使用します。
    • --remove-config オプション: 削除するオプションを指定します。

      bin/kafka-configs.sh --zookeeper <ZooKeeperAddress> --entity-type topics --entity-name <TopicName> --alter --delete-config <Option>

      mytopic という名前のトピックの設定を変更するコマンドの例

      bin/kafka-configs.sh --zookeeper zoo1.my-domain.com:2181 --entity-type topics --entity-name mytopic --alter --delete-config min.insync.replicas

関連情報