Kafka(8)kafka集群的搭建(三个broker)

第一步:准备三个server.properties文件

调整properties文件里面的额呢绒

  1. server.properties

    broker.id=0
    #当前这个节点对外提供的ip和端口
    listeners=PLAINTEXT://192.168.156.131:9092
    log.dirs=/root/kafka/data/kafka-logs
    
  2. server.properties

    broker.id=1
    listeners=PLAINTEXT://192.168.156.131:9093
    log.dirs=/root/kafka/data/kafka-logs-1
    
  3. server.properties

    broker.id=2
    listeners=PLAINTEXT://192.168.156.131:9094
    log.dirs=/root/kafka/data/kafka-logs-2
    

实际操作过程:

[root@localhost config]# pwd
/root/kafka/kafka_2.11-2.4.1/config
[root@localhost config]# ls
connect-console-sink.properties    connect-mirror-maker.properties  server.properties
connect-console-source.properties  connect-standalone.properties    tools-log4j.properties
connect-distributed.properties     consumer.properties              trogdor.conf
connect-file-sink.properties       log4j.properties                 zookeeper.properties
connect-file-source.properties     nohup.out
connect-log4j.properties           producer.properties
[root@localhost config]# cp server.properties server1.properties 
[root@localhost config]# cp server.properties server2.properties 
# 依次修改配置文件里面的内容
[root@localhost config]# vim server.properties 

第二步:在bin目录下启动服务器

启动zookeeper

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

启动三台服务器

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

./kafka-server-start.sh  -daemon  ../config/server1.properties

./kafka-server-start.sh  -daemon  ../config/server2.properties

实际操作:

[root@localhost config]# pwd
/root/kafka/kafka_2.11-2.4.1/config
[root@localhost config]# cd ../bin/
[root@localhost bin]# ./kafka-server-start.sh  -daemon  ../config/server.properties
[root@localhost bin]# ./kafka-server-start.sh  -daemon  ../config/server1.properties
[root@localhost bin]# ./kafka-server-start.sh  -daemon  ../config/server2.properties
[root@localhost bin]# 

第三步:查看是否启动成功(进入zk查看)

[root@localhost bin]# ./zookeeper-shell.sh localhost:2181
Connecting to localhost:2181
Welcome to ZooKeeper!
JLine support is disabled

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
ls /broker/ids
Node does not exist: /broker/ids
ls /
[admin, brokers, cluster, config, consumers, controller, controller_epoch, isr_change_notification, latest_producer_id_block, log_dir_event_notification, zookeeper]
ls /brokers/ids
[0, 1, 2]

如果有上面的信息证明三个服务器(集群)启动成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

?abc!

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值