Featured image of post kafka离线部署

kafka离线部署

 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
# root user command
$ mv jdk-8u311-linux-x64.tar.gz /usr/
$ cd /usr
$ tar xvf jdk-8u311-linux-x64.tar.gz
$ ln -s jdk1.8.0_311 jdk
$ touch /etc/profile.d/jdk.sh
$ cat >>/etc/profile.d/jdk.sh <<-EOF
export JAVA_HOME=/usr/jdk
export PATH=\$JAVA_HOME/bin:\$PATH
export CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar
EOF

$ tar xvf kafka_2.11-2.2.0.tgz
$ mkdir -p /opt/kafka
$ mv kafka_2.11-2.2.0 /opt/kafka
$ mkdir /opt/kafka/kafka_2.11-2.2.0/zookeeper
$ cd /opt/kafka/kafka_2.11-2.2.0/config
$ sed -i 's/dataDir=\/tmp\/zookeeper/dataDir=\/opt\/kafka\/kafka_2.11-2.2.0\/zookeeper/' zookeeper.properties
$ mkdir /opt/kafka/kafka_2.11-2.2.0/kafka-logs
$ sed -i 's/log.dirs=\/tmp\/kafka-logs/log.dirs=\/opt\/kafka\/kafka_2.11-2.2.0\/kafka-logs/' server.properties
$ echo "listeners=PLAINTEXT://172.15.110.107:9092" >> server.properties
$ sed -i 's/bootstrap.servers=localhost:9092/bootstrap.servers=172.15.110.107:9092/' producer.properties
$ sed -i 's/bootstrap.servers=localhost:9092/bootstrap.servers=172.15.110.107:9092/' consumer.properties
$ ./zookeeper-server-start.sh -daemon ../config/zookeeper.properties
# 判断下zk启动否
$ ./kafka-server-start.sh -daemon ../config/server.properties
# 判断下kafka启动否

有空再补充集群部署