#Kafka单机部署
##单独部署Zookeeper
1.JAVA8环境
2.解压下载文件apache-zookeeper-3.5.7-bin.tar.gz
3.
$ cp zoo_sample.cfg zoo.cfg
$ vim zoo.cfg
修改 dataDir 不要使用tmp
新加dataLogDir
admin.sercerPosrt 修改默认端口, 默认为8080
4 添加环境变量
$sudo vim /etc/profile.d/zookeeper.sh
export ZOOKEEPER_HOME=/app/zookeeper-3.4.13/
export PATH=$PATH:$ZOOKEEPER_HOME/bin
Source /etc/profile
5.启动
/bin/zkserver.sh start |status|stop
##部署Kafka
2.11-1.1.0版本才与JDK1.7兼容,否则更高版本需要JDK1.8
1.设置环境变量
vi /etc/profile
export KAFKA_HOME=/home/.../kafka_2.11-0.10.1.1
export PATH=$PATH:$KAFKA_HOME/bin
source /etc/profile #配置生效
export KAFKA_HOME = /opt/kafka/kafka/kafka_2.12-2.4.1
export PATH=${PATH}:${KAFKA_HOME}/bin
3修改配置文件
config/server.properties
//修改日志目录,放开
log.dirs=/home/panfudong/soft/kafka/kafka_2.11-0.10.1.1/kafka-logs
listeners=PLAINTEXT://:9092
//未放开时会报错: could not be established. Broker may not be available.
port =9092
host.name=172.16.210.251
advertised.listeners=PLAINTEXT://172.16.210.251:9092
//远程访问报错 java.nio.channels.UnresolvedAddressException: null | 远程访问
4.启动
bin/kafka-server-start.sh config/server.properties &
后台启动
$ nohup kafka-server-start.sh /home/espai/kafka/config/server.properties 1>/dev/null 2>&1 &
停止
./bin/kafka-server-stop.sh
查看进程
netstat -tunlp|egrep "(2181|9092)"
Copyright © 2024 妖气游戏网 www.17u1u.com All Rights Reserved