https://archive.apache.org/dist/kafka/2.2.0/
1
2
|
wget https://archive.apache.org/dist/kafka/2.2.0/kafka_2.12-2.2.0.tgz
tar xf kafka_2.12-2.2.0.tgz -C /usr/local/
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
[Unit]
Description=Apache Zookeeper server
Documentation=http://zookeeper.apache.org
Requires=network.target
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/kafka_2.12-2.2.0/bin/zookeeper-server-start.sh /usr/local/kafka_2.12-2.2.0/config/zookeeper.properties
ExecStop=/usr/local/kafka_2.12-2.2.0/bin/zookeeper-server-stop.sh
Restart=on-abnormal
User=root
Group=root
EnvironmentFile=/etc/default/zookeeper
[Install]
WantedBy=multi-user.target
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
cat /etc/systemd/system/kafka.service
[Unit]
Description=Apache Kafka Server
Documentation=http://kafka.apache.org/documentation.html
Requires=zookeeper.service
[Service]
Type=simple
ExecStart=/usr/local/kafka_2.12-2.2.0/bin/kafka-server-start.sh /usr/local/kafka_2.12-2.2.0/config/server.properties
ExecStop=/usr/local/kafka_2.12-2.2.0/bin/kafka-server-stop.sh
Restart=on-abnormal
EnvironmentFile=/etc/default/kafka
[Install]
WantedBy=multi-user.target
|
1
2
3
4
|
\# cat /etc/default/zookeeper
JAVA_HOME=/usr/local/jdk1.8.0_333
\# cat /etc/default/kafka
JAVA_HOME=/usr/local/jdk1.8.0_333
|
列出topic
1
|
./kafka-topics.sh --list --zookeeper localhost:2181
|
列出消费groups
1
|
./kafka-consumer-groups.sh --bootstrap-server "xxx:9092,xxx1:9092,xxx2:9092" --list
|
列出retention信息
1
|
./kafka-configs.sh --zookeeper localhost:2181 --entity-type topics --entity-name __consumer_offsets --describe
|
列出group消费情况
1
|
./kafka-consumer-groups.sh --bootstrap-server "xxx:9092,xxx1:9092,xxx2:9092" --group CONSUME_GROUP_NAME --describe
|