赞
踩
此文基于debian12,centos也适用 因为zookeeper依赖jdk环境 预先安装好jdk
Apache ZooKeeperhttps://zookeeper.apache.org/releases.html
选择最新3.9.1下载 可以自行选择
tar -zxf apache-zookeeper-3.9.1-bin.tar.gz -C /usr/local/
cd /usr/local/
重命名 mv apache-zookeeper-3.9.1-bin ./zookeeper
cd zookeeper
mkdir data
mkdir logs
cd conf
vi zoo_sample.cfg
指定刚刚自定义的两个文件夹路径
改名
mv zoo_sample.cfg zoo.cfg
查看本机jdk位置
echo $JAVA_HOME
cd ../bin
vi zkServer.sh
添加上面的jdk路径
export JAVA_HOME=/usr/local/jdk8
进入bin目录,启动、停止、重启分和查看当前节点状态(包括集群中是何角色)别执行:
./zkServer.sh start
./zkServer.sh stop
./zkServer.sh restart
./zkServer.sh status
vi /etc/systemd/system/zookeeper.service
复制粘贴以下
[Unit]
Description=zookeeper
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/zookeeper/bin/zkServer.sh start
ExecReload=/usr/local/zookeeper/bin/zkServer.sh restart
ExecStop=/usr/local/zookeeper/bin/zkServer.sh stop
[Install]
WantedBy=multi-user.target
:wq保存后执行
systemctl daemon-reload
systemctl enable zookeeper
Apache KafkaApache Kafka: A Distributed Streaming Platform.https://kafka.apache.org/downloads
tar -zxf kafka_2.13-3.6.1.tgz -C /usr/local/
cd /usr/local/
重命名 mv kafka_2.13-3.6.1 ./kafka
cd kafka
mkdir logs
cd config
vi server.properties
指定刚刚自定义的文件夹路径
需要修改的:
log.dirs=/usr/local/kafka/logs
最后添加一行 用于配置自动注册Topics
auto.create.topics.enable=true
cd ../bin
./kafka-server-start.sh -daemon ../config/server.properties #启动kafka
./kafka-server-stop.sh -daemon ../config/server.properties #停止kafka
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。