一、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,否则访问不到,会报错。