(3 cluster machines are required as follows)
cd /home/app
Upload kafka zookeeper and archive, and extract (a lot of installation)
Zookeeper cluster deployment
cd /data/app/zookeeper**
mkdir logs data
Modify the configuration file
cd /data/app/zookeeper****/config
mv zoo_sample.cfg zoo.cfg
I came zoo.cfg
clientPort=2181
maxClientCnxns=0
tickTime=2000
initLimit=5
syncLimit=2
dataDir=/data/app/zookeeper***/data
dataLogDir=/data/app/zookeeper***/logs
server.1=***-1:2888:3888
server.2=***-2:2888:3888
server.3=***-3:2888:3888
(*** - 1 is too each machine hostname, if not done mapping to write server ip)
Do the mapping is as follows
vim / etc / hosts add the following:
IP *** -. 1
IP *** - 2
IP *** -. 3
*** replaced by the actual hostname machine.
Adding id
cd /data/app/zookeeper****/data
vim myid
A first server input, a second input 2, a third input 3, to the configuration file server.1, server.2, server.3 corresponding to
Storage
This zookeeper deployed temporarily can not start
Kafka cluster deployment
cd /data/app/kafka****
mkdir kafka-logs
Modify the configuration file
cd /data/app/app/kafka***/config
the server.properties Vim
broker.id = 0 // three machines either as
log.dirs = / Data / App / kafka_2.11-1.1.0 / Kafka-logs
the Listeners = PLAINTEXT: // The machine ip: 9092
If the case ## has a port mapping, access can fill the corresponding IP
advertised.listeners = PLAINTEXT: // native IP: 9092
num.partitions. 4 =
num.recovery.threads.per.data.dir. 1 =
offsets.topic. =. 1 replication.factor
transaction.state.log.replication.factor. 1 =
transaction.state.log.min.isr. 1 =
zookeeper.connect = IP1: 2181, IP2: 2181, IP3: 2181 (IP1 IP2 IP3 are clustered zookeeper the three servers ip)
zookeeper.connection.timeout.ms = 6000
This kafka cluster configuration completed
Start zookeeper
/data/app/zookeeper***/bin/zkServer.sh start
Start all Kafka used to live
nohup /data/app/kafka_***/bin/kafka-server-start.sh /data/app/kafka***/config/server.properties
Test results deployment
cd /data/app/kafka****/bin
./kafka-console-producer.sh --broker-list ip:9092 --topic test
set test 123456(set key value)
./kafka-console-consumer.sh --zookeeper ip:2181 --topic test --from-beginning
get test (get key)
The three servers are replaced by clusters of both ip try