I'm currently playing with Pgcluster 1.5.0rc9, which is a multi-master and synchronous replication system that supports load balancing for PostgreSQL. This version is based on PostgreSQL 8.1.4. There's no much documentation i could found, but everything was going smoothly untill i tried to lunch pglb. This daemon must be run on Pgcluster load balancer. I took default config pglb.conf and substituted hostnames with the right ones:
#============================================================
# Load Balance Server configuration file
#-------------------------------------------------------------
# file: pglb.conf
#-------------------------------------------------------------
# This file controls:
# o which hosts are db cluster server
# o which port use connect to db cluster server
# o how many connections are allowed on each DB server
#============================================================
#-------------------------------------------------------------
# set cluster DB server information
# o Host_Name : hostname of Cluster DB
# -- please write a host name by FQDN or IP address.
# o Port : connection for postmaster
# o Max_Connection : maximun number of connection to postmaster
#-------------------------------------------------------------
<Cluster_Server_Info>
<Host_Name> n1.example.com </Host_Name>
<Port> 5432 </Port>
<Max_Connect> 0 </Max_Connect>
</Cluster_Server_Info>
<Cluster_Server_Info>
<Host_Name> n2.example.com </Host_Name>
<Port> 5432 </Port>
<Max_Connect> 0 </Max_Connect>
</Cluster_Server_Info>
#-------------------------------------------------------------
# set Load Balance server information
# o Host_Name : The host name of this load balance server.
# -- please write a host name by FQDN or IP address.
# o Backend_Socket_Dir : Unix domain socket path for the backend
# o Receive_Port : connection from client
# o Recovery_Port : connection for recovery process
# o Max_Cluster_Num : maximun number of cluster DB servers
# o Use_Connection_Pooling : use connection pool [yes/no]
#-------------------------------------------------------------
<Host_Name> b.example.com </Host_Name>
<Backend_Socket_Dir> /tmp </Backend_Socket_Dir>
<Receive_Port> 5432 </Receive_Port>
<Recovery_Port> 6001 </Recovery_Port>
<Max_Cluster_Num> 128 </Max_Cluster_Num>
<Use_Connection_Pooling> yes </Use_Connection_Pooling>
Configuration looked ok, but pglb failed to run:
2006-10-25 12:40:47 [5272] DEBUG:PGRset_status_on_cluster_tbl():host:n1.example.com port:5432 max:0 use:0 status2 2006-10-25 12:40:47 [5272] DEBUG:PGRset_status_on_cluster_tbl():host:n2.example.com port:5432 max:0 use:0 status2 2006-10-25 12:40:47 [5272] DEBUG:init_pglb():Child_Tbl size is[0] 2006-10-25 12:40:47 [5272] ERROR:init_pglb():ChildShm shmget() failed. (Invalid argument)
The reason of this was Max_Connect directive. In the config sample it was set to 0. And i thought that 0 in this context might mean unlimited number of connections to this node. But now it seems it meant something different. After i changed 0's to some other positive values, it began to work.









