The environment of this article is as follows:
Operating system: CentOS 6 32-bit
JDK version: 1.8.0_77 32-bit
Kafka version: 0.9.0.1 (Scala 2.11)
Connected with the Kafka stand-alone, cluster mode installation detailed (a)
6. Single-node multi-broker mode
Kafka can be used in a variety of modes, including single-node single-broker, single-node multi-broker, multi-node multi-broker.
Here we simply distinguish:
Single-node single broker: On a single machine, a Kafka instance is launched (this is the model in the previous article).
Single-node multi-broker: Turn on multiple Kafka (pseudo-distributed like Hadoop) on the same machine.
Multi-node Multi-broker: Open multiple Kafka on multiple machines separately.
6.1 Copy Kafka
Copy the previous single-node single-broker Kafka folder 1 copies to Kafka2.
6.2 Modifying a configuration file
(1) Modify the following content in the server.properties of the first Kafka:
broker.id=0port=9092host.name=master
(2) Modify the following content in the server.properties of the second Kafka:
broker.id=1port=9093 //端口号要与其他同主机的实例不同host.name=master
6.3 Starting the program
First make sure that zookeeper
it is started, and then execute it separately in 2 Kafka directories.
bin/kafka-server-start.sh config/server.properties&
If no error is indicated, the boot is successful.
7. Distribution mode (multi-node multi-broker) 7.1 Replication Kafka
Copy the Kafka folder of the sixth step to the other 2 servers slave1 and slave2, respectively, KAFKA3,KAFKA4.
7.2 Modifying a configuration file
(1) Modify the following content in the third Kafka Server.properties:
broker.id=2port=9092host.name=slave1
(2) Modify the following content in the server.properties of the fourth Kafka:
broker.id=3port=9092host.name=slave2
7.3 Starting the program
Make sure that you zookeeper
have started, and then perform all the Kafka directories on each of the 3 hosts
bin/kafka-server-start.sh config/server.properties&
If no error is indicated, the boot is successful.
Kafka single-machine, cluster mode installation details (ii)