My servers setting:<br><br>Server1 : lb_1, cluster_1<br>Server2 : cluster_2, rep_1<br><br><br>----------------------------------------------------------------------------------------<br>----------------------------------------------------------------------------------------<br>
<br>Load Balance server conf:pglb.conf<br><br><br><Cluster_Server_Info><br> <Host_Name> cluster_1 </Host_Name><br> <Port> 5432 </Port><br>
<Max_Connect> 3 </Max_Connect><br></Cluster_Server_Info><br><Cluster_Server_Info><br> <Host_Name> cluster_2 </Host_Name><br>
<Port> 5432 </Port><br> <Max_Connect> 3 </Max_Connect><br></Cluster_Server_Info><br><br><br><Host_Name> lb_1 </Host_Name><br>
<Backend_Socket_Dir> /tmp </Backend_Socket_Dir><br><Receive_Port> 5433 </Receive_Port><br><Recovery_Port> 6101 </Recovery_Port><br>
<Max_Cluster_Num> 128 </Max_Cluster_Num><br><Use_Connection_Pooling> no </Use_Connection_Pooling><br><LifeCheck_Timeout> 3s </LifeCheck_Timeout><br>
<LifeCheck_Interval> 15s </LifeCheck_Interval><br>#<Connection_Life_Time> 0s </Connection_Life_Time><br><br><Log_File_Info><br> <File_Name> /tmp/pglb.log </File_Name><br>
<File_Size> 1M </File_Size><br> <Rotate> 3 </Rotate><br></Log_File_Info><br><br>-------------------------------------------------------------------------------------------<br>
cluster_1 conf:<br><br><Replicate_Server_Info><br> <Host_Name> rep_1 </Host_Name><br> <Port> 8001 </Port><br>
<Recovery_Port> 8101 </Recovery_Port><br></Replicate_Server_Info><br><br><Host_Name> cluster_1 </Host_Name><br>
<Recovery_Port> 7001 </Recovery_Port><br><Rsync_Path> /usr/bin/rsync </Rsync_Path><br><Rsync_Option> ssh -1 </Rsync_Option><br>
<Rsync_Compress> yes </Rsync_Compress><br><Rsync_Timeout> 10min </Rsync_Timeout><br><Rsync_Bwlimit> 0KB </Rsync_Bwlimit><br>
<Pg_Dump_Path> /usr/bin/pg_dump </Pg_Dump_Path><br>#<Ping_Path> /bin/ping </Ping_Path><br><When_Stand_Alone> read_only </When_Stand_Alone><br>
<Replication_Timeout> 1min </Replication_Timeout><br><LifeCheck_Timeout> 3s </LifeCheck_Timeout><br><LifeCheck_Interval> 11s </LifeCheck_Interval><br>
<br>---------------------------------------------------------------------------------------------<br>---------------------------------------------------------------------------------------------<br>cluster_2 conf:<br><br>
<Replicate_Server_Info><br> <Host_Name> rep_1 </Host_Name><br> <Port> 8001 </Port><br> <Recovery_Port> 8101 </Recovery_Port
><br>
</Replicate_Server_Info><br><br><br><Host_Name> cluster_2 </Host_Name><br><Recovery_Port> 7001 </Recovery_Port><br>
<Rsync_Path> /usr/bin/rsync </Rsync_Path><br><Rsync_Option> ssh -1 </Rsync_Option><br><Rsync_Compress> yes </Rsync_Compress><br>
<Rsync_Timeout> 10min </Rsync_Timeout><br><Rsync_Bwlimit> 0KB </Rsync_Bwlimit><br><Pg_Dump_Path> /usr/bin/pg_dump </Pg_Dump_Path><br>
#<Ping_Path> /bin/ping </Ping_Path><br><When_Stand_Alone> read_only </When_Stand_Alone><br><Replication_Timeout> 1min </Replication_Timeout><br>
<LifeCheck_Timeout> 3s </LifeCheck_Timeout><br><LifeCheck_Interval> 11s </LifeCheck_Interval><br><br><br>----------------------------------------------------------------------------------------------<br>
replicator_1 conf<br><br><Cluster_Server_Info><br> <Host_Name> cluster_1 </Host_Name><br> <Port> 5432 </Port><br>
<Recovery_Port> 7001 </Recovery_Port><br></Cluster_Server_Info><br><Cluster_Server_Info><br> <Host_Name> cluster_2 </Host_Name><br>
<Port> 5432 </Port><br> <Recovery_Port> 7001 </Recovery_Port><br></Cluster_Server_Info><br><br><LoadBalance_Server_Info><br>
<Host_Name> lb_1 </Host_Name><br> <Recovery_Port> 6101 </Recovery_Port><br></LoadBalance_Server_Info><br>
<br><br><Host_Name> rep_1 </Host_Name><br><Replication_Port> 8001 </Replication_Port><br><Recovery_Port> 8101 </Recovery_Port><br>
<RLOG_Port> 8301 </RLOG_Port><br><Response_Mode> normal </Response_Mode><br><Use_Replication_Log> no </Use_Replication_Log><br>
<Replication_Timeout> 1min </Replication_Timeout><br><LifeCheck_Timeout> 3s </LifeCheck_Timeout><br><LifeCheck_Interval> 15s </LifeCheck_Interval><br>
<br><Log_File_Info><br> <File_Name> /tmp/pgreplicate.log </File_Name><br> <File_Size> 1M </File_Size><br> <Rotate> 3 </Rotate><br>
</Log_File_Info><br><br>---------------------------------------------------------------------------------------------------<br><br><br><br>I just configured like this.<br>And my index.php has pg_connect(host=cluter_1's full dns port = 5432 dbname=database user=user)<br>
and I stopped the database in cluster_1.<br>And try to connect to database in cluster_2 through index.php.<br>But I can't.<br><br>I think load balance server should have that request and find out the cluster_1 is down and sepearate and use database 2 from cluster_2.<br>
<br>And I set log file like the above but nothing is written there. <br><br>Am I missing something?<br><br>thanks,<br><br><br><br><div class="gmail_quote">On Wed, May 28, 2008 at 10:30 PM, <<a href="mailto:mitani@sraw.co.jp">mitani@sraw.co.jp</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
<br>
The load balncer has current session numbers of each cluster db.<br>
The maximum session number of each cluster db is defined in "pglb.conf".<br>
Then, load balancer consider the load as "(connected sessions)/(max sessions)".<br>
It is consider neither connecting times nor cpu load.<br>
It is using just number of sessions.<br>
<br>
About the pg_connect error.<br>
Can you let us know the debug messages of replication server.<br>
Probably, we can find something in the debug log.<br>
<br>
Regards,<br>
--------------<br>
At.Mitani<br>
<div class="Ih2E3d"><br>
-- original message --<br>
From: Chahyeon Rhee<<a href="mailto:rchyeon@gmail.com">rchyeon@gmail.com</a>><br>
To: <<a href="mailto:pgcluster-general@pgfoundry.org">pgcluster-general@pgfoundry.org</a>><br>
Sent: Wed, 28 May 2008 17:03:31 -0600<br>
Subject: [Pgcluster-general] concept of load balance server<br>
<br>
>Hi!<br>
>I am setting up load balance and cluster db1 in server 1<br>
>and replicator and cluster db2 in server 2.<br>
>I just tested replication and restoration.<br>
>Now, I would like to test load balance. But, I am little bit confused.<br>
>What I am thinking is that I think if client request some then they will go<br>
>to some page in server 1.<br>
>Which is starting point. So I used pg_connect(host=server1 port=5433 dbname=<br>
>... )<br>
>What I am thinking is if that connection go to load balance server in port<br>
>5433 then load balance server will determine which is lower load from<br>
>server1 and server 2. Server 1 and server 2 has port 5432. And the selected<br>
>database will be used for that service.<br>
>Is that right ?<br>
>If not, please give me any advice.<br>
>Also when I am doing like this, I am getting this error message *<br>
>Warning*: pg_connect()<br>
</div>>[function.pg-connect<<a href="http://seo.gkmc.utah.edu/cha_test/pgcluster/function.pg-connect" target="_blank">http://seo.gkmc.utah.edu/cha_test/pgcluster/function.pg-connect</a>>]:<br>
<div class="Ih2E3d">>Unable to connect to PostgreSQL server: server closed the connection<br>
>unexpectedly This probably means the server terminated abnormally before or<br>
>while processing the request.<br>
><br>
>If you know about this, please give me some help.<br>
><br>
>Thanks,<br>
><br>
</div>>_______________________________________________<br>
>Pgcluster-general mailing list<br>
><a href="mailto:Pgcluster-general@pgfoundry.org">Pgcluster-general@pgfoundry.org</a><br>
><a href="http://pgfoundry.org/mailman/listinfo/pgcluster-general" target="_blank">http://pgfoundry.org/mailman/listinfo/pgcluster-general</a><br>
><br>
<br>
_______________________________________________<br>
Pgcluster-general mailing list<br>
<a href="mailto:Pgcluster-general@pgfoundry.org">Pgcluster-general@pgfoundry.org</a><br>
<a href="http://pgfoundry.org/mailman/listinfo/pgcluster-general" target="_blank">http://pgfoundry.org/mailman/listinfo/pgcluster-general</a><br>
</blockquote></div><br>