First of all, Kafka run, need zookeeper in the background to run, although Kafka has built-in zookeeper, but we still build with their own distributed zookeeper
Kafka Single-node construction (with its own zookeeper)
Start the service
? 1, configure and start zookeeper services
Using Kafka built-in ZK
? Configure ZK File:/opt/kafka/config/zookeeper.properties
? Enable ZK Service:
?/opt/kafka/bin/zookeeper-server-start.sh/opt/kafka/config/zookeeper.properties >/opt/logs/kafka-zk.log 2> &1 &
? Netstat-an | grep 2181
Using the public ZK
? zookeeper.connect in/opt/kafka/config/server.properties Configure the address of an external ZK
?
? 2, Start Kafka-server
? Configure the relevant parameters/opt/kafka/config/server.properties
? Main parameters: Broker.id, Port, Log.dirs
? Start:/opt/kafka/bin/kafka-server-start.sh/opt/kafka/config/server.properties >/opt/logs/kafka-server.log 2> &1 &
Zookeeper's cluster construction
Deploying Kafka clusters is actually the number of brokers that increase Kafka.
Deploy Kafka cluster: 192.168.2.134, 192.168.2.135, 192.168.2.136
?
? 1, ZK Configuration and single node consistent.
? 2, Server Startup:
Configuration of the 192.168.2.134 node/opt/kafka/config/server.properties broker.id=0
Configuration of the 192.168.2.135 node/opt/kafka/config/server.properties broker.id=1
Configuration of the 192.168.2.136 node/opt/kafka/config/server.properties broker.id=2
? server.properties configuration for all nodes: zookeeper.connect=192.168.2.134:2181,192.168.2.135:2181,192.168.2.136:2181
? start all servers (execute this command in each console to start Kafka):/opt/kafka/bin/kafka-server-start.sh/opt/kafka/config/server.properties >/ Opt/logs/kafka-server.log 2>&1 &
? Add two copies, 3 Partitions of topic World
? bin/kafka-topics.sh--create--zookeeper 192.168.2.134:2181,192.168.2.135:2181,192.168.2.136:2181-- Replication-factor 3--partitions 2--topic World
Kafka Single-node construction and cluster construction