Download the installation package
scala -version
: Check the version of scala
- Download the corresponding installation package from the official website: DOWNLOAD
Upload the installation package to Linux
This step will be much more convenient with Xftp7
/usr/local
Create a new kafka directory under the directory
[root@master ~]# cd /usr/local
[root@master local]# mkdir kafka
kafka-logs
Create a new folder in the kafka directory
[root@master local]# cd kafka
[root@master kafka]# mkdir kafka-logs
- Upload the installation package in the kafka directory
kafka_2.12-3.3.1.tgz
(I use Xftp7 to drag and drop directly)
Unzip the installation package
[root@master kafka]# cd /usr/local
[root@master kafka]# tar -zxvf kafka_2.12-3.3.1.tgz
Configure server.properties
- Enter the config folder in the unzipped folder
[root@master kafka]# cd kafka_2.12-3.3.1/config
- Edit server.properties
[root@master config]# vi server.properties
Change the following places to the ip address of your own virtual machine
Press i to modify, press Esc after modification: wq to save and exit
open kafka
- Start zookeeper first ( open another terminal )
[root@master kafka_2.12-3.3.1]# bin/zookeeper-server-start.sh config/zookeeper.properties &
- Open kafka again ( open another terminal )
[root@master kafka_2.12-3.3.1]# bin/kafka-server-start.sh config/server.properties &
jps
View progress with
topic-related
- Create a new topic: topictest (Note: master is the name of the cluster host, try replacing the error with localhost)
[root@master kafka_2.12-3.3.1]# bin/kafka-topics.sh --create --bootstrap-server master:9092 --replication-factor 1 --partitions 1 --topic topictest
- View topic list
[root@master kafka_2.12-3.3.1]# bin/kafka-topics.sh --list --bootstrap-server master:9092
- Start the command line producer program (test) ( open another terminal )
[root@master kafka_2.12-3.3.1]# bin/kafka-console-producer.sh --broker-list master:9092 --topic topictest
Type some words:
- Start the command line consumer program (test) ( open another terminal )
[root@master kafka_2.12-3.3.1]# bin/kafka-console-consumer.sh --bootstrap-server master:9092 --topic topictest --from-beginning
Successfully received message: