Kafka集群搭建

本文详细介绍了Kafka参数配置说明、搭建步骤、Zookeeper集群搭建方法及注意事项,包括配置文件解读、权限问题限制等核心内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、kafka参数配置说明

    broker.id=0  每一个broker在集群中的唯一标识,要求为正数。当该服务IP地址发生变化时,broker.id没有发生变化,不会影响consumers的消费情况。

    log.dirs=/disk/kafka        kafka数据的存放地址,多个地址有逗号隔开。

    port=9092                       服务端口号

    message.max.bytes         消息的最大字节数

    num.network.threads=2  处理客户端请求的线程数

    num.io.threads=8            操作磁盘的线程数

    socket.send.buffer.bytes=1048576         socket的发送缓冲区

    socket.receive.buffer.bytes=1048576     socket的接受缓冲区

    socket.request.max.bytes=104857600    请求的最大数值,防止OOM,会被指定Topic的时候覆盖

    num.partitions=2                                     每个Topic的分区数

    log.segment.bytes=536870912               topic的分区是以segment存储的,控制每个segment的大小

    log.retention.hours=168                       

    log.segment.bytes=536870912

    log.retention.check.interval.ms=60000

    log.cleaner.enable=false

    zookeeper.connect=lwj-s0:2181,lwj-s1:2181,lwj-s2:2181

    zookeeper.connection.timeout.ms=1000000

二、搭建

    三台物理机器

    lwj-s0

    lwj-s1

    lwj-s2

    远程解压后每个机子都如上配置,就ok了。

    至此安装完毕。

三、zookeeper集群搭建  

    lwj-s0

    lwj-s1

    lwj-s2

    1、配置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=/disk/disk0/data/zookeeper/data

    dataLogDir=/disk/disk0/data/zookeeper/logs

    # the port at which the clients will connect

    clientPort=2181

    server.1=lwj-s02888:3888

    server.2=lwj-s1:2888:3888

    server.3=lwj-s2:2888:3888

    2、注意dataDir 下的文件的配置 

        myid          里面存储的一定要和server.1的1保持一致。

        version-2  

        zookeeper_server.pid

        至此zookeeper搭建完毕。

四、zookeeper单击搭建

    1、配置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=/disk/disk0/data/zookeeper/data

    dataLogDir=/disk/disk0/data/zookeeper/logs

    # the port at which the clients will connect

    clientPort=2181

    2、dataDir 下的文件的配置 

        version-2  

        zookeeper_server.pid

五、注意文件的权限问题限制

    如果你是x用户,那么一定要修改路径的权限为x,否则访问不到,会报错。

转载于:https://my.oschina.net/momisabuilder/blog/534303

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值