链接:https://pan.baidu.com/s/1fgHJ8Rwbg0MngwV-qDNJlw
提取码:8888
[root@localhost local]# pwd /usr/local [root@localhost local]# tar xvf jdk-8u301-linux-x64.tar.gz mv jdk8u jdk
[root@localhost local]# cat /etc/profile export JAVA_HOME=/usr/local/jdk export JRE_HOME=/usr/local/jdk/jre export CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
source /etc/profile
chown -R 10143:10143 jdk
[root@localhost local]# java -version java version "1.8.0_301" Java(TM) SE Runtime Environment (build 1.8.0_301-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.301-b09, mixed mode)
https://www.apache.org/dyn/closer.lua/zookeeper/zookeeper-3.5.9/apache-zookeeper-3.5.9-bin.tar.gz
链接:https://pan.baidu.com/s/1UvekZXJmFfyMBH87O5MCjw 提取码:8888
echo 1 > /opt/zookeeper/data/myid echo 2 > /opt/zookeeper/data/myid echo 3 > /opt/zookeeper/data/myid
[root@localhost zookeeper]# cat /opt/zookeeper/conf/zoo.cfg #配置文件相同 tickTime=2000 initLimit=10 syncLimit=5 dataDir=/opt/zookeeper/data clientPort=2181 maxClientCnxns=128 autopurge.snapRetainCount=3 autopurge.purgeInterval=1 server.1=192.168.80.133:2888:3888 server.2=192.168.80.134:2888:3888 server.3=192.168.80.135:2888:3888
[root@localhost bin]# ./zkServer.sh start ZooKeeper JMX enabled by default Using config: /opt/zookeeper/bin/../conf/zoo.cfg Starting zookeeper ... STARTED [root@localhost bin]# ./zkServer.sh status ZooKeeper JMX enabled by default Using config: /opt/zookeeper/bin/../conf/zoo.cfg Client port found: 2181. Client address: localhost. Client SSL: false. Mode: leader
[root@localhost bin]# ./zkServer.sh start ZooKeeper JMX enabled by default Using config: /opt/zookeeper/bin/../conf/zoo.cfg Starting zookeeper ... STARTED [root@localhost bin]# ./zkServer.sh status ZooKeeper JMX enabled by default Using config: /opt/zookeeper/bin/../conf/zoo.cfg Client port found: 2181. Client address: localhost. Client SSL: false. Mode: follower
http://kafka.apache.org/downloads.html
https://www.apache.org/dyn/closer.cgi?path=/kafka/3.1.0/kafka_2.12-3.1.0.tgz
链接:https://pan.baidu.com/s/1qAcnZA6dNN9xAzwSR8y7Vw 提取码:8888
[root@localhost config]# cat server.properties broker.id=1 listeners=PLAINTEXT://192.168.80.133:9092 num.network.threads=3 num.io.threads=8 socket.send.buffer.bytes=102400 socket.receive.buffer.bytes=102400 socket.request.max.bytes=104857600 log.dirs=/data/kafka-logs num.partitions=1 num.recovery.threads.per.data.dir=1 offsets.topic.replication.factor=1 transaction.state.log.replication.factor=1 transaction.state.log.min.isr=1 log.retention.hours=168 log.segment.bytes=1073741824 log.retention.check.interval.ms=300000 zookeeper.connect=192.168.80.133:2181,192.168.80.134:2181,192.168.80.135:2181 zookeeper.connection.timeout.ms=6000 group.initial.rebalance.delay.ms=0
[root@localhost bin]# ./kafka-server-start.sh -daemon /opt/kafka/config/server.properties
[root@localhost config]# ps -ef|grep kafka [root@localhost config]# ss -tnl LISTEN 0 50 [::ffff:192.168.80.133]:9092 [::]:* LISTEN 0 50 [::]:2181 [::]:*
chmod 777 /etc/rc.d/rc.local vi /etc/rc.d/rc.local /opt/zookeeper/bin/zkServer.sh start
[root@localhost system]# cat /usr/lib/systemd/system/kafka.service [Unit] Description=Apache Kafka server (broker) After=network.target zookeeper.service [Service] Type=simple Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/jdk/bin" User=root Group=root ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties ExecStop=/opt/kafka/bin/kafka-server-stop.sh Restart=on-failure
[root@localhost ~]# systemctl enable kafka Created symlink from /etc/systemd/system/multi-user.target.wants/kafka.service to /usr/lib/systemd/system/kafka.service.
[root@localhost ~]# ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 50 [::ffff:192.168.80.133]:9092 [::]:* LISTEN 0 50 [::]:2181 [::]:* LISTEN 0 50 [::ffff:192.168.80.133]:3888 [::]:*