This is the tool for Postgresql and ElasticSearch Mirroring. In this section we will discuss the mirroring in two section .
- POSTGRESQL
- ELASTICSEARCH
First you clone the repository from Github.
git clone https://github.com/initack/PostgresqlElasticMirror
cd PostgresqlElasticMirror/venv
source bin/activate ##for activate the virtualenvironment.
Now run the generate_connection.py script inside of the mirror directory.
cd mirror
python generate_connection.py --dbname DATABASE_NAME --username POSTGRES_USER \
--passwd YOUR_ULTRA_TOP_SECRET_PASSWORD_OF_DATABASE
insert_query_notify.sh script has 2 parameter
- TABLE_NAME is First
- DATABASE_NAME is Second
cd sql
chmod +x insert_query_notify.sh
./insert_query_notify.sh TABLE_NAME DATABASE_NAME
End of the script for enable the TRIGGERS script wants to password of database
After you authenticated, you must have config.py file inside of mirror directory. For now, you can start the mirroring with ElasticSearch. Check the elasticsearch stat;
lsof -i tcp:9200 ##default port of elastic search
If you have the response, your instance is UP! 👏👏👏
After check the instance life, run the script is listen.py
python listen.py --ch CHANNEL_NAME
cd tests
python test_elastic_method.py channel_name
Not production grade ! 🐍 Not good for user interact ! TroubleShooting and more tests