Update pgpool-ha to 3.0 version. PGPOOL_HA_3_0
authorTAKATSUKA Haruka <harukat@sraoss.co.jp>
Sun, 1 May 2016 17:16:43 +0000 (02:16 +0900)
committerTAKATSUKA Haruka <harukat@sraoss.co.jp>
Sun, 1 May 2016 17:16:43 +0000 (02:16 +0900)
    - Abolish some files.
    - Change the install method
    - support pgpool-II 3.5.x
    - rewrite REMADME

COPYING
ChangeLog
README.md
pgpool.in

diff --git a/COPYING b/COPYING
index a07050762515f28881841b912e1e9e63390302df..e82d56f369dea3f42f0f2f3199b1b28ecdcc6883 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -1,4 +1,4 @@
-Copyright (c) 2006-2012                PgPool Global Development Group
+Copyright (c) 2006-2016                PgPool Global Development Group
 
 Permission to use, copy, modify, and distribute this software and
 its documentation for any purpose and without fee is hereby
index bd08858581161795529308cab0020cbc07a722a9..3b7000b470de7125750907721ac0837bfacf8a72 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016/5/2 release 3.0
+       * Support pgpool-II 3.5.x (especially for pcp_* commands' change)
+       * Abolish configure script, Makefile and other files
+
 2014/4/1 release 2.2
 
 2014/1/28
index 3296c62e6af929ef1f1d4dc33cb8822abe5c1c68..c5158af9966ba7e72a1ad6660bd0b8348c597ed9 100644 (file)
--- a/README.md
+++ b/README.md
+pgpool-ha 3.x
+=============
 
-                              pgpool-ha 2.x
-                    OCF style Resource Agent for pgpool-II
-
+pgpool-ha is an OCF style Resource Agent for pgpool-II.
 
 install
-=======
+-------
+
+ $ su 
+ # install -m 0755 -o root -g root \
+     ./pgpool.in  /usr/lib/ocf/resource.d/heartbeat/pgpool
 
- see "INSTALL"
 
 usage
-=====
+-----
+
+OCF parameters are as below.
+
+### pgpoolconf
+
+Specifies the path of pgpool.conf. (default: /usr/local/etc/pgpool.conf)
+
+### pcpconf
+
+Specifies the path of pcp.conf. (default: empty)
+
+### hbaconf
+
+Specifies the path of pool_hba.conf. (default: empty)
+
+### logfile
+
+Specifies the log output. (default: empty)
+
+You can set a file path for redirection or a program for pipeline processing.
+The value start with "|" is recognized as a program.
+Parameter "-n" is added to pgpool implicitly if some value is set into this.
+The example are as follows:
+
+     "/var/log/pgpool.log"
+     "| logger -t pgpool -p local3.info"
+
+### options
+
+Specifies pgpool's starting options. (default: empty)
+
+"-D" is recommended if pgpool_status file is not in shared space.
+"-n", "-f", "-a" and "-F" shouldn't be included, since these are
+used implicitly by other parameters.
+
+### pgpooluser
+
+Specifies the user to run the pgpool process. (default: postgres)
+
+### checkmethod
+
+Specifies monitoring method. (default: pid)
+
+Possible values are as follows:
+
+     "pid"    check by process existence.
+     "pcp"    check by pcp_node_count command.
+     "psql"   check by psql or pg_isready command.
+
+### checkstring
+
+Specifies the details for the monitoring method.
+This parameter means differently by checkmethod setting.
+
+When checkmetod is "pid", this means pid file path.
+The default value is pid_file_name setting in pgpool.conf.
+
+When checkmetod is "pcp", this means parameters for pcp_nod_count command.
+The default value is "10 localhost 9898 postgres pass".
+"-w -h localhost -p 9898" is a good idea for 3.5.x and later version,
+for the response 'authentication failed' is considered success.
+
+When checkmetod is "psql", this means parameters for psql or other command
+which is specified in psqlcmd parameter.
+The default value is "-U postgres -h localhost -l -p 9999".
+"-U postgres -h localhost -p 9999" is a good idea when you use pg_isready.
+
+### psqlcmd
+
+Specifies the path of psql or pg_isready command.
+
+### pgpoolcmd
+
+Specifies the path of pgpool command.
+
+### pcpnccmd
 
- OCF parameters are as below:
+Specifies the path of pcp_node_count command.
 
-    pgpoolconf   path of pgpool.conf
-                 (default: /usr/local/etc/pgpool.conf)
 
-    pcpconf      path of pcp.conf
+crm samples
+-----------
 
-    hbaconf      path of pool_hba.conf
+simple process check:
 
-    logfile      log file for stdout and stderr redirection;
-                 or a program for log collecting by a pipeline.
-                   (e.g.)
-                   "/var/log/pgpool.log"
-                   "| logger -t pgpool -p local3.info"
+    primitive pgpool ocf:heartbeat:pgpool \
+      params pgpoolconf="/usr/local/pgpool/etc/pgpool.conf" \
+           options="-D"  pgpooluser="postgres" \
+           checkmethod="pid" \
+           pgpoolcmd="/usr/local/pgpool/bin/pgpool" \
+      op start   interval=0s  timeout=60s \
+      op monitor interval=10s timeout=30s \
+      op stop    interval=0s  timeout=60s
 
-    options      pgpool start options (except configuration file options and
-                 -n option for log resirection)
-                   (e.g.)
-                   "--discard-status"
-                   "-D -d"
 
-    pgpooluser   pgpool start user
+using pgpool-II 3.5.x's pcp_node_count:
 
-    checkmethod  monitoring method:
-                   "pid"   process existence check only (default).
-                   "pcp"   check by pcp_node_count command.
-                   "psql"  check by psql command.
+    primitive pgpool ocf:heartbeat:pgpool \
+      params pgpoolconf="/usr/pgpool2-3.5/etc/pgpool.conf" \
+           pcpconf="/usr/pgpool2-3.5/etc/pcp.conf" \
+           options="-D"  pgpooluser="postgres" \
+           checkmethod="pcp" checkstring="-w -h localhost -p 9898" \
+           pgpoolcmd="/usr/pgpool2-3.5/bin/pgpool" \
+           pcpnccmd="/usr/pgpool2-3.5/bin/pcp_node_count" \
+      op start   interval=0s  timeout=60s \
+      op monitor interval=30s timeout=30s \
+      op stop    interval=0s  timeout=60s
 
-                 "pcp" and "psql" methods also check process existence
-                 with pid_file_name parameter in pgpool.conf file.
 
-    checkstring  parameter for monitoring method
-                   checkmetod="pid"  : pidfile
-                    (default: value of pid_file_name parameter in pgpool.conf)
+using pg_isready:
 
-                   checkmetod="pcp"  : parameter string for pcp_node_count
-                    (default: "10 localhost 9898 postgres pass")
+    primitive pgpool pgpool \
+      params pgpoolconf="/etc/pgpool-II-95/pgpool.conf" \
+          pcpconf="/etc/pgpool-II-95/pcp.conf" \
+          options="-D" pgpooluser="postgres" \
+          checkmethod="psql" checkstring="-U postgres -h localhost -p 9999" \
+          pgpoolcmd="/usr/pgpool-9.5/bin/pgpool" \
+          psqlcmd="/usr/pgsql-9.5/bin/pg_isready" \
+      op start   interval=0s  timeout=60s \
+      op monitor interval=30s timeout=30s \
+      op stop    interval=0s  timeout=60s
 
-                   checkmetod="psql" : parameter string for psql
-                    (default: "-U postgres -h localhost -p 9999 -l")
 
 support ML
-==========
+----------
 
  pgpool-general@pgpool.net
 
index 10bc9dc1f752321d537e74a78f4eacf43ae3b49b..0ea4efe596e335cec1274517ccadbda7adbe0bb2 100644 (file)
--- a/pgpool.in
+++ b/pgpool.in
@@ -1,8 +1,8 @@
 #!/bin/bash
 #
-# OCF Resource Agent for pgpool-II 2.x
+# OCF Resource Agent for pgpool-II 3.x
 #
-# Copyright 2012-2013       PgPool Global Development Group 
+# Copyright 2012-2016       PgPool Global Development Group 
 #
 # Permission to use, copy, modify, and distribute this software and
 # its documentation for any purpose and without fee is hereby
@@ -20,7 +20,7 @@
 # OCF parameters are as below
 #
 #    pgpoolconf   path of pgpool.conf
-#                 (default: @_PGPOOL_DIR_@/etc/pgpool.conf)
+#                 (default: /usr/local/etc/pgpool.conf)
 #
 #    pcpconf      path of pcp.conf
 #
@@ -28,7 +28,7 @@
 #
 #    logfile      log file for stdout and stderr redirection;
 #                 or a program for log collecting by a pipeline.
-#                   (e.g.)
+#                 e.g.
 #                   "/var/log/pgpool.log"
 #                   "| logger -t pgpool -p local3.info"
 #
 #    checkmethod  monitoring method:
 #                   "pid"  process existence check only (default).
 #                   "pcp"  check by pcp_node_count command.
-#                   "psql" check by psql command.
+#                   "psql" check by psql or pg_isready command.
 #
-#    checkstring  parameter for monitoring method
+#    checkstring  parameter for the monitoring method
 #                   checkmetod="pid"  : pidfile
 #                      (default: parse from pgpool.conf file)
 #                   checkmetod="pcp"  : parameter string for pcp_node_count
 #                      (default: "10 localhost 9898 postgres pass")
+#                      "-w -h localhost -p 9898" is a good idea for 3.5.x version,
+#                      for the response 'authentication failed' is considered success.
 #                   checkmetod="psql" : parameter string for psql
 #                      (default: "-U postgres -h localhost -l -p 9999")
 #
+#    psqlcmd     path of psql or pg_isready command
+#
+#    pgpoolcmd   path of pgpool command
+#
+#    pcpnccmd    path of pcp_node_count command
 
-VERSION=2.1
+
+VERSION=3.0
 
 ##### Source function library.
 
@@ -60,7 +68,7 @@ VERSION=2.1
 
 ###### Parameter defaults
 
-OCF_RESKEY_pgpoolconf_default="@_PGPOOL_DIR_@/etc/pgpool.conf"
+OCF_RESKEY_pgpoolconf_default="/usr/local/etc/pgpool.conf"
 OCF_RESKEY_pcpconf_default=""
 OCF_RESKEY_hbaconf_default=""
 OCF_RESKEY_logfile_default=""
@@ -68,9 +76,9 @@ OCF_RESKEY_options_default=""
 OCF_RESKEY_pgpooluser_default="postgres"
 OCF_RESKEY_checkmethod_default="pid"
 OCF_RESKEY_checkstring_default=""
-OCF_RESKEY_pgpoolcmd_default=@_PGPOOL_DIR_@/bin/pgpool
-OCF_RESKEY_psqlcmd_default=@_PGSQL_DIR_@/bin/psql
-OCF_RESKEY_pcpnccmd_default=@_PGPOOL_DIR_@/bin/pcp_node_count
+OCF_RESKEY_pgpoolcmd_default=/usr/local/bin/pgpool
+OCF_RESKEY_psqlcmd_default=/usr/local/pgsql/bin/psql
+OCF_RESKEY_pcpnccmd_default=/usr/local/bin/pcp_node_count
 
 : ${OCF_RESKEY_pgpoolconf=${OCF_RESKEY_pgpoolconf_default}}
 : ${OCF_RESKEY_pcpconf=${OCF_RESKEY_pcpconf_default}}
@@ -158,18 +166,19 @@ do_monitor() {
 
 
 do_pcp_check() {
-       ocf_run -q $OCF_RESKEY_pcpnccmd $OCF_RESKEY_checkstring
+       RET=$($OCF_RESKEY_pcpnccmd $OCF_RESKEY_checkstring 2>&1)
        rc=$?
-       if [ $rc -eq 0 ]
-       then
+       if [ $rc -eq 0 ] ; then
                return $OCF_SUCCESS
        else
-               ocf_log err "${OCF_RESOURCE_INSTANCE}: pcp_check fail"
+               if ( echo $RET | head -1 | grep -q 'authentication failed' ) ; then
+                       return $OCF_SUCCESS
+               fi
+               ocf_log err "${OCF_RESOURCE_INSTANCE}: pcp_check fail : ${RET}"
                return $OCF_NOT_RUNNING
        fi
 }
 
-
 do_psql_check() {
        ocf_run -q $OCF_RESKEY_psqlcmd $OCF_RESKEY_checkstring
        rc=$?
@@ -297,8 +306,7 @@ Path to pool_hba.conf of pgpool.
   </parameter>
   <parameter name="logfile" unique="0" required="0">
    <longdesc lang="en">
-pgpool log file for stdout and stderr redirection;
-or a program for log collecting by a pipeline.
+pgpool log file or log processing program.
 (e.g.)
  "/var/log/pgpool.log",
  "| logger -t pgpool -p local3.info"
@@ -352,7 +360,7 @@ pgpool command.
   </parameter>
   <parameter name="psqlcmd" unique="0" required="0">
    <longdesc lang="en">
-psql command.
+psql or pg_isready command.
    </longdesc>
    <shortdesc lang="en">psql command</shortdesc>
    <content type="string" default="$OCF_RESKEY_psqlcmd_default" />