ZIP アーカイブと TAR アーカイブを使用した手動インストール¶
このトピックでは、レプリケーションされた ZooKeeper アンサンブルを含むマルチノード環境に本稼働環境用の Confluent Platform 構成をインストールする手順について説明します。
このインストール方法では、すべてのノードに手動で接続してアーカイブをダウンロードし、Confluent Platform インストールコマンドを実行します。
重要
クラスター内のノードごとにこれらの手順を実行する必要があります。
- 前提条件
- Confluent Platform をインストールする前に、ご使用の環境が次の ソフトウェアおよびハードウェア要件 を満たしている必要があります。
ソフトウェアの入手¶
ダウンロードページ に移動してアーカイブパッケージを選択するか、curl を使用して直接ダウンロードします。
- Confluent Platform
ZIP
curl -O http://packages.confluent.io/archive/6.1/confluent-6.1.5.zip
TAR
curl -O http://packages.confluent.io/archive/6.1/confluent-6.1.5.tar.gz
- Confluent Platform using only Confluent Community components
ZIP
curl -O http://packages.confluent.io/archive/6.1/confluent-community-6.1.5.zip
TAR
curl -O http://packages.confluent.io/archive/6.1/confluent-community-6.1.5.tar.gz
アーカイブの内容を抽出します。ZIP ファイルの場合は、ターミナルでこのコマンドを実行します。
unzip confluent-6.1.5.zip
TAR ファイルの場合は、以下のコマンドを実行します。
tar xzf confluent-6.1.5.tar.gz
以下のディレクトリが展開されます。
フォルダー 説明 /bin/ サービスを開始および停止するためのドライバスクリプト /etc/ 構成ファイル /lib/ Systemd サービス /logs/ ログファイル /share/ Jar およびライセンス /src/ プラットフォーム依存のビルドを必要とするソースファイル
Confluent Platform の構成¶
ちなみに
confluent secret コマンドを使用すると、パスワードやその他の構成データを安全に保管できます。詳細については、「シークレット管理」を参照してください。
個々のコンポーネントプロパティファイルを使用して Confluent Platform を構成します。デフォルトでは、これらは <path-to-confluent>/etc/
にあります。最低限、以下のコンポーネントを構成する必要があります。
ZooKeeper¶
これらの手順は、ZooKeeper をレプリケーションモードで実行していることを想定しています。レプリケーションモードには最低 3 台のサーバーが必要で、フェールオーバーには奇数台のサーバーが必要です。詳細については、ZooKeeper のドキュメント を参照してください。
ZooKeeper プロパティファイル(
/etc/kafka/zookeeper.properties
)に移動し、以下のように変更します。tickTime=2000 dataDir=/var/lib/zookeeper/ clientPort=2181 initLimit=5 syncLimit=2 server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 autopurge.snapRetainCount=3 autopurge.purgeInterval=24
この構成は、3 ノードアンサンブル用です。この構成ファイルは、アンサンブル内のすべてのノードで同一である必要があります。
tickTime
、dataDir
、およびclientPort
はすべて、代表的な単一のサーバー値に設定されています。initLimit
とsyncLimit
は、後続の ZooKeeper サーバーが現在のリーダーで初期化するのにかかる時間と、リーダーと同期せずにいられる時間を制御します。この構成では、フォロワーは初期化に 10000 ミリ秒までかけることができ、tickTime
が 2000 ミリ秒 に設定されているので最大 4000 ミリ秒まで非同期になる可能性があります。server.*
プロパティで、アンサンブルのメンバーシップが設定されます。フォーマットは以下のとおりです。server.<myid>=<hostname>:<leaderport>:<electionport>
myid
はサーバー識別番号です。サーバーが 3 台であるため、各サーバーには、1
、2
、および3
の値を持つ異なるmyid
が付けられています。myid
は、人間が判読可能な ASCII テキストで 1 つの整数を記述したmyid
という名前のファイルをdataDir
に作成することにより設定されます。この整数値は、構成ファイルのmyid
値のいずれかに一致する必要があります。別のアンサンブルメンバーが既に競合するmyid
値で開始されている場合は、エラーが表示されます。leaderport
は、リーダー以外のメンバー(フォロワー)が、アクティブなリーダーに接続するために使用します。このポートは、すべての ZooKeeper アンサンブルメンバー間で開かれている必要があります。electionport
は、アンサンブルメンバー間でリーダーを選ぶために使用されます。このポートは、すべての ZooKeeper アンサンブルメンバー間で開かれている必要があります。
autopurge.snapRetainCount
およびautopurge.purgeInterval
は、24 時間ごとに 3 つのスナップショット以外をすべてパージするよう設定されています。ZooKeeper ログディレクトリ(例:
/var/lib/zookeeper/
)に移動し、myid
という名前のファイルを作成します。myid
ファイルは 1 行で構成され、この行には<machine-id>
というフォーマットのマシン ID が含まれています。ZooKeeper サーバーは、起動時にmyid
ファイルを参照することによって、自分がどのサーバーであるかを認識します。たとえば、サーバー 1 のmyid
値は1
になります。
Kafka¶
本稼働環境では、複数のブローカーが必要です。起動中に、ブローカーはクラスターのメンバーになるように、ZooKeeper にそれ自体を登録します。
Apache Kafka® プロパティファイル(/etc/kafka/server.properties
)に移動し、次のとおりカスタマイズします。
同じ ZooKeeper アンサンブルに接続します。これにはすべてのノードで、
zookeeper.connect
を同じ値に設定します。localhost
のすべてのインスタンスをノードのホスト名または FQDN(完全修飾ドメイン名)に置き換えます。たとえば、ホスト名がzookeeper
である場合、以下のとおり設定します。zookeeper.connect=zookeeper:2181
クラスター内の各ノードに対するブローカー ID を次のいずれかの方法で構成します。
ブローカー ID を動的に生成 :
broker.id.generation.enable=true
を追加し、broker.id
の行をコメントアウトします。以下に例を示します。############################# Server Basics ############################# # The ID of the broker. This must be set to a unique integer for each broker. #broker.id=0 broker.id.generation.enable=true
ブローカー ID を手動で設定 : 各ノードの
broker.id
に一意の値を設定します。
他のブローカーやクライアントがこのブローカーと通信する方法を、
listeners
または場合によりadvertised.listeners
を使用して構成します。listeners
: リッスン対象の URI とリスナー名のコンマ区切りのリスト。advertised.listeners
: 他のブローカーやクライアントで使用する URI とリスナー名のコンマ区切りのリスト。advertised.listeners
パラメーターでは、ブローカーがローカルと外部の両方のホストからアクセスできるアドレスをアドバタイズすることを保証します。
詳細については「本稼働環境の構成オプション」を参照してください。
環境のセキュリティを構成します。
- 一般的なガイダンスについては、「セキュリティの概要」を参照してください。
- role-based access control (RBAC) については、「Metadata Service (MDS) の構成」を参照してください。
- SSL 暗号化、SASL 認証、認可については、「セキュリティのチュートリアル」を参照してください。
Control Center¶
Control Center プロパティファイル(
/etc/confluent-control-center/control-center-production.properties
)に移動して、次のとおりカスタマイズします。# host/port pairs to use for establishing the initial connection to the Kafka cluster bootstrap.servers=<hostname1:port1,hostname2:port2,hostname3:port3,...> # location for Control Center data confluent.controlcenter.data.dir=/var/lib/confluent/control-center # the Confluent license confluent.license=<your-confluent-license> # ZooKeeper connection string with host and port of a ZooKeeper servers zookeeper.connect=<hostname1:port1,hostname2:port2,hostname3:port3,...>
この構成は、3 ノードのマルチノードクラスター用です。詳細については、「Control Center の構成の詳細」を参照してください。Confluent Platform ライセンスの詳細については、「Confluent Platform ライセンスの管理」を参照してください。
Kafka サーバー構成ファイル(
/etc/kafka/server.properties
)に移動し、Confluent Metrics Reporter を有効にします。##################### Confluent Metrics Reporter ####################### # Confluent Control Center and Confluent Auto Data Balancer integration # # Uncomment the following lines to publish monitoring data for # Confluent Control Center and Confluent Auto Data Balancer # If you are using a dedicated metrics cluster, also adjust the settings # to point to your metrics Kafka cluster. metric.reporters=io.confluent.metrics.reporter.ConfluentMetricsReporter confluent.metrics.reporter.bootstrap.servers=localhost:9092 # # Uncomment the following line if the metrics cluster has a single broker confluent.metrics.reporter.topic.replicas=1
これらの行を Kafka Connect プロパティファイル(
/etc/kafka/connect-distributed.properties
)に追加して、インターセプターのサポートを追加します。# Interceptor setup consumer.interceptor.classes=io.confluent.monitoring.clients.interceptor.MonitoringConsumerInterceptor producer.interceptor.classes=io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor
Schema Registry¶
Schema Registry プロパティファイル(/etc/schema-registry/schema-registry.properties
)に移動し、以下のプロパティを指定します。
# Specify the address the socket server listens on, e.g. listeners = PLAINTEXT://your.host.name:9092
listeners=http://0.0.0.0:8081
# The host name advertised in ZooKeeper. This must be specified if your running Schema Registry
# with multiple nodes.
host.name=192.168.50.1
# List of Kafka brokers to connect to, e.g. PLAINTEXT://hostname:9092,SSL://hostname2:9092
kafkastore.bootstrap.servers=PLAINTEXT://hostname:9092,SSL://hostname2:9092
この構成は、3 ノードのマルチノードクラスター用です。詳細については、「本稼働環境での Schema Registry の実行」を参照してください。
Confluent Platform の起動¶
Kafka CLI コマンドを使用して Confluent Platform をインストールします。
ちなみに
ZooKeeper、Kafka、および Schema Registry は、この特定の順序で起動し、他のコンポーネントよりも先に起動する必要があります。
ZooKeeper を起動します。このコマンドは個別のターミナルで実行します。
<path-to-confluent>/bin/zookeeper-server-start <path-to-confluent>/etc/kafka/zookeeper.properties
Kafka を起動します。このコマンドは個別のターミナルで実行します。
<path-to-confluent>/bin/kafka-server-start <path-to-confluent>/etc/kafka/server.properties
Schema Registry を起動します。このコマンドは個別のターミナルで実行します。
<path-to-confluent>/bin/schema-registry-start <path-to-confluent>/etc/schema-registry/schema-registry.properties
必要に応じて、他の Confluent Platform コンポーネントを起動します。
Control Center
<path-to-confluent>/bin/control-center-start <path-to-confluent>/etc/confluent-control-center/control-center.properties
Kafka Connect
<path-to-confluent>/bin/connect-distributed <path-to-confluent>/etc/schema-registry/connect-avro-distributed.properties
Confluent REST Proxy
<path-to-confluent>/bin/kafka-rest-start <path-to-confluent>/etc/kafka-rest/kafka-rest.properties
ksqlDB
<path-to-confluent>/bin/ksql-server-start <path-to-confluent>/etc/ksqldb/ksql-server.properties
アンインストール¶
Confluent ディレクトリを削除します。たとえば、Confluent Platform 6.1.5 をインストールしているとします。
rm -rf confluent-6.1.5
Confluent Platform データファイルを削除します。
rm -rf /var/lib/<confluent-platform-data-files>
次のステップ¶
Apache Kafka クイックスタート を試してみます。