一、安装JDK环境
二、同步时钟
yum install ntp -y
ntpdate ntp1.aliyun.com
clock -w
三、安装zookeeper
- 解析安装包
- 从样例配置拷贝配置
cp conf/zoo_sample.cfg conf/zoo.cfg
- 修改dataDir数据存放路径(myid文件也存放在改路径下)
- 常见myid文件,在zoo.cfg增加集群几点信息,
server.1=zk01:2888:3888
四、安装kafka
tar -zxf kafka_2.12-3.2.3.tgz
vim config/server.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29############################# Server Basics #############################
# The id of the broker. This must be set to a unique integer for each broker.
0 =
############################# Socket Server Settings #############################
# The address the socket server listens on. If not configured, the host name will be equal to the value of
# java.net.InetAddress.getCanonicalHostName(), with PLAINTEXT listener name, and port 9092.
# FORMAT:
# listeners = listener_name://host_name:port
# EXAMPLE:
# listeners = PLAINTEXT://your.host.name:9092
listeners=PLAINTEXT://kafka01:9092
############################# Log Basics #############################
# A comma separated list of directories under which to store log files
/usr/local/kafka_2.12-3.2.3/kafka-logs =
############################# Zookeeper #############################
# Zookeeper connection string (see zookeeper docs for details).
# This is a comma separated host:port pairs, each corresponding to a zk
# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
# You can also append an optional chroot string to the urls to specify the
# root directory for all kafka znodes.
zk01:2181,zk02:2181,zk03:2181 =远程拷贝kafka安装文件到其他两台主机
scp -r ./kafka_2.12-3.2.3/ root@kafka02:/usr/local/
,修改config/server.properties
文件- broker.id=1
- listeners=PLAINTEXT://kafka02:9092
scp -r ./kafka_2.12-3.2.3/ root@kafka03:/usr/local/
,修改config/server.properties
文件- broker.id=2
- listeners=PLAINTEXT://kafka03:9092
启动:
./kafka-server-start.sh -daemon ../config/server.properties