节点名 | ip地址 | OS版本 | 部署服务 | broker信息 |
---|---|---|---|---|
kafka01 | 192.168.96.10 | CentOS Linux release 7.9.2009 (Core) | jdk、zookeeper、kafka | broker : 0 |
kafka02 | 192.168.96.11 | CentOS Linux release 7.9.2009 (Core) | jdk、zookeeper、kafka | broker : 1 |
kafka03 | 192.168.96.12 | CentOS Linux release 7.9.2009 (Core) | jdk、zookeeper、kafka | broker : 2 |
cd /opt/software/
tar -zxvf jdk-8u321-linux-x64.tar.gz
mv jdk1.8.0_321 /usr/local/jdk1.8.0
vi /etc/profile
# 在文件尾部追加以下内容
export JAVA_HOME=/usr/local/jdk1.8.0
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
source /etc/profile
java -version
继续按照以上方法部署另外2台服务器
cd /opt/software/
wget https://dlcdn.apache.org/zookeeper/zookeeper-3.7.0/apache-zookeeper-3.7.0-bin.tar.gz --no-check-certificate
tar -zxvf apache-zookeeper-3.7.0-bin.tar.gz
mv apache-zookeeper-3.7.0-bin /usr/local/zookeeper-3.7.0
mkdir /usr/local/zookeeper-3.7.0/data
echo 1 > /usr/local/zookeeper-3.7.0/data/myid
cp /usr/local/zookeeper-3.7.0/conf/zoo_sample.cfg /usr/local/zookeeper-3.7.0/conf/zoo.cfg
vi /usr/local/zookeeper-3.7.0/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/usr/local/zookeeper-3.7.0/data
clientPort=2181
server.1=192.168.96.10:2888:3888
server.2=192.168.96.11:2888:3888
server.3=192.168.96.12:2888:3888
scp -r /usr/local/zookeeper-3.7.0 [email protected]:/usr/local/
scp -r /usr/local/zookeeper-3.7.0 [email protected]:/usr/local/
echo 2 > /usr/local/zookeeper-3.7.0/data/myid
echo 3 > /usr/local/zookeeper-3.7.0/data/myid
/usr/local/zookeeper-3.7.0/bin/zkServer.sh start
jps -m
cd /opt/software/
wget https://dlcdn.apache.org/kafka/3.1.0/kafka_2.13-3.1.0.tgz
tar -zxvf kafka_2.13-3.1.0.tgz --no-check-certificate
mv kafka_2.13-3.1.0 /usr/local/kafka-2.13
vi /usr/local/kafka-2.13/config/server.properties
broker.id=0
listeners=PLAINTEXT://192.168.96.10:9092
log.dirs=/tmp/kafka-logs
zookeeper.connect=192.168.96.10:2181,192.168.96.11:2181,192.168.96.12:2181
scp -r /usr/local/kafka-2.13 [email protected]:/usr/local/
scp -r /usr/local/kafka-2.13 [email protected]:/usr/local/
broker.id=1
listeners=PLAINTEXT://192.168.96.11:9092
broker.id=2
listeners=PLAINTEXT://192.168.96.12:9092
cd /usr/local/kafka-2.13 && bin/kafka-server-start.sh config/server.properties &
bin/kafka-topics.sh --create --topic quickstart-events --bootstrap-server 192.168.96.10:9092
bin/kafka-topics.sh --describe --topic quickstart-events --bootstrap-server 192.168.96.10:9092
bin/kafka-console-producer.sh --topic quickstart-events --bootstrap-server 192.168.96.10:9092
bin/kafka-console-consumer.sh --topic quickstart-events --from-beginning --bootstrap-server 192.168.96.10:9092