CentOS6部署安装kafka和zookeeper集群

CentOS6部署安装kafka和zookeeper集群

CentOS6部署安装kafka和zookeeper集群

CentOS6部署安装kafka和zookeeper集群

安装之前准备工作

    1.修改hostname,修改hosts文件  
    2.ssh三台机器之前打通,我这边使用的key方式登陆

zookeeper安装方法

e>

kafka安装部署方法

		1.下载
		wget http://apache.fayea.com/kafka/0.8.2.1/kafka_2.9.1-0.8.2.1.tgz
		
		2.配置, 需要注意三个点 
		1.hostname要修改
		2.broker.ids三个ID要保持不一样
		3.zk的地址需要修改 就是我们zk集群的地址
	PS:三台配置都一样除过三个需要修改的点
	[root@zm-pro-kafka-01 local]# cat /usr/local/kafka_2.9.1-0.8.2.1/config/server.properties  |grep -v '^#' | grep -v '^$'
	broker.id=0
	port=9092
	host.name=10.47.105.229
	num.network.threads=3
	num.io.threads=8
	socket.send.buffer.bytes=102400
	socket.receive.buffer.bytes=102400
	socket.request.max.bytes=104857600
	log.dirs=/tmp/kafka-logs
	num.partitions=1
	num.recovery.threads.per.data.dir=1
	log.retention.hours=168
	log.segment.bytes=1073741824
	log.retention.check.interval.ms=300000
	log.cleaner.enable=false
	zookeeper.connect=10.47.105.229:2181,10.47.106.147:2181,10.47.106.7:2181/kafka
	zookeeper.connection.timeout.ms=6000
	[root@zm-pro-kafka-01 local]#
	
	3.启动
		nohup ./bin/kafka-server-start.sh config/server.properties &
	
	4.测试
		#创建
		./bin/kafka-topics.sh --create --zookeeper 10.47.105.229:2181,10.47.106.147:2181,10.47.106.7:2181/kafka  --replication-factor 3 --partitions 5 --topic mytest
		#查看创建的详细信息
		./bin/kafka-topics.sh --describe  --zookeeper 10.47.105.229:2181,10.47.106.147:2181,10.47.106.7:2181/kafka --topic mytest
		#查看列表
	./bin/kafka-topics.sh --list  --zookeeper 10.47.105.229:2181,10.47.106.147:2181,10.47.106.7:2181/kafka