Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm learning how to create a fast postgresql cluster to a web app in my job. I already know it's possible to create a tablespace on a virtual disk 1 2 3, mounted with ramfs or tmpfs, so my idea is:

  • One or more masters are only used for writes. They're persistent on (physical) disk
  • All slaves are mounted on RAM. If it fails because of, for example, an OS crash, no problem, because they're only used for reads.

Considering regular cache (memcached, redis, that kind of cache) isn't enough for our demand, because we need really fast reads with all features PSQL provides, how can I make this architecture reliable? Is there any better idea?

My current idea is create a master-cluster managed by heartbeat, to easy error recovering, and create a script that mounts the disk on ram, downloads the most recent dump and creates the database on it.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

you haven't really said how you are replicating the data, and there are so many replication solutions out there....

In general, my view is that with streaming replication you really want your slaves to be identical to the masters in as many was as possible. Failing back is not a simple process and it requires restoring, effectively, the primary with a backup made from the slave. For this reason it is good to plan on having an ability to be without your preferred master for a while or even be able to fail back and forth with neither node being preferred in that role.

Your best bet is to have these to be identical and to scale reads by adding more slaves.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.