Docker – Containerized PostgreSQL with data on a distributed file system

dockerglusterfspostgresql

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?

Best Answer

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..