Re: Configuration of django with master slave replication Postgres - Mailing list pgsql-admin

From Prince Pathria
Subject Re: Configuration of django with master slave replication Postgres
Date
Msg-id CAON0Dax0A6rQAUQEcXNzoJ0Qc9s5J3Ec-DfEqXMamx4PQTpjyw@mail.gmail.com
Whole thread Raw
In response to Configuration of django with master slave replication Postgres  (soumitra bhandary <soumitra.bhandary@hotmail.com>)
List pgsql-admin
I didn't configured watchdog mode(was not required for my use case). Assuming you're using streaming replication, you can use my config.
Steps:1 Install pgpool as per your OS
Step:2 configure your /etc/pgpool/pool_hba.conf and pg_hba.conf as per your requirement.
Step:3  create a file /etc/pgpool/pool_passwd for pgpool to connect to postgres.  use tool pg_md5, it will fill the file with username and password.
Step:4 configure pgpool.conf as per your requirement. I'm attaching mine for your reference.



Go through them as well.

Happy to help :)
Prince Pathria Systems Engineer Evive +91 9478670472 goevive.com


On Thu, Apr 4, 2019 at 6:10 PM Prince Pathria <prince.pathria@goevive.com> wrote:
Hi Soumitra,
In pgpool-II you can configure watchdog mode, so if one pgpool fails the other node of pgpool gets the VIP so that no change is required on client side.
Can you show you django dsn config once? 
I'm assuming you can do same with pgpool, " Even for that reason in django I have to configure dsn like that so that it can automatically switch to other node if one node is not reachable." If you switch your dsn IPs and  ports with 2 of pgpool node(if one pgpool fails dsn will switch to other pgpool node).

Happy to help :)
Prince Pathria Systems Engineer Evive +91 9478670472 goevive.com


On Wed, Apr 3, 2019 at 5:47 AM soumitra bhandary <soumitra.bhandary@hotmail.com> wrote:
Hi Prince,

Can you please share me the steps to set up pgpool. Also if I use single pgpool that could led to the single point failure. Even for that reason in django I have to configure dsn like that so that it can automatically switch to other node if one node is not reachable. How to do that?? 

Sent from my iPhone

On 03-Apr-2019, at 2:10 AM, Prince Pathria <prince.pathria@goevive.com> wrote:

PgPool-II is very much suitable for your case. It will distribute your read queries on master and slaves + automatic master switch detection + connection pools.
 
Happy to help :)
Prince Pathria Systems Engineer Evive +91 9478670472 goevive.com


On Tue, Apr 2, 2019 at 5:52 PM Thomas Poty <thomas.poty@gmail.com> wrote:

Le mar. 2 avr. 2019 à 13:50, soumitra bhandary <soumitra.bhandary@hotmail.com> a écrit :

Hi
Does anyone have any idea with django how to configure multiple dsn that will automatically switch to new Postgres master host in case of failover happens to previous master and auto promotion of new master is done with repmgr.


My configuration is as below

Master and asynchronous slave node . Repmgrd is configured to take care of autofailover and promotion of new master node.

But from application side with django how to make datasource so that it automatically switches to new master node in case of failover.
Please share the steps.


Sent from my iPhone

Attachment

pgsql-admin by date:

Previous
From: Prince Pathria
Date:
Subject: Re: Configuration of django with master slave replication Postgres
Next
From: Keith Fiske
Date:
Subject: Re: archive_command options?