标签:load group syn start etc 管理 sync inf 说明
Kafka需要使用Zookeeper进行调度,本文描述的主要内容有:安装环境为CentOS7.x,官网下载最新版的Kafka,解压至/opt/kafka中(可以创建一个指向当前版本的软连接)。
tar -zxf kafka_2.12-2.1.1.tar.gz -C /opt // 解压到指定文件夹下
ln -s /opt/kafka_2.12-2.1.1 /opt/kafka // 创建指向当前版本的软连接
系统定义服务脚本位于/usr/lib/systemd/system/目录下,自定义服务脚本位于/etc/systemd/system/目录下。因此在/etc/systemd/system/目录下,新建zookeeper.service文件,内容如下:
[Unit]
Description=zookeeper.service
After=network.target
[Service]
User=root
Type=idle
Enviroment=ZOO_LOG_DIR=/var/log/zookeeper
ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties
ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh /opt/kafka/config/zookeeper.properties
ExecReload=$ExecStop;$ExecStart
[Install]
WantedBy=multi-user.target
在/etc/systemd/system/目录下,创建kafka.service文件
[Unit]
Description=kafka.service
After=network.target remote-fs.target zookeeper.service
[Service]
User=root
Type=idle
ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
ExecStop=/opt/kafka/bin/kafka-server-stop.sh /opt/kafka/config/server.properties
ExecReload=$ExecStop;$ExecStart
[Install]
WantedBy=multi-user.target
系统自带的firewalld管理的服务位于/usr/lib/firewalld/services/目录下,自定义的firewalld管理服务位于/etc/firewalld/services/目录下。因此在/etc/firewalld/services/目录下,新建zookeeper.xml文件,内容如下:
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>Zookeeper</short>
<description>Zookeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. Usually used with Kafka.</description>
<port protocol="tcp" port="2181"/>
<port protocol="tcp" port="2888-3888"/>
</service>
在/etc/firewalld/services/目录下,新建kafka.xml文件,内容如下:
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>Kafka</short>
<description>Kafka is a streaming platform.</description>
<port protocol="tcp" port="9092"/>
</service>
标签:load group syn start etc 管理 sync inf 说明
原文地址:https://blog.51cto.com/huanghai/2376143