前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >kafka集群部署

kafka集群部署

原创
作者头像
陈不成i
修改2021-07-06 11:04:06
4440
修改2021-07-06 11:04:06
举报
文章被收录于专栏:ops技术分享

一.环境准备

当前环境:centos7.3三台 软件版本:kafka_2.12 部署目录:/usr/local/kafka 启动端口:9092 配置文件:/usr/local/kafka/config/server.properties

yum依赖(3台同时操作) yum install java-1.8.0-openjdk

需要部署zookeeper集群

二.安装

1.下载kafka包(3台节点都执行) wget http://mirror.bit.edu.cn/apache/kafka/0.10.2.1/kafka_2.12-0.10.2.1.tgz

2.解压并移动,然后创建日志目录(3台节点都执行) tar zxvf kafka_2.12-0.10.2.1.tgz mv kafka_2.12-0.10.2.1 /usr/local/kafka mkdir /var/log/kafka

3.修改配置文件(3台同时操作,需要更改的地方不一样) vim /usr/local/kafka/config/server.properties

代码语言:javascript
复制
#此为第一台,第二台为2 第三台为3
broker.id=1
# Switch to enable topic deletion or not, default value is false
delete.topic.enable=true
#本机开启端口和监听端口
advertised.host.name=192.168.1.189
# The number of threads handling network requests
num.network.threads=3
# The number of threads doing disk I/O
num.io.threads=8
# The send buffer (SO_SNDBUF) used by the socket server
socket.send.buffer.bytes=102400
# The receive buffer (SO_RCVBUF) used by the socket server
socket.receive.buffer.bytes=102400
# The maximum size of a request that the socket server will accept (protection against OOM)
socket.request.max.bytes=104857600
#日志目录
log.dirs=/var/log/kafka
#开启10个分区
num.partitions=10
#kafka保存消息的副本数
default.replication.factor=3
# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
# This value is recommended to be increased for installations with data dirs located in RAID array.
num.recovery.threads.per.data.dir=1
#持久化时间
log.retention.hours=48
# The maximum size of a log segment file. When this size is reached a new log segment will be created.
log.segment.bytes=1073741824
# to the retention policies
log.retention.check.interval.ms=300000
#连接zookeeper地址端口
zookeeper.connect=192.168.1.189:2181,192.168.1.190:2181,192.168.1.191:2181
# Timeout in ms for connecting to zookeeper
zookeeper.connection.timeout.ms=6000

三.使用验证

启动(3台都需要启动) /usr/local/kafka/bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties

检查 netstat -unltp | grep 9092

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一.环境准备
  • 二.安装
  • 三.使用验证
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档