Slony-I works very well. I've used it for pre-9.0 versions of Postgres with somewhat big databases (> 60 GB, several tables with over 60 million rows) and with lots of concurrent read and writes and it could handle them without problems. Slony modifies your schema and adds triggers to all the tables that are to be replicated. It is a bit write-heavy, as it accumulates all the changes in tables in its own schema and then ships them to the slave servers.<div>
<br></div><div>To take advantage of the fact that you multiple database servers, Zotonic would need to be able to write to the master server and read from all the servers (master and slaves). I don't think it can do that yet.<br>
<div><br><div>I probably shouldn't even mention it, but make sure that all the tables have primary indexes. Slony will not be able to replicate a table without that. Regrettably, I've seen several cases of people not using primary keys as an "optimization" to avoid the cost of the primary key index (when dealing with very large tables every byte counts). Slony can compensate that by adding its own primary key, but once you do that your schema and Slony become tied at the hip.<div>
<br></div><div>Replication is one of the features that are made much easier (even trivial) by several NoSQL databases (CouchDB and Riak are prime examples).</div><div><br></div><div>Hope this helps.</div><div><br></div><div>
Juanjo</div><div><br><div><br><div class="gmail_quote">On Fri, Oct 14, 2011 at 11:40 AM, Barco You <span dir="ltr"><<a href="mailto:barcojie@gmail.com">barcojie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<p>Hi Michael,</p>
<p>Thank you very much for your great suggestion. I've been actually also thinking of using nginx, but dont know slony and pgpool. I will try them. Thank you very much!</p>
<p>Best regards,<br><font color="#888888">
Barco</font></p><div><div></div><div class="h5">
<div class="gmail_quote">On Oct 14, 2011 5:48 PM, "Michael Connors" <<a href="mailto:connorsml@gmail.com" target="_blank">connorsml@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi Barco,<div><br></div><div>I have spent sometime thinking about this, but I have not actually needed to do it yet. </div><div><br></div><div>If I was attempting to do it, I would probably be using the following tools.<br>


<div><br></div><div>You could put Zotonic behind nginx and use nginx as a load balancer with sticky sessions, so that the user gets sent to the site that has their session. </div><div><br></div><div>You could replicate Postgresql using Slony so you have your database distributed, and use pgpool to ensue that all writes go to the master database and all reads come from the local database.</div>


<div><br></div><div>You could replicate the images and other files using rsync.</div><div><br></div><div><a href="http://nginx.org/" target="_blank">http://nginx.org/</a></div><div><a href="http://slony.info/" target="_blank">http://slony.info/</a></div>


<div><a href="http://pgpool.projects.postgresql.org/" target="_blank">http://pgpool.projects.postgresql.org/</a></div></div><div><br></div><div>Michael</div>
</blockquote></div>
</div></div><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div></div></div></div></div>