Skip to main content

Posts

Showing posts from December, 2011

make sure pgpool node/instance is up ( with bash script )

--idea--
this idea came to me when some one ask " how do we ensure that postgresql's node has been activated again ? ". by asking google and with have no answer, finally why we don't make a happy script with bash ^_^...

--scenario--
as simple as i love to, this script is run as background service that check node's status every 3 second. And if one of node/both is down, script is automatic bring it UP/ON again.

--1--
must to know  how to chek node status:
*> node UP/ON
$ tail /var/log/pgpool.log 2011-12-22 10:06:18 DEBUG: pid 8726: starting health checking 2011-12-22 10:06:18 DEBUG: pid 8726: health_check: 0 th DB node status: 1 2011-12-22 10:06:18 DEBUG: pid 8726: health_check: 1 th DB node status: 1 $ pcp_node_info 10 localhost 9898 postgres password 1 xxx.xxx.xxx.xxx. xxxx 1 1073741823.500000 $ pcp_node_info 10 localhost 9898 postgres password 1 | awk '{print $3}' 1
*> node Down $ tail /var/log/pgpool.log 2011-12-22 10:14:41 DEBUG: pid 8726: start…