統一日誌ELK部署配置(2)——kafka

前提:
你服務器上已經安裝並配置了java運行環境;java

1、zookeeper安裝
一、從zookeeper官網:http://zookeeper.apache.org/ 下載;我這裏下載的是zookeeper-3.4.9.tar.gz;
二、解壓到你安裝目錄:tar-zxvf zookeeper-3.4.9.tar.gzapache

2、zookeeper配置
一、修改zoo.cfg(直接複製zoo_sample.cfg);
二、修改配置參數(集羣模式):
tickTime=2000
dataDir=/mnt/zookeeper-3.4.9/data/
clientPort=2181
initLimit=5
syncLimit=2
server.1=broker1:2888:3888
server.2=broker2:2888:3888
server.3=broker3:2888:3888服務器

三、修改zkEnv.sh,指定配置文件(這裏爲conf/zoo.cfg)
四、啓動:
    bin/zkServer.sh start  啓動成功

3、kafka安裝
一、從官網下載你須要的kafka:http://kafka.apache.org/downloads
二、接下到你安裝目錄:tar -zxvf kafka_2.11-1.1.0.tgz
4、kafka配置:
broker.id=1
delete.topic.enable=truesocket

############################# Socket Server Settings #############################
listeners=PLAINTEXT://kafka1_ip:9092
#advertised.listeners=PLAINTEXT://your.host.name:9092
port=9092
host.name=kafka1_ipide

num.network.threads=4fetch

#= The number of threads doing disk I/O
num.io.threads=8this

#= The send buffer (SO_SNDBUF) used by the socket server
socket.send.buffer.bytes=102400.net

#= The receive buffer (SO_RCVBUF) used by the socket server
socket.receive.buffer.bytes=102400code

#= The maximum size of a request that the socket server will accept (protection against OOM)
socket.request.max.bytes=104857600server

############################# Log Basics #############################
#= A comma seperated list of directories under which to store log files
log.dirs=/mnt/kafka_2.12-0.10.2.1/kafka-logs

num.partitions=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 Flush Policy #############################

#= The number of messages to accept before forcing a flush of data to disk
log.flush.interval.messages=1000

#= The maximum amount of time a message can sit in a log before we force a flush
log.flush.interval.ms=1000

############################# Log Retention Policy #############################

#= The minimum age of a log file to be eligible for deletion due to age
log.retention.hours=24

#= The maximum size of a log segment file. When this size is reached a new log segment will be created.
log.segment.bytes=1073741824

#= The interval at which log segments are checked to see if they can be deleted according
#= to the retention policies
log.retention.check.interval.ms=300000

############################# Zookeeper #############################
zookeeper.connect=zk_ip1:2181,zk_ip2:2181,zk_ip3:2181

#= Timeout in ms for connecting to zookeeper
zookeeper.connection.timeout.ms=6000

max.message.bytes=52428700
replica.fetch.max.bytes=52428700

5、啓動kafka:bin/kafka-server-start.sh config/server.properties &

相關文章
相關標籤/搜索