yum install -y unzip zip
配置host
vi /etc/host
172.19.68.10 zk1
1. zookeeper
zookeeper下载地址
http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
tar -zxvf apache-zookeeper-3.4.14.tar.gz
mv apache-zookeeper-3.4.14 zookeeper
cd /opt/zookeeper
拷贝zoo_sample.cfg文件重命名为zoo.cfg,然后修改dataDir属性
# 数据的存放目录 dataDir=/opt/zkdata # 端口,默认就是2181 clientPort=2181
server.1=zk1:2888:3888
配置环境变量
# Zookeeper Environment Variable export ZOOKEEPER_HOME=/opt/zookeeper export PATH=$PATH:$ZOOKEEPER_HOME/bin
在/opt/zookeeper/data文件下创建myid
vi myid
1
Zookeeper 启动停止命令
zkServer.sh start
zkServer.sh stop
2. kafka
kafka下载地址
http://kafka.apache.org/quickstart
http://mirror.bit.edu.cn/apache/kafka/2.2.0/kafka_2.12-2.2.0.tgz
tar -zxvf kafka_2.12-2.2.0.tgz
修改config/server.properties
#broker的全局唯一编号,不能重复 broker.id=0 #kafka消息存放的路径 log.dirs=/opt/kafka/logs #broker需要使用zookeeper保存meta数据 zookeeper.connect=localhost:2181
https://blog.csdn.net/lizhitao/article/details/25667831 配置属性说明
启动
nohup bin/kafka-server-start.sh config/server.properties &
3. 安装kafka-manager
下载地址 https://github.com/yahoo/kafka-manager/releases
sbt编译
cd /etc/yum.repos.d/ curl https://bintray.com/sbt/rpm/rpm > bintray-sbt-rpm.repo yum install sbt
下载sbt
wget https://dl.bintray.com/sbt/native-packages/sbt/0.13.6/sbt-0.13.6.tgz
tar -zxvf sbt-0.13.6.tgz
添加环境变量
vi /etc/profile
export SBT_HOME=/opt/sb
export PATH=$PATH:/$SBT_HOME/bin
/×修改sbt文件权限×/
$ chmod u+x sbt
验证:检查sbt是否安装成功,查看命令输出
修改镜像提高下载速度
cd ~
mkdir .sbt
vim repositories
[repositories]
local
aliyun: http://maven.aliyun.com/nexus/content/groups/public
typesafe: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
sbt -version
编译kafka-manager
./sbt clean dist
出现此图表示更新成功
cd /opt/kafka-manager/target/universal/
unzip kafka-manager-2.0.0.1.zip
修改配置
将kafka-manager.zkhosts="localhost:2181"
此行中的localhost,改为你的Zookeeper服务器的IP地址
启动
nohup ./kafka-manager -Dconfig.file=/opt/kafka-manager/target/universal/kafka-manager-2.0.0.1/conf/application.conf -Dhttp.port=9001 &
win10上面运行连接远程kafka记得在C:WindowsSystem32driversetc下修改hosts
47.103.*.* node1