Code Monkey home page Code Monkey logo

bgw_replstatus's Issues

slave not promoted to master when master is down

hi everyone.
I try to implement PostgreSQL high availability using bgw_replstatus and haproxy.
according to part of your readme, it said :

automatically switches over to the backup node if the master goes down and the backup is promoted.

but I have an issue when the master instance is down, the slave does not take over/ promoted to master node. here is my environment :

  1. dockerized PostgreSQL 9.68
  2. installed bgw_replstatus version 1.02 inside the container fetch from here
  3. haproxy 1.7.11-1

here is my postgresql.conf configuration on master node that I change :

wal_level = hot_standby
archive_mode = on
archive_command = 'test ! -f mnt/server/archivedir/%f && cp %p mnt/server/archivedir/%f'
max_wal_senders = 3
wal_keep_segments = 1000
shared_preload_libraries = 'bgw_replstatus'

here is my postgresql.conf on slave node after pg_basebackup which I change:

hot_standby = on

and here is my recovery.conf on the slave node

standby_mode = on
primary_conninfo = 'host=[host-ip-source] port=[source-port] user=repuser password=[some-password]'

and here is my haproxy configuration

frontend pgcluster
	bind *:5433
	mode tcp
	default_backend pgcluster

backend pgcluster
	mode tcp
	balance roundrobin
	option tcp-check
	tcp-check expect string MASTER
	server tm 172.31.32.129:5444 check port 5446
        server x2 172.31.18.158:5554 check port 5400 backup

here is the return when I test it using nc [ip-address] [port-bgw_replstatus] command
image

when all node is up, the PostgreSQL running well, and I can access it using this command :
psql -h some.domain.to.pgcluster -p 5433 -U postgres
ย 
image

but when the master is down, the slave is not promoted to master/not takeover here is the return :
image

is there a miss configuration or is there workaround which I can use to implement this high availability for haproxy?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.