#cd training
# tar -zxvf kafka_2.9.2-0.8.1.1.tgz
# rm -rf kafka_2.9.2-0.8.1.1.tgz
# mv kafka_2.9.2-0.8.1.1/ kafka
#cd kafka
# mkdir -p logs/broker1
# mkdir -p logs/broker2
cd logs/broker1
#pwd
/root/training/kafka/logs/broker1
#cd ../../config
# vi server.properties
log.dirs=/root/training/kafka/logs/broker1
zookeeper.connect=192.168.56.11:2181,192.168.56.12:2181,192.168.56.13:2181
# cp server.properties server1.properties
#vi server1.properties
broker.id=1
port=9093
#cd ..
#jps
# bin/kafka-server-start.sh config/server.properties &
# bin/kafka-server-start.sh config/server2.properties &
# vi config/server1.properties
log.dirs=/root/training/kafka/logs/broker2
# bin/kafka-server-start.sh config/server2.properties &
#jps
17413 Jps
17240 Kafka
17374 Kafka
# bin/kafka-topics.sh --create --zookeeper 192.168.56.11:2181 --replication-factor 1 --partitions 3 --topic mydemo2
# cd training/kafka_2.9.2-0.8.1/
# ls bin/
# bin/kafka-console-producer.sh --broker-list 192.168.56.102:9092 --topic mydemo2
# bin/kafka-console-consumer.sh --zookeeper 192.168.56.11:2181 --topic mydemo2
网友评论