pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedConfiguration of django with master slave replication Postgres
6+ messages / 3 participants
[nested] [flat]
* Configuration of django with master slave replication Postgres
@ 2019-04-02 11:50 soumitra bhandary <soumitra.bhandary@hotmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: soumitra bhandary @ 2019-04-02 11:50 UTC (permalink / raw)
To: shreeyansh2014@gmail.com <shreeyansh2014@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Configuration of django with master slave replication Postgres
@ 2019-04-02 12:22 Thomas Poty <thomas.poty@gmail.com>
parent: soumitra bhandary <soumitra.bhandary@hotmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Poty @ 2019-04-02 12:22 UTC (permalink / raw)
To: soumitra bhandary <soumitra.bhandary@hotmail.com>; +Cc: shreeyansh2014@gmail.com <shreeyansh2014@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
As you are using pg 9.5, these links may help :
https://severalnines.com/blog/postgresql-load-balancing-using-haproxy-keepalived
https://clusterlabs.github.io/PAF/
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
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Configuration of django with master slave replication Postgres
@ 2019-04-02 20:39 Prince Pathria <prince.pathria@goevive.com>
parent: Thomas Poty <thomas.poty@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Prince Pathria @ 2019-04-02 20:39 UTC (permalink / raw)
To: Thomas Poty <thomas.poty@gmail.com>; +Cc: soumitra bhandary <soumitra.bhandary@hotmail.com>; shreeyansh2014@gmail.com <shreeyansh2014@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
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:
> As you are using pg 9.5, these links may help :
>
>
> https://severalnines.com/blog/postgresql-load-balancing-using-haproxy-keepalived
> https://clusterlabs.github.io/PAF/
>
> 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
>>
>>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Configuration of django with master slave replication Postgres
@ 2019-04-03 00:17 soumitra bhandary <soumitra.bhandary@hotmail.com>
parent: Prince Pathria <prince.pathria@goevive.com>
0 siblings, 1 reply; 6+ messages in thread
From: soumitra bhandary @ 2019-04-03 00:17 UTC (permalink / raw)
To: Prince Pathria <prince.pathria@goevive.com>; +Cc: Thomas Poty <thomas.poty@gmail.com>; shreeyansh2014@gmail.com <shreeyansh2014@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
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<mailto: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<http://goevive.com;
On Tue, Apr 2, 2019 at 5:52 PM Thomas Poty <thomas.poty@gmail.com<mailto:thomas.poty@gmail.com>> wrote:
As you are using pg 9.5, these links may help :
https://severalnines.com/blog/postgresql-load-balancing-using-haproxy-keepalived
https://clusterlabs.github.io/PAF/
Le mar. 2 avr. 2019 à 13:50, soumitra bhandary <soumitra.bhandary@hotmail.com<mailto: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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Configuration of django with master slave replication Postgres
@ 2019-04-04 12:40 Prince Pathria <prince.pathria@goevive.com>
parent: soumitra bhandary <soumitra.bhandary@hotmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Prince Pathria @ 2019-04-04 12:40 UTC (permalink / raw)
To: soumitra bhandary <soumitra.bhandary@hotmail.com>; +Cc: Thomas Poty <thomas.poty@gmail.com>; shreeyansh2014@gmail.com <shreeyansh2014@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
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:
>
>> As you are using pg 9.5, these links may help :
>>
>>
>> https://severalnines.com/blog/postgresql-load-balancing-using-haproxy-keepalived
>> https://clusterlabs.github.io/PAF/
>>
>> 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
>>>
>>>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Configuration of django with master slave replication Postgres
@ 2019-04-04 13:06 Prince Pathria <prince.pathria@goevive.com>
parent: Prince Pathria <prince.pathria@goevive.com>
0 siblings, 0 replies; 6+ messages in thread
From: Prince Pathria @ 2019-04-04 13:06 UTC (permalink / raw)
To: soumitra bhandary <soumitra.bhandary@hotmail.com>; +Cc: Thomas Poty <thomas.poty@gmail.com>; shreeyansh2014@gmail.com <shreeyansh2014@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
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.
http://www.pgpool.net/docs/latest/en/html/runtime-config-connection.html
http://www.pgpool.net/docs/latest/en/html/runtime-config-load-balancing.html
http://www.pgpool.net/docs/latest/en/html/runtime-config-backend-settings.html
http://www.pgpool.net/docs/latest/en/html/runtime-config-connection-pooling.html
http://www.pgpool.net/docs/latest/en/html/auth-methods.html
http://www.pgpool.net/docs/latest/en/html/pcp-commands.html
http://www.pgpool.net/docs/latest/en/html/runtime-config-logging.html
http://www.pgpool.net/docs/latest/en/html/runtime-config-running-mode.html
http://www.pgpool.net/docs/latest/en/html/runtime-streaming-replication-check.html
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:
>>
>>> As you are using pg 9.5, these links may help :
>>>
>>>
>>> https://severalnines.com/blog/postgresql-load-balancing-using-haproxy-keepalived
>>> https://clusterlabs.github.io/PAF/
>>>
>>> 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
>>>>
>>>>
Attachments:
pgpool.conf (application/octet-stream, 38.5K) download
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2019-04-04 13:06 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02 11:50 Configuration of django with master slave replication Postgres soumitra bhandary <soumitra.bhandary@hotmail.com>
2019-04-02 12:22 ` Thomas Poty <thomas.poty@gmail.com>
2019-04-02 20:39 ` Prince Pathria <prince.pathria@goevive.com>
2019-04-03 00:17 ` soumitra bhandary <soumitra.bhandary@hotmail.com>
2019-04-04 12:40 ` Prince Pathria <prince.pathria@goevive.com>
2019-04-04 13:06 ` Prince Pathria <prince.pathria@goevive.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox