- 安装jdk1.8
yum -y install java-1.8.0-openjdk-devel.x86_64
- 安装zookeeper
下载二进制包:wget https://dlcdn.apache.org/zookeeper/zookeeper-3.7.1/apache-zookeeper-3.7.1-bin.tar.gz
解压缩: tar –zxvf zookeeper-3.7.1-bin.tar.gz
创建zookeeper目录
mkdir –p /usr/local/zookeeper
创建存储目录
mkdir –p /usr/local/zookeeper/zkdata
mv zookeeper-3.7.1-bin /usr/local/zookeeper
复制配置文件
cp /usr/local/zookeeper/zookeeper-3.7.1-bin/conf/zoo_sample.cfg zoo.cfg
修改配置文件
vim /usr/local/zookeeper/zookeeper-3.7.1-bin/conf/zoo.cfg
修改存储目录:dataDir=/usr/local/zookeeper/zkdata
默认8080端口:admin port admin.serverPort=9000
启动zookper 在bin目录下启动
./zkServer.sh start
查看状态
./zkServer.sh status
- 安装kafka
下载安装包:wget https://archive.apache.org/dist/kafka/3.2.0/kafka_2.12-3.2.0.tgz
解压: tar –zxvf kafka_2.12-3.2.0.tgz
修改配置文件: vim config/server.properties
listeners = PLAINTEXT://52.86.18.69:9092
broker.id=0
log.dirs=/usr/local/data/kafka-logs zookeeper.connect=54.86.18.69:2181
# 启动服务 , 运行的日志打印在 logs 目录里的server.log 里
# 后台启动,不会打印日志到控制台
1:bin/kafka‐server‐start.sh ‐daemon config/server.properties
2:bin/kafka‐server‐start.sh config/server.properties &
# 停止kafka
bin/kafka-server-stop.sh
开启远程连接
vim config/server.properties
# 把下述配置注释
listeners=PLAINTEXT://:127.0.0.1:9092
# 配置下述内容
advertised.listeners=PLAINTEXT://127.0.0.1:9092