1. 자바 설치
sudo dnf install java-11-openjdk wget vim
2. 카프카 다운로드
wget https://dlcdn.apache.org/kafka/3.0.0/kafka_2.13-3.0.0.tgz
tar xzf kafka_2.13-3.0.0.tgz
mv kafka_2.13-3.0.0 /usr/local/kafka
3.카프카 Systemd Unit Files 세팅
vim /etc/systemd/system/zookeeper.service
[Unit]
Description=Apache Zookeeper server
Documentation=http://zookeeper.apache.org
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
ExecStart=/usr/bin/bash /usr/local/kafka/bin/zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.properties
ExecStop=/usr/bin/bash /usr/local/kafka/bin/zookeeper-server-stop.sh
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
vim /etc/systemd/system/kafka.service
[Unit]
Description=Apache Kafka Server
Documentation=http://kafka.apache.org/documentation.html
Requires=zookeeper.service
[Service]
Type=simple
Environment="JAVA_HOME=/usr/lib/jvm/jre-11-openjdk"
ExecStart=/usr/bin/bash /usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties
ExecStop=/usr/bin/bash /usr/local/kafka/bin/kafka-server-stop.sh
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
4. Kafka 서버 시작
sudo systemctl start zookeeper
sudo systemctl start kafka
sudo systemctl status kafka
5. 포트 오픈 (필수 아님)
firewall-cmd --permanent --zone=public --add-port=9092/tcp
firewall-cmd --reload
6. 외부 접속 오픈 (필수 아님)
vi /usr/local/kafka/config/server.properties
# Hostname and port the broker will advertise to producers and consumers. If not set,
# it uses the value for "listeners" if configured. Otherwise, it will use the value
# returned from java.net.InetAddress.getCanonicalHostName().
advertised.listeners=PLAINTEXT://192.168.0.1:9092
7. 외부 접속 오픈 (필수 아님)
sudo systemctl restart kafka
sudo systemctl status kafka
'Linux > CentOS' 카테고리의 다른 글
[CentOS Stream8] 09. Redmine 설치 (0) | 2021.04.23 |
---|---|
[CentOS Stream8] 08. Tomcat 8.5 설치 (0) | 2021.04.21 |
[CentOS Stream8] 07. Java 설치(OpenJDK) (0) | 2021.04.19 |
[CentOS Stream8] 06. Jenkins 설치 및 삭제 (0) | 2021.04.19 |
[CentOS Stream8] 05. MariaDB 설치 (0) | 2021.04.19 |