After implementing the Springcloud Configuration Center, we need to consider the dynamic refresh configuration. If there is only one client to consider, we can add webhook when the configuration file has a push operation and use Webhook to send a refreshed POST request to the client. But when the client is in a lot of situations, it is impractical to request multiple clients. So we thought of just refreshing the configuration center directly by the configuration center to notify each client to get the latest configuration. Here's a note of the day today. Using Springcloud Bus Integration Kafka (or RABBITMQ) to achieve dynamic refresh, local play, so is the Windows environment Ha, Linux is similar. Because the project before the use of Kafka, the new project launches directly to use, so there is no use of RABBITMQ, want to use RABBITMQ classmate can be a separate Baidu ha.
First, because the Kafka strong dependence on zookeeper, so we have to install zookeeper and Kafka
1. Installing zookeeper
Download the compressed package https://www.apache.org/dyn/closer.cgi/zookeeper and unzip to D drive, I downloaded the latest stable version zookeeper-3.4.12.tar.gz
Modify environment variable, add variable zookeeper_home variable value D:\zookeeper-3.4.12 modify variable Path variable value add%zookeeper_home%\bin;
Create a new folder under D:\zookeeper-3.4.12 data and log, and then copy the zoo_sample.cfg under D:\zookeeper-3.4.12\conf to the current directory named Zoo.cfg and add
Datadir=d:/zookeeper-3.4.12/data
Datalogdir=d:/zookeeper-3.4.12/log
Open the CMD window as an administrator, enter Zkserver, or start the ZK service
2. Installing Kafka
Download the compressed package http://kafka.apache.org/downloads any binary files and unzip to the D drive, I downloaded the kafka_2.12-1.1.0.
Springcloud Configuring dynamic Updates