#server1
dataDir=/home/pass/zk-cluster/ zookeeper1/data
dataLogDir=/home/pass/zk-cluster/zookeeper1/logs
clientPort=2181
server.1=zk:2188:3188
server.2=zk:2288:3288
server.3=zk:2388:3388
#server2
dataDir=/home/pass/zk-cluster/ zookeeper2/data
dataLogDir=/home/pass/zk-cluster/zookeeper2/logs
clientPort=2281
server.1=zk:2188:3188
server.2=zk:2288:3288
server.3=zk:2388:3388
#server3
dataDir=/home/pass/zk-cluster/ zookeeper3/data
dataLogDir=/home/pass/zk-cluster/zookeeper3/logs
clientPort=2381
server.1=zk:2188:3188
server.2=zk:2288:3288
server.3=zk:2388:3388
#server1
mkdir ./zookeeper1/data ./zookeeper1/logs
#server2
mkdir ./zookeeper2/data ./zookeeper2/logs
#server3
mkdir ./zookeeper3/data ./zookeeper3/logs
#server1
echo "1" > /home/pass/zk-cluster/zookeeper1/data /myid
#server2
echo "2" > /home/pass/zk-cluster/zookeeper2/data /myid
#server3
echo "3" > /home/pass/zk-cluster/zookeeper3/data /myid
./zookeeper1/bin/zkServer.sh start
./zookeeper2/bin/zkServer.sh start
./zookeeper3/bin/zkServer.sh start
./zookeeper1/bin/zkServer.sh status
./zookeeper2/bin/zkServer.sh status
./zookeeper3/bin/zkServer.sh status
port=9092 #根据实际情况而定
host.name=192.168.1.13 #根据实际情况而定
num.network.threads=3 #borker进行网络处理的线程数
num.io.threads= #borker进行I/O处理的线程数
socket.send.buffer.bytes=102400 #发送缓冲区buffer大小,数据不是一下子就发送的,先回存储到缓冲区了到达一定的大小后在发送,能提高性能
socket.receive.buffer.bytes=102400 #kafka接收缓冲区大小,当数据到达一定大小后在序列化到磁盘
socket.request.max.bytes=104857600 #这个参数是向kafka请求消息或者向kafka发送消息的请请求的最大数,这个值不能超过java的堆栈大小
num.partitions=1 #默认的分区数,一个topic默认1个分区数
num.recovery.threads.per.data.dir=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1
log.retention.hours=168 #默认消息的最大持久化时间,168小时,7天
message.max.byte=5242880 #消息保存的最大值5M
replica.fetch.max.bytes=5242880 #取消息的最大直接数
log.segment.bytes=1073741824 #因为kafka的消息是以追加的形式落地到文件,当超过这个值的时候,kafka会新起一个文件
log.retention.check.interval.ms=300000 #每隔300000毫秒去检查上面配置的log失效时间
log.cleaner.enable=false #是否启用log压缩,一般不用启用,启用的话可以提高性能
zookeeper.connect=zk3:2181,zk3:2281,zk3:2381 #根据实际情况而定
group.initial.rebalance.delay.ms=0
./bin/kafka-server-start.sh -daemon /config/server.properties
kafka1/bin/kafka-topics.sh --create --zookeeper 192.168.1.13:2181 --replication-factor 2 --partitions 1 --topickafkatest
./kafka1/bin/kafka-topics.sh --list--zookeeper zk:2181
kafka1/bin/kafka-console-producer.sh--broker-list 192.168.1.13:9092 --topic kafkatest
kafka1/bin/kafka-console-consumer.sh--zookeeper 192.168.1.13:2181 --topic kafkatest --from-beginning