1、安裝部署消息隊列KAFKA
1.首先準備Zookeeper服務
- kafka是依賴於Zookeeper的,因此首先先運行Zookeeper。
- 先啓動依賴,而後把安裝包
kafka_2.12-2.5.0.taz
放到/root
目錄下,並解壓到新建的一個目錄中
[root@k8s-master ~]# cd /usr/local/zookeeper/apache-zookeeper-3.6.1-bin/bin/
[root@k8s-master bin]# ./zkServer.sh start
[root@k8s-master bin]# cd /usr/local
[root@k8s-master local]# mkdir kafka
[root@k8s-master local]# cd kafka/
[root@k8s-master kafka]# tar -zxvf /root/kafka_2.12-2.5.0.tgz -C ./
- 新建一個logs目錄,等下要將該目錄的路徑配置到kafka的配置文件中
[root@k8s-master kafka_2.12-2.5.0]# mkdir logs
[root@k8s-master kafka_2.12-2.5.0]# cd config/
[root@k8s-master config]# vim server.properties
log.dirs=/usr/local/kafka/kafka_2.12-2.5.0/logs
- 開始啓動kafka,若是須要後臺啓動,則須要加上
-daemon
參數便可。
[root@k8s-master config]# cd ..
[root@k8s-master kafka_2.12-2.5.0]# ./bin/kafka-server-start.sh ./config/server.properties

- 接下倆咱們驗證一下,建立一個名爲
ruigege
的topic
,建立完成後,使用命令來列出目前已經有的topic
列表
[root@k8s-master kafka_2.12-2.5.0]# ./bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic ruigege
[root@k8s-master kafka_2.12-2.5.0]# ./bin/kafka-topics.sh --list --bootstrap-server localhost:9092
- 接下來建立一個生產者,用於在ruigege上這個topic生產消息
[root@k8s-master kafka_2.12-2.5.0]# ./bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic ruigege
[root@k8s-master kafka_2.12-2.5.0]# ./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic ruigege
- 咱們終於部署完這些工具了,下面開始搭建一個先後端分離的開源項目
2、搭建一個開源項目
[root@k8s-master ~]# mkdir project
[root@k8s-master ~]# cd project/
[root@k8s-master project]# git clone https://gitee.com/y_project/RuoYi-Vue.git
3、源碼: