kafka搭建

匿名 (未验证) 提交于 2019-12-03 00:15:02

zookeeper,zookeeper

集群部署

1)

tar -zxvf kafka_2.11-0.11.0.0.tgz

2)文件

3)在/usr/local/kafka目录下logs

4)

cd config/

vi server.properties

#broker的

broker.id=1

#删除topic

delete.topic.enable=true

#的

num.network.threads=3

#用来IO

num.io.threads=8

#

socket.send.buffer.bytes=102400

#

socket.receive.buffer.bytes=102400

#

socket.request.max.bytes=104857600

#kafka

log.dirs=/usr/local/kafka/logs

#topicbroker

num.partitions=1

#data

num.recovery.threads.per.data.dir=1

#segment

log.retention.hours=168

#Zookeeper集群

zookeeper.connect=zk1:2181,zk2:2181,zk3:2181

5)配置环境

#KAFKA_HOME

export KAFKA_HOME=/opt/module/kafka

export PATH=$PATH:$KAFKA_HOME/bin

source /etc/profile

6)其他节点部署

scp /etc/profile zk2:/etc/

其他节点的server.properties中broker.id=2、broker.id=3

עbroker.id

7)

依次在zk1,zk2,zk3kafka

8)关闭

Kafka

1topic

2topic

--create --replication-factor 3 --partitions 1 --topic first

选项

--topic 定义topic名

3topic

--delete --topic first

server.propertiesdelete.topic.enable=true

4

bin/kafka-console-producer.sh \

--broker-list zk1:9092 --topic first

>hello world

5)消费消息

--from-beginning:以往

6Topic

bin/kafka-topics.sh --zookeeper zk3:2181 \

--describe --topic first

7

bin/kafka-topics.sh --zookeeper zk3:2181 --alter --topic first --partitions 6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!