Kafka middleware cluster deployment (spring+kafka cluster project integration will also be uploaded)

1. Create three centos 7 virtual machines and configure static IP addresses in vi /etc/sysconfig/network-scripts/ifcfg-ens33    

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO="static"
IPADDR=172.18.160.175/172.18.160.176/172.18.160.177
NETMASK=255.255.255.0
BROADCAST=172.18.160.254
NM_CONTROLLED=no
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=d19423f1-5855-4ce2-9dd7-1bfc75eec8e5
DEVICE=ens33
ONBOOT=yes  

 2. Configure the java1.8 environment (there will be problems when the integration of spring+kafka is lower than jdk1.8), download jdk1.8 and decompress /usr/local/java/jdk1.8.0_171 , use vi /ect/profile to add

export JAVA_HOME=/usr/local/java/jdk1.8.0_171
export CLASSPATH=.:$JAVA_HOME/lib.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

3. Close the firewall systemctl stop firewalld.service respectively (firewall-cmd --permanent --add-port=9092/tcp open the specified port)

4. Download the kafka_2.11-1.1.0.tgz version (remember not to download the -src ending that needs to be compiled), unzip it in the directory /java/kafka/kafka_2.11-1.1.0

5. Modify /java/kafka/kafka_2.11-1.1.0/config/server.properties respectively

broker.id=0/1/2
listeners=PLAINTEXT://172.18.160.175:9092 / 172.18.160.176:9092 / 172.18.160.177:9092
log.dirs=/java/kafka/logs (the logs of the three virtual machines are unified and the same below the directory)
num.partitions=5 (the number of partitions is set to 5)
zookeeper.connect=172.18.160.175:2181,172.18.160.176:2181,172.18.160.175:2181 (currently the zookeeper cluster service directly uses the zookeeper cluster that comes with kafka )

6. Modify the zookeeper storage log /java/kafka/kafka_2.11-1.1.0/config/zookeeper.properties

dataDir=/tmp/zookeeper

7. Start zookeeper on 175/176/177 and go to /java/kafka/kafka_2.11-1.1.0 

bin/zookeeper.service.start.sh config/zookeeper.properties

8. Start kafka on 175/176/177 and go to /java/kafka/kafka_2.11-1.1.0 

bin/kafka.service.start.sh config/server.properties

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325680773&siteId=291194637