赞
踩
同时在125、129、130节点依次执行
mkdir /app
cd /app
wget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz
tar -zxvf zookeeper-3.4.8.tar.gz
cd /app/zookeeper-3.4.8
mkdir data logs
cp conf/zoo_sample.cfg conf/zoo.cfg
vim conf/zoo.cfg
第一处:配置dataDir
dataDir=/app/zookeeper-3.4.8/data
第二处:新增配置
server.1=192.168.105.125:2288:3388
server.2=192.168.105.129:2288:3388
server.3=192.168.105.130:2288:3388
vim /app/zookeeper-3.4.8/data/myid
内容:1
vim /app/zookeeper-3.4.8/data/myid
内容:2
vim /app/zookeeper-3.4.8/data/myid
内容:3
125/129/130节点依次执行
firewall-cmd --zone=public --add-port=2181/tcp --permanent
firewall-cmd --zone=public --add-port=2288/tcp --permanent
firewall-cmd --zone=public --add-port=3388/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-ports
/app/zookeeper-3.4.8/bin/zkServer.sh start /app/zookeeper-3.4.8/conf/zoo.cfg
/app/zookeeper-3.4.8/bin/zkServer.sh status /app/zookeeper-3.4.8/conf/zoo.cfg
同时在125、129、130节点依次执行
wget https://archive.apache.org/dist/kafka/2.2.0/kafka_2.12-2.2.0.tgz
tar -zxvf kafka_2.12-2.2.0.tgz
cd /app/kafka_2.12-2.2.0/config
cp server.properties server.properties.bak
vim server.properties
内容如下:
broker.id=1 listeners=PLAINTEXT://192.168.105.125:9092 advertised.listeners=PLAINTEXT://192.168.105.125:9092 port=9092 host.name=192.168.105.125 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=/app/kafka/data num.partitions=1 num.recovery.threads.per.data.dir=1 offsets.topic.replication.factor=3 transaction.state.log.replication.factor=1 transaction.state.log.min.isr=1 log.retention.hours=24 log.retention.bytes=1073741824 log.segment.bytes=1073741824 log.retention.check.interval.ms=300000 zookeeper.connect=192.168.105.125:2181,192.168.105.129:2181,192.168.105.130:2181 zookeeper.connection.timeout.ms=6000 auto.create.topics.enable = false delete.topic.enable=true message.max.byte=52428880 log.cleanup.policy=delete log.segment.delete.delay.ms=0 group.initial.rebalance.delay.ms=0
vim server.properties
内容如下:
broker.id=2 listeners=PLAINTEXT://192.168.105.129:9092 advertised.listeners=PLAINTEXT://192.168.105.129:9092 port=9092 host.name=192.168.105.125 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=/app/kafka/data num.partitions=1 num.recovery.threads.per.data.dir=1 offsets.topic.replication.factor=3 transaction.state.log.replication.factor=1 transaction.state.log.min.isr=1 log.retention.hours=24 log.retention.bytes=1073741824 log.segment.bytes=1073741824 log.retention.check.interval.ms=300000 zookeeper.connect=192.168.105.125:2181,192.168.105.129:2181,192.168.105.130:2181 zookeeper.connection.timeout.ms=6000 auto.create.topics.enable = false delete.topic.enable=true message.max.byte=52428880 log.cleanup.policy=delete log.segment.delete.delay.ms=0 group.initial.rebalance.delay.ms=0
vim server.properties
内容如下:
broker.id=3 listeners=PLAINTEXT://192.168.105.130:9092 advertised.listeners=PLAINTEXT://192.168.105.130:9092 port=9092 host.name=192.168.105.130 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=/app/kafka/data num.partitions=1 num.recovery.threads.per.data.dir=1 offsets.topic.replication.factor=3 transaction.state.log.replication.factor=1 transaction.state.log.min.isr=1 log.retention.hours=24 log.retention.bytes=1073741824 log.segment.bytes=1073741824 log.retention.check.interval.ms=300000 zookeeper.connect=192.168.105.125:2181,192.168.105.129:2181,192.168.105.130:2181 zookeeper.connection.timeout.ms=6000 auto.create.topics.enable = false delete.topic.enable=true message.max.byte=52428880 log.cleanup.policy=delete log.segment.delete.delay.ms=0 group.initial.rebalance.delay.ms=0 `` ###### 2.4. 防火墙 125/129/130节点依次执行 ```bash firewall-cmd --zone=public --add-port=9092/tcp --permanent firewall-cmd --reload firewall-cmd --list-ports
启动kafka(第一次前台)
cd /app/kafka_2.12-2.2.0
./bin/kafka-server-start.sh config/server.properties
启动kafka(前台)
cd /app/kafka_2.12-2.2.0
./bin/kafka-server-start.sh -daemon config/server.properties
125节点
129节点
130节点
使用kafka,创建一个主题(topic)
bin/kafka-topics.sh --create --zookeeper 192.168.105.125:2181,192.168.105.129:2181,192.168.105.130:2181 --replication-factor 1 --partitions 1 --topic pis-business
bin/kafka-console-producer.sh --broker-list 192.168.105.125:9092 --topic pis-business
bin/kafka-console-consumer.sh --bootstrap-server 192.168.105.125:9092 --from-beginning --topic pis-business
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。