Skip to content

halil9/PostgresqlElasticMirror

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

Postgresql Elastic Search Mirroring Tool

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
   

DATABASE LEVEL

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

ELASTICSEARHC LEVEL

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

For Testing

	cd tests
	python test_elastic_method.py channel_name
    

Problems

Not production grade ! 🐍 Not good for user interact ! TroubleShooting and more tests

About

Postgresql Elastic Mirroring Tool for disaster scenario

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.8%
  • Other 0.2%