LoginSignup
1
1

More than 3 years have passed since last update.

Confluent Kafkaのインストール方法(シングル構成:Local mode)

Last updated at Posted at 2020-01-14

目的

シングル構成のConfluent-Kafkaのインストール方法について、本投稿で解説します。Confluent PlatformはConfluent社が提供するApache Kafkaを中心としたプラットフォームです。Apache Kafkaに加えて、運用ツール等が同梱されています。

手順

Confluent社のHPを参照して、対象となるマシンにダウンロードを実施。この投稿では、AWS Linux 2を使用していたため、RHELのインストール手順を参照しました。
Confluentのパッケージでは、localモードと呼ばれる開発用のスタンドアローンで動作するモードが存在します。今回は機能検証を行うことを目的としてConfluent kafkaをインストールしたので、localモードで構築します。
localモードについての詳細は、Confluent社のHPを参照してください。

Javaをインストールする。

yum install java-1.8.0-openjdk-devel

環境変数の設定を行う。

echo "export JAVA_HOME=$(readlink -e $(which java)|sed 's:/bin/java::')" > /etc/profile.d/java.sh
echo "PATH=\$PATH:\$JAVA_HOME/bin" >> /etc/profile.d/java.sh
source /etc/profile

Install the Confluent Platform public key. This key is used to sign packages in the YUM repository.

sudo rpm --import https://packages.confluent.io/rpm/5.3/archive.key

Navigate to /etc/yum.repos.d/ and create a file named confluent.repo with these contents. This adds the Confluent repository

[Confluent.dist]
name=Confluent repository (dist)
baseurl=https://packages.confluent.io/rpm/5.3/7
gpgcheck=1
gpgkey=https://packages.confluent.io/rpm/5.3/archive.key
enabled=1

[Confluent]
name=Confluent repository
baseurl=https://packages.confluent.io/rpm/5.3
gpgcheck=1
gpgkey=https://packages.confluent.io/rpm/5.3/archive.key
enabled=1

Clear the YUM caches and install Confluent Platform.

sudo yum clean all && sudo yum install confluent-platform-2.12

スタンドアローンで動作させる際に使用するconfluent localコマンドを利用するため、Confluent CLIをインストールします。

curl -L https://cnfl.io/cli | sh -s -- -b /opt/confluent-5.3.1/bin

Confluent binディレクトリのインストール場所をPATHに追加します。

echo "export PATH=/opt/confluent-5.3.1/bin:$PATH" >> /etc/profile.d/confluent.sh
source /etc/profile

confluent local startコマンドを使用してConfluent Platformを起動します。
このコマンドにより、Kafkaだけではなく、Kafka Connect、KSQLなどの全てのConfluent Platformのコンポーネントが起動します。

confluent local start
    The local commands are intended for a single-node development environment
    only, NOT for production usage. https://docs.confluent.io/current/cli/index.html

Using CONFLUENT_CURRENT: /tmp/confluent.rrEB8cE3
Starting zookeeper
zookeeper is [UP]
Starting kafka
kafka is [UP]
Starting schema-registry
schema-registry is [UP]
Starting kafka-rest
kafka-rest is [UP]
Starting connect
connect is [UP]
Starting ksql-server
ksql-server is [UP]
Starting control-center
control-center is [UP]
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1