说明:所有配置文件都存在 /home/bigdata/cluster 下,方便管理

配置步骤

  • 当前路径 /home/bigdata/cluster

  • 在当前目录下通过 WGET 下载 Linux 版本的 kafka

  1. wget http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/0.10.2.1/kafka_2.110.10.2.1.tgz
  • 解压文件并且重命名 kafka
tar -xf kafka_2.11-2.1.0.tgz 
mv kafka_2.11-2.1.0/ kafka
  • cd kafka ,配置 server.properties 文件 ,vim config/server.properties
# 配置

host.name=node1 # 修改主机名
port=9092             # 修改服务端口号
zookeeper.connect=10.0.0.11:2181 # 修改Zookeeper服务器地址

52.png53.png


Kafka服务的启动与停止

启动Kafka服务:

  • 启动 Zookeeper
  • 路径 /home/bigdata/cluster/zookeeper 下,输入
 bin/zkServer.sh start
  • 启动 Kafka
  • 路径 /home/bigdata/cluster/kafka 下,输入
bin/kafka-server-start.sh  -daemon ./config/server.properties

54.png

停止Kafka服务

  • 路径 /home/bigdata/cluster/kafka 下,输入
bin/kafka-server-stop.sh