伍佰目录 短网址
  当前位置:海洋目录网 » 站长资讯 » 站长资讯 » 文章详细 订阅RssFeed

Kafka 集群部署

来源:本站原创 浏览:103次 时间:2022-07-28

ip地址                主机名               安装软件

192.168.20.40   k8s-master       zookeeper、kafka

192.168.20.43   k8s-node2        zookeeper、kafka

192.168.20.39   k8s-node3        zookeeper、kafka

三个节点安装zookeeper

[root@k8s-master data]# tar -zxvf zookeeper-3.4.10.tar.gz 

[root@k8s-master data]# mv zookeeper-3.4.10 /data/zookeeper

[root@k8s-master data]# scp -r zookeeper root@192.168.20.43:/data/

[root@k8s-master data]# scp -r zookeeper root@192.168.20.39:/data/

修改三个节点的zookeeper的配置文件

[root@k8s-master ~]# mkdir /data/zookeeper/data

[root@k8s-master ~]# cp /data/zookeeper/conf/zoo_sample.cfg /data/zookeeper/conf/zoo_sample.cfg.back

[root@k8s-master ~]# cp /data/zookeeper/conf/zoo_sample.cfg /data/zookeeper/conf/zoo.cfg

[root@k8s-master ~]# vim /data/zookeeper/conf/zoo.cfg 

[root@k8s-master ~]# more /data/zookeeper/conf/zoo.cfg 

# The number of milliseconds of each tick

tickTime=2000

# The number of ticks that the initial 

# synchronization phase can take

initLimit=10

# The number of ticks that can pass between 

# sending a request and getting an acknowledgement

syncLimit=5

# the directory where the snapshot is stored.

# do not use /tmp for storage, /tmp here is just 

# example sakes.

dataDir=/data/zookeeper/data/zookeeper

dataLog=/data/zookeeper/data/logs

# the port at which the clients will connect

clientPort=2181

# the maximum number of client connections.

# increase this if you need to handle more clients

maxClientCnxns=60

autopurge.snapRetainCount=3

autopurge.purgeInterval=1

server.1=192.168.20.40:2888:3888

server.2=192.168.20.43:2888:3888

server.3=192.168.20.39:2888:3888

启动zookeeper服务前,分别在三个zookeeper节点上创建myid

[root@k8s-master ~]# mkdir /data/zookeeper/data/zookeeper

[root@k8s-master ~]# echo 1 > /data/zookeeper/data/zookeeper/myid

[root@k8s-node2 ~]# mkdir /data/zookeeper/data/zookeeper

[root@k8s-node2 ~]# echo 2 > /data/zookeeper/data/zookeeper/myid

[root@k8s-node3 ~]#  mkdir /data/zookeeper/data/zookeeper

[root@k8s-node3 ~]# echo 3 > /data/zookeeper/data/zookeeper/myid


[root@k8s-master ~]# /data/zookeeper/bin/zkServer.sh start

ZooKeeper JMX enabled by default

Using config: /data/zookeeper/bin/../conf/zoo.cfg

Starting zookeeper ... STARTED

[root@k8s-master ~]# ps -ef |grep zookeeper

k8s-node2

k8s-node3

[root@k8s-master ~]# netstat -nltp|grep :2181

tcp6       0      0 :::2181                 :::*                    LISTEN      8962/java 

查看zookeeper节点的状态

[root@k8s-node3 ~]# /data/zookeeper/bin/zkServer.sh status

ZooKeeper JMX enabled by default

Using config: /data/zookeeper/bin/../conf/zoo.cfg

Mode: follower


[root@k8s-master ~]# /data/zookeeper/bin/zkServer.sh status

ZooKeeper JMX enabled by default

Using config: /data/zookeeper/bin/../conf/zoo.cfg

Mode: follower

[root@k8s-node2 ~]# /data/zookeeper/bin/zkServer.sh status

ZooKeeper JMX enabled by default

Using config: /data/zookeeper/bin/../conf/zoo.cfg

Mode: leader

安装Kafka

[root@k8s-master ~]# tar -zvxf kafka_2.11-1.1.0.tgz

[root@k8s-master ~]# mv kafka_2.11-1.1.0 /data/kafka

[root@k8s-master ~ src]# cp /data/kafka/config/server.properties /data/kafka/config/server.properties.bak

[root@k8s-master ~]# vim /data/kafka/config/server.properties

broker.id=0

delete.topic.enable=true

listeners=PLAINTEXT://192.168.20.40:9092

num.network.threads=3

num.io.threads=8

socket.send.buffer.bytes=102400

socket.receive.buffer.bytes=102400

socket.request.max.bytes=104857600

log.dirs=/data/kafka/data

num.partitions=1

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

offsets.topic.replication.factor=1

transaction.state.log.replication.factor=1

transaction.state.log.min.isr=1

log.flush.interval.messages=10000

log.flush.interval.ms=1000

log.retention.hours=168

log.retention.bytes=1073741824

log.segment.bytes=1073741824

log.retention.check.interval.ms=300000

zookeeper.connect=192.168.20.40:2181,192.168.20.43:2181,192.168.20.39:2181

zookeeper.connection.timeout.ms=6000

group.initial.rebalance.delay.ms=0

其它两个节点只需要修改:broker.id=*和listeners=PLAINTEXT://IP

启动Kafka

[root@k8s-master ~]# nohup /data/kafka/bin/kafka-server-start.sh /data/kafka/config/server.properties >/dev/null 2>&1 &


推荐阅读

Nginx访问控制

Centos安装MongoDB数据库

Mysql8.0 主从GTID复制

Mysqlbinlog日志的清理与切换

mysqldump+binlog恢复被删除的数据

Mysql8.0 主从复制

完整的二进制安装Kubernetes高可用集群



  推荐站点

  • At-lib分类目录At-lib分类目录

    At-lib网站分类目录汇集全国所有高质量网站,是中国权威的中文网站分类目录,给站长提供免费网址目录提交收录和推荐最新最全的优秀网站大全是名站导航之家

    www.at-lib.cn
  • 中国链接目录中国链接目录

    中国链接目录简称链接目录,是收录优秀网站和淘宝网店的网站分类目录,为您提供优质的网址导航服务,也是网店进行收录推广,站长免费推广网站、加快百度收录、增加友情链接和网站外链的平台。

    www.cnlink.org
  • 35目录网35目录网

    35目录免费收录各类优秀网站,全力打造互动式网站目录,提供网站分类目录检索,关键字搜索功能。欢迎您向35目录推荐、提交优秀网站。

    www.35mulu.com
  • 就要爱网站目录就要爱网站目录

    就要爱网站目录,按主题和类别列出网站。所有提交的网站都经过人工审查,确保质量和无垃圾邮件的结果。

    www.912219.com
  • 伍佰目录伍佰目录

    伍佰网站目录免费收录各类优秀网站,全力打造互动式网站目录,提供网站分类目录检索,关键字搜索功能。欢迎您向伍佰目录推荐、提交优秀网站。

    www.wbwb.net