Kafka_2.10-0.10.0.0集群安装与配置
上文已经讲过如何安装Zookeeper集群,因为Kafka集群需要依赖Zookeeper服务,虽然Kafka有内置Zookeeper,但是还是建议独立安装Zookeeper集群服务,此处不再赘述 kafka集群还是安装在10.10.16.170 、 10.10.16.132 、10.10.16.133三台机器上面 1、kafka官网下载kafka_2.10-0.1
上文已经讲过如何安装Zookeeper集群,因为Kafka集群需要依赖Zookeeper服务,虽然Kafka有内置Zookeeper,但是还是建议独立安装Zookeeper集群服务,此处不再赘述
kafka集群还是安装在10.10.16.170 、 10.10.16.132 、10.10.16.133三台机器上面
1、kafka官网下载kafka_2.10-0.10.0.0.tgz压缩包,解压缩
2、修改/appcom/kafka_2.10-0.10.0.0/config/server.properties文件:
10.10.16.170机器:
broker.id=1
host.name=CENTOS170
listeners=PLAINTEXT://CENTOS170:9092
advertised.listeners=PLAINTEXT://CENTOS170:9092
log.dirs=/data/kafka-logs
num.partitions=4
zookeeper.connect=CENTOS170:2181,CENTOS132:2181,CENTOS133:2181
其他配置暂时采取默认
10.10.16.132机器:
broker.id=2
host.name=CENTOS132
listeners=PLAINTEXT://CENTOS132:9092
advertised.listeners=PLAINTEXT://CENTOS132:9092
log.dirs=/data/kafka-logs
num.partitions=4
zookeeper.connect=CENTOS170:2181,CENTOS132:2181,CENTOS133:2181
其他配置暂时采取默认
10.10.16.132机器:
broker.id=2
host.name=CENTOS132
listeners=PLAINTEXT://CENTOS132:9092
advertised.listeners=PLAINTEXT://CENTOS132:9092
log.dirs=/data/kafka-logs
num.partitions=4
zookeeper.connect=CENTOS170:2181,CENTOS132:2181,CENTOS133:2181
其他配置暂时采取默认
10.10.16.133机器:
broker.id=3
host.name=CENTOS133
listeners=PLAINTEXT://CENTOS133:9092
advertised.listeners=PLAINTEXT://CENTOS133:9092
log.dirs=/data/kafka-logs
num.partitions=4
zookeeper.connect=CENTOS170:2181,CENTOS132:2181,CENTOS133:2181
其他配置暂时采取默认
3、在每台服务器分别启动kafka服务:
./kafka-server-start.sh /appcom/kafka_2.10-0.10.0.0/config/server.properties & (以这种方式启动kafka应用后,kafka总会莫名其妙的退出。后来改为这种命令启动:
./kafka-server-start.sh -daemon /appcom/kafka_2.10-0.10.0.0/config/server.properties 解决了问题)
4、任意一台机器上面,测试: 在kafka中创建名为“cmy_nbd_topic1”的topic,该topic切分为4份,每一份备份数为3
./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 4 --topic cmy_nbd_topic1
5、列出所有topic :
./kafka-topics.sh --list --zookeeper CENTOS170:2181,CENTOS132:2181,CENTOS133:2181
更多推荐
所有评论(0)