Kafka0.8

启动zookeeper

 bin/zookeeper-server-start.sh config/zookeeper.properties

启动kafka server

bin/kafka-server-start.sh config/server.properties

创建topic

bin/kafka-create-topic.sh --zookeeper localhost:2181 --replica 1 --partition 1 --topic test

list

bin/kafka-list-topic.sh --zookeeper localhost:2181

producer

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

comsumer

bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning

多个brocker 整目录拷贝多份就可以了

cp config/server.properties config/server-1.properties
cp config/server.properties config/server-1.properties

新的配置

config/server-1.properties:
    broker.id=1
    port=9093
    log.dir=/tmp/kafka-logs-1

config/server-2.properties:
    broker.id=2
    port=9094
    log.dir=/tmp/kafka-logs-2

启动

JMX_PORT=9997 bin/kafka-server-start.sh config/server-1.properties &
JMX_PORT=9998 bin/kafka-server-start.sh config/server-2.properties &

创建topic

bin/kafka-create-topic.sh --zookeeper localhost:2181 --replica 3 --partition 1 --topic my-replicated-topic

list

bin/kafka-list-topic.sh --zookeeper localhost:2181

publish

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic my-replicated-topic

comsumer

bin/kafka-console-consumer.sh --zookeeper localhost:2181 --from-beginning --topic my-replicated-topic
 pkill -9 -f server-1.properties
  
  
参考:http://kafka.apache.org/08/quickstart.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值