10

I am curious if somebody is actually running PostgreSQL in a container in production on some form of distributed file system - GlusterFS preferably, or anything.

I am currently running Mesos/Marathon. In case the PostgreSQL node fails, Marathon simply launches another instance of PostgreSQL on other nodes and if done properly (service discovery and application recovering from database connection loss), the ultimate fault tolerance will be achieved.

I know PostgreSQL has its own HA solutions, like log shipping and hot stand-by backup, but then one still need to solve the problem on when to switch from master to slave, how to do it properly and so on.

So, how do you run PostgreSQL in production on GlusterFS or similar? If so, is it stable? How about performance?

poige
  • 9,171
  • 2
  • 24
  • 50
pigster
  • 119
  • 1
  • 4
  • 2
    We finally ended up using CEPH Only thing i have found so far concerning this topic is https://www.youtube.com/watch?v=OqlC7S3cUKs – pigster Apr 19 '17 at 16:47
  • 3
    It may be worth using repmgr (http://repmgr.org/) for managing your HA postgres failovers, instead of overcomplicating things with containers and gluster. – JamesHannah Nov 23 '17 at 13:48
  • 1
    I can also mention PAF : http://clusterlabs.github.io/PAF/ as a cluster manager for PostgreSQL. – Pierre-Alain TORET Dec 11 '17 at 13:36

2 Answers2

0

but then one still need to solve the problem on when to switch from master to slave, how to do it properly and so on.

Each and every cluster usually has notion of quorum: watchers (monitors, whatever) are to decide which node is the master. Then you can use theirs information to route requests properly. It's quite typical to run haproxy with not only basic TCP/IP health checks but some high level logic implemented with service specific queries.

Check out peacemaker, for e. g..

poige
  • 9,171
  • 2
  • 24
  • 50
  • The veritas cluster (now symantec cluster, afaik) does not use quorum mechanisms. Quite clever solution. – Nils Sep 16 '21 at 15:30
0

You need to run postgresql in stateful service mode. Scaling is done by mesos but data replication is done by the postgresql it self. Take a look at this site stateful service and persistent volumes.

affan
  • 51
  • 3