The Configuration Pub-Sub concept is a simple server that listens for configuration updates and publishes them to a Redis server. This allows other services using the same Redis server to receive the latest configuration updates seamlessly.
To install Redis, follow these steps:
-
Download the latest version of Redis from here.
wget https://download.redis.io/redis-stable.tar.gz
-
Compile and install Redis:
mkdir $HOME/redis/ cp redis-stable.tar.gz $HOME/redis/ cd $HOME/redis/ tar xvzf redis-stable.tar.gz cd redis-stable make
-
(Optional) Add Redis to the PATH:
echo "alias redis-server='$HOME/redis/redis-stable/src/redis-server'" >> $HOME/.bashrc source $HOME/.bashrc
To start the Redis server, run the following command:
redis-server
pip install redis
Edit the config.cfg
file according to your configuration requirements.
To publish the configuration, use the following command:
python publisher.py
To check the configuration using a Python subscriber, follow these steps:
python subscriber.py
python publisher.py