OEL7(RHEL7/CENTOS7)
JDK1.8
Kafka 2.12-2.3.1(自带zookeeper 3.4.14)
- 配置并启动zookeeper
修改config/zookeeper.properties(如有需要):
dataDir=/xxx/xxx/xxx
maxClientCnxns=0
clientPort=2181
后台启动zookeeper(脚本在bin目录下):
nohup ./zookeeper-server-start.sh ../config/zookeeper.properties >zk.out 2>&1 &
最后检查2181端口是否已经在监听
- 配置并启动kafka
修改config/server.properties(如有需要):
#个人场景,指定IP
listeners=PLAINTEXT://192.168.1.1:9092
#允许删除topic,个人场景需要
delete.topic.enable=true
#建议修改
log.dirs=/xxx/xxx/xxx
启动kafka
nohup ./kafka-server-start.sh ../config/server.properties >kafka.out 2>&1 &
- 创建topic
./kafka-topics.sh --create --zookeeper localhost:2181 --config flush.messages=1 --replication-factor 1 --partitions 1 --topic test_topic
查看topic:
./kafka-topics.sh --list --zookeeper localhost:2181
./kafka-topics.sh --describe --topic test_topic --zookeeper localhost:2181