73 points · by secure · 12y ago · 45 comments
I use wal-e myself and its indispensable and easy to use.
pgpool2 on the other hand provides statement-level consistency, i.e. a statement is only successful when it is committed to all healthy nodes.
I agree that for many use-cases, the built-in master/slave replication is probably good enough, but I wanted to try going all the way… :)
I’ll make a note to look into replacing the pgpool setup with a standard master/standby solution and see if I run into any problems that prevent me from doing that :).
""" Commits made when synchronous_commit is set to on or remote_write will wait until the synchronous standby responds. The response may never occur if the last, or only, standby should crash.
[…]
If you really do lose your last standby server then you should disable synchronous_standby_names and reload the configuration file on the primary server. """
The way I interpret this is that in case my one and only standby server crashes, my database will not allow any modifications until I intervene. With pgpool2, writes will continue to work on the master, and it’s my responsibility to eventually bring back the standby server.
When I started Reesd, the main reason was to be able to use (a single invokation of) scp to ship WAL segments to three different machines in different datacenters.
Actually, now that Reesd is deployed, it itself uses multiple of the above mechanisms. It ships WAL segments (exactly as a user of Reesd could do it, by uploading to a Reesd bucket), uses synchronous replication between the primary and a first standby, and asynchronous replication with a second standby. Both standby's are also configured to use WAL segments if available. Indeed, starting a standby will first use the WAL segments before connecting to the primary to begin streamming replication.
[1] https://kloudless.com [2] http://wiki.postgresql.org/wiki/PgBouncer
http://webcache.googleusercontent.com/search?q=cache:MPIiThx...
Traceroutes welcome in case it is reproducibly down for you :).
As for a simpler way, I think suitable scripts for recovery should be shipped with pgpool2 as a first step.
A second step would be integrating pgpool2 functionality into PostgreSQL itself. That way, the whole authentication problem would go away, and you would not need to run a separate program. Also, the WAL shipping could be replaced by just letting the non-primary nodes use a replication connection to the primary node directly.
That would not get rid of all of the complexity, but it’d hide a lot more of it from the user :).
Scalable, Reliable PostgreSQL is not really there yet.
There are many ways to do it, yes, but most people just want one thing: the db failing over in case it goes down.
If you truly need reliability, of course you'll have to invest some time into setting it up. If this isn't something you're interested in, just go with a hosted postgres instance like Heroku.
So, there is a single solution. If you want greater flexibility, pgpool2 may be an option; otherwise, just use what's built-in.
I just want sharding with automatic failover to separate datacenter in a simple package...
Sharding is a problem in Postgres and I am sure they will fix the disconnect between how the data is inserted and how it's read pretty soon.
Automatic failover and datacentre awareness are not typical features in Open Source RDBMS, although you some NOSQL solutions may do this for you.
I'm willing to overlook many weaknesses in PG as we get blistering performance and amazing stability combined with features like hot schema upgrades.