1.下载kafka包(时间点:2016-09-06,版本:kafka_2.11-0.10.0.1)
wegt http://mirrors.hust.edu.cn/apache/kafka/0.10.0.1/kafka_2.11-0.10.0.1.tgz
2.解压
tar -zxvf kafka_2.11-0.10.0.1.tgz
3.修改bin/kafka-server-start.sh
将对堆内存修改为:-Xmx6G -Xms6G(官方推荐配置)
export JMX_PORT="19092"(jconsole或者jvisualvm能够远程连接查看内存等)
4.修改日志配置
把每项的DatePattern修改为'.'yyyy-MM-dd(只需每天rolling就可以了)
5.修改config/server.properties配置
broker.id=0(每个节点不能一样)
# listeners = security_protocol://host_name:port
listeners=PLAINTEXT://xxx:9092
# advertised.listeners=PLAINTEXT://arreat00:9092
# Replication configurations
num.replica.fetchers=2
default.replication.factor=3
controller.socket.timeout.ms=30000
# Log configuration
num.partitions=3
message.max.bytes=1000000
auto.create.topics.enable=true
log.flush.interval.ms=10000
log.flush.interval.messages=20000
log.flush.scheduler.interval.ms=2000
log.dirs=/home/xxx/xxx/kafka/log
# ZK configuration
zookeeper.connect=ip:port,ip:port,ip:port/xx/xxx
zookeeper.connection.timeout.ms=6000
zookeeper.sync.time.ms=2000
# Socket server configuration
num.io.threads=8
num.network.threads=3
socket.request.max.bytes=104857600
socket.receive.buffer.bytes=1048576
socket.send.buffer.bytes=1048576
queued.max.requests=16
每项的具体解释可见:http://blog.csdn.net/louisliaoxh/article/details/51516084
该配置修改的是官方推荐的生产环境的配置:http://kafka.apache.org/documentation.html#config
6.启动:bin/kafka-server-start.sh -daemon config/server.propertie
参考博客:https://blog.csdn.net/JThink_/article/details/52708853