pgpool2.git / summary / log / commit / refs

commit    893f009e91da28adbbebf0b6c82de6dc48cf78ca
Author:   Nozomi Anzai <anzai@sraoss.co.jp>
Date:     Wed Jul 24 06:56:56 2013 +0000

    Add the description about pgpool.pg_ctl.
    Some visual improvements.


doc/pgpool-en.html | 1371 +++++++++++++++++++++++++++------------------------- doc/pgpool-ja.html | 1139 +++++++++++++++++++++++-------------------- doc/pgpool.css | 21 + 3 files changed, 1327 insertions(+), 1204 deletions(-) diff --git a/doc/pgpool-en.html b/doc/pgpool-en.html index 88fb881f8..265c69323 100644 --- a/doc/pgpool-en.html +++ b/doc/pgpool-en.html @@ -37,9 +37,9 @@ Last modified: Tue Jul 23 08:04:32 JST 2013 <li><a href="#backup">Backup</a></li> <li><a href="#deploy">Deploying pgpool-II</a></li> <li><a href="#watchdog">Watchdog</a></li> + <li><a href="#pcp_command">PCP commands</a></li> <li><a href="#troubleshooting">Troubleshooting</a></li> <li><a href="#restriction">Restrictions</a></li> - <li><a href="#reference">References</a></li> <li><a href="#internal">internal</a></li> </ul> </div> @@ -123,9 +123,9 @@ See <a href="#restriction">Restrictions</a> for more details.</strong> <h1>License<a name="license"></a></h1> +<p>Copyright (c) 2003-2013 PgPool Global Development Group</p> +<p><br></p> <p> -Copyright (c) 2003-2013 PgPool Global Development Group - Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all @@ -180,8 +180,10 @@ pgpool-II's source code can be downloaded from: make. Also, pgpool-II links with the libpq library, so the libpq library and its development headers must be installed on the machine used to build pgpool-II. Additionally the OpenSSL library and its development headers must be present in order to -enable OpenSSL support in pgpool-II</p> +enable OpenSSL support in pgpool-II.</p> + +<h2 id="install_pgpool">Installing pgpool-II</h2> <dl> <dt>configure</dt> <dd> @@ -230,76 +232,93 @@ make install will install pgpool-II. (If you use Solaris or FreeBSD, replace make with gmake) </p> </dd> +</dl> + +<h2 id="install_functions">Installing functions</h2> + +<h3>Installing pgpool_regclass (recommended) <span class="version">V3.0 -</span></h3> +<p> +If you are using PostgreSQL 8.0 or later, installing pgpool_regclass function on all PostgreSQL +to be accessed by pgpool-II is strongly recommended, as it is used internally by pgpool-II. +Without this, handling of duplicate table names in different schema +might cause trouble (temporary tables aren't a problem). +</p> -<dt>Installing pgpool_regclass <span class="version">V3.0 -</span></dt> - <dd> - <p> - If you are using PostgreSQL 8.0 or later, installing pgpool_regclass function on all PostgreSQL - to be accessed by pgpool-II is strongly recommended, as it is used internally by pgpool-II. - Without this, handling of duplicate table names in different schema - might cause trouble (temporary tables aren't a problem). - </p> - <p> <pre> -cd pgpool-II-x.x.x/sql/pgpool-regclass -make -make install +$ cd pgpool-II-x.x.x/sql/pgpool-regclass +$ make +$ make install </pre> - </p> - <p> -After this: - <p> + +<p>After this:<p> <pre> -psql -f pgpool-regclass.sql template1 +$ psql -f pgpool-regclass.sql template1 </pre> - </p> - <p> -or - <p> + +<p>or<p> + <pre> -psql template1 -CREATE EXTENSION pgpool_regclass; +$ psql template1 +=# CREATE EXTENSION pgpool_regclass; </pre> </p> - <p> - Executing pgpool-regclass.sql or CREATE EXTENSION should be performed on every databases accessed - with pgpool-II. - You do not need to do this for a database created after the - execution of "psql -f pgpool-regclass.sql template1" or CREATE EXTENSION, as this template database - will be cloned to create new databases. - </p> - </dd> +<p> +Executing pgpool-regclass.sql or <code>CREATE EXTENSION</code> should be performed on every databases accessed +with pgpool-II. +You do not need to do this for a database created after the +execution of "<code>psql -f pgpool-regclass.sql template1</code>" or <code>CREATE EXTENSION</code>, +as this template database will be cloned to create new databases. +</p> + +<h3>Creating insert_lock table <span class="version">V3.0 -</span></h3> +<p> +If you use insert_lock in replication mode, creating pgpool_catalog.insert_lock +table for mutual exclusion is strongly recommended. +Without this, insert_lock works so far. However in that case pgpool-II locks +against the insert target table. This behavior is same as pgpool-II 2.2 and 2.3 +series. The table lock conflicts with VACUUM. So INSERT processing may be thereby +kept waiting for a long time. +</p> -<dt>Creating insert_lock table <span class="version">V3.0 -</span></dt> - <dd> - <p> - If you use insert_lock in replication mode, creating pgpool_catalog.insert_lock - table for mutual exclusion is strongly recommended. - Without this, insert_lock works so far. However in that case pgpool-II locks - against the insert target table. This behavior is same as pgpool-II 2.2 and 2.3 - series. The table lock conflicts with VACUUM. So INSERT processing may be thereby - kept waiting for a long time. - </p> <pre> -cd pgpool-II-x.x.x/sql -psql -f insert_lock.sql template1 +$ cd pgpool-II-x.x.x/sql +$ psql -f insert_lock.sql template1 </pre> - <p> - Executing insert_lock.sql should be performed on every databases accessed - with pgpool-II. - You do not need to do this for a database created after the execution of - &quot;psql -f insert_lock.sql template1&quot;, as this template database will be - cloned to create new databases. - </p> - </dd> -</dl> <p> -Installing is done. If you are using Solaris or FreeBSD, -you need to replace "make" with "gmake" in the above description -because those operating systems requires GNU make. +Executing insert_lock.sql should be performed on every databases accessed +with pgpool-II. +You do not need to do this for a database created after the execution of +"<code>psql -f insert_lock.sql template1</code>", as this template database will be +cloned to create new databases. </p> +<h3>Installing pgpool_recovery</h3> + +<p>If you use <a href="#online_recovery_in_stream_mode">online recovery</a>, some functions are needed: +pgpool_recovery, pgpool_remote_start, pgpool_switch_xlog.</p> +<p>And, pgpoolAdmin of the tool to control pgpool-II can stop, restart and reload the backend PostgreSQL nodes, +and it needs the function named pgpool_pgctl.</p> +<p>Here is the way to install there functions.</p> +<pre> +$ cd pgpool-II-x.x.x/sql/pgpool-regclass +$ make +$ make install +$ psql -f pgpool-recovery.sql template1 +</pre> + +<h4>Configuring pgpool.pgctl <span class="version">V3.0 -</span></h4> + +<p>The function pgpool_pgctl executes the value of ppool.pgctl in postgresql.conf as the pg_ctl command. +To use this function, you have to this custom parameter.</p> +<pre> +ex) +$ cat &gt;&gt; /usr/local/pgsql/postgresql.conf +pgpool.pg_ctl = '/usr/local/pgsql/bin/pg_ctl' + +$ pg_ctl reload -D /usr/local/pgsql/data +</pre> + <p class="top_link"><a href="#Top">back to top</a></p> <!-- ================================================================================ --> @@ -4384,140 +4403,568 @@ down before a down notification packet is sent to other pgpool-IIs. <!-- ================================================================================ --> -<h1><a name="troubleshooting"></a>Troubleshooting</h1> -<p> -This section describes problems and their workarounds while you are using -pgpool-II. -</p> +<h1 id="pcp_command">PCP Commands</h1> -<dl> +<h2>PCP commands list</h2> +<p>PCP commands are UNIX commands which manipulate pgpool-II via the network. -<dt id="health_check_failed">Health check failed</dt> - <dd> - <p> - Pgpool-II's health checking feature detects DB nodes failure. - </p> +<table border> +<tr><th><a href="#pcp_node_count">pcp_node_count</a></th> + <td>retrieves the number of nodes</td></tr> +<tr><th><a href="#pcp_node_info">pcp_node_info</a></th> + <td>retrieves the node information</td></tr> +<tr><th><a href="#pcp_watchdog_info">pcp_watchdog_info</a> <span class="version">V3.3 -</span></th> + <td>retrieves the watchdog information</td></tr> +<tr><th><a href="#pcp_proc_count">pcp_proc_count</a></th> + <td>retrieves the process list</td></tr> +<tr><th><a href="#pcp_proc_info">pcp_proc_info</a></th> + <td>retrieves the process information</td></tr> +<tr><th><a href="#pcp_pool_status ">pcp_pool_status</a> <span class="version">V3.1 -</span></th> + <td>retrieves parameters in pgpool.conf</td></tr> +<tr><th><a href="#pcp_systemdb_info">pcp_systemdb_info</a></th> + <td>retrieves the System DB information</td></tr> +<tr><th><a href="#pcp_detach_node">pcp_detach_node</a></th> + <td>detaches a node from pgpool-II</td></tr> +<tr><th><a href="#pcp_attach_node">pcp_attach_node</a></th> + <td>attaches a node to pgpool-II</td></tr> +<tr><th><a href="#pcp_promote_node">pcp_promote_node</a> <span class="version">V3.1 -</span></th> + <td>promote a new master node to pgpool-II</td></tr> +<tr><th><a href="#pcp_stop_pgpool">pcp_stop_pgpool</a></th> + <td>stops pgpool-II</td></tr> +</table> + + +<h2 id="pcp_comand_args">Common Command-line Arguments</h2> + +<p>There are five arguments common to all of the PCP commands. They +give information about pgpool-II and authentication. Extra +arguments may be needed for some commands. <pre> -2010-07-23 16:42:57 ERROR: pid 20031: health check failed. 1 th host foo at port 5432 is down -2010-07-23 16:42:57 LOG: pid 20031: set 1 th backend down status -2010-07-23 16:42:57 LOG: pid 20031: starting degeneration. shutdown host foo(5432) -2010-07-23 16:42:58 LOG: pid 20031: failover_handler: set new master node: 0 -2010-07-23 16:42:58 LOG: pid 20031: failover done. shutdown host foo(5432) +e.g.) $ pcp_node_count 10 localhost 9898 postgres hogehoge </pre> - <p> - The log shows that the DB node 1 (host foo) goes down and disconnected (shutdown) - from pgpool, and then that DB node 0 becomes new master. - Check DB node 1 and remove the cause of failure. After that perform an online - recovery against DB node 1 if possible. - </p> - </dd> +<table border> +<tr> +<th>First argument</th> +<td>timeout value in seconds. PCP disconnects if pgpool-II does not respond in this many seconds.</td> +</tr> +<tr><th>Second argument</th><td>pgpool-II's hostname</td></tr> +<tr><th>Third argument</th><td>PCP port number</td></tr> +<tr><th>Fourth argument</th><td>PCP user name</td></tr> +<tr><th>Fifth argument</th><td>PCP password</td></tr> +</table> -<dt id="failed_to_read_kind_from_frontend">Failed to read kind from frontend</dt> - <dd> +<p>PCP user names and passwords must be declared in +<code>pcp.conf</code> in <code>$prefix/etc</code> +directory. <code>-F</code> option can be used when starting pgpool-II +if <code>pcp.conf</code> is placed somewhere else. The password does +not need to be in md5 format when passing it to the PCP commands.</p> + + +<h2>PCP Commands to know status and configuration</h2> + +<p>All PCP commands display the results to the standard output.</p> + + +<h3 id="pcp_node_count">pcp_node_count</h3> + +<dl class="flat"> +<dt>Format</dt> +<dd> +<code>pcp_node_count _timeout_ _host_ _port_ _userid_ _passwd_</code> +</dd> +<dt>Desc.</dt> +<dd> +Displays the total number of nodes defined in <code>pgpool.conf</code>. It does +not distinguish between nodes status, ie attached/detached. ALL nodes are counted. +</dd> +</dl> + +<h3><a name="pcp_node_info"/></a>pcp_node_info</h3> + +<dl class="flat"> +<dt>Format</dt> +<dd><code>pcp_node_info _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_</code></dd> +<dt>Desc.</dt> +<dd> +<p>Displays the information on the given node ID. Here is an output example:</p> <pre> -2010-07-26 18:43:24 LOG: pid 24161: ProcessFrontendResponse: failed to read kind from frontend. frontend abnormally exited +$ pcp_node_info 10 localhost 9898 postgres hogehoge 0 +host1 5432 1 1073741823.500000 </pre> - <p> - This log indicates that the frontend program didn't disconnect properly from - pgpool-II. - The possible causes are: bugs of client applications, forced termination (kill) - of a client application, or temporary network failure. - This kind of events don't lead to a DB destruction or data consistency problem. - It's only a warning about a protocol violation. - It is advised that you check the applications and networks if the - message keeps on occurring. - </p> - </dd> -<dt id="kind_mismatch">Kind mismatch errors</dt> - <dd> - <p> - It is possible that you get this error when pgpool-II operates in replication mode. - </p> +<p>The result is in the following order:</p> +<ul> +<li>1. hostname</li> +<li>2. port number</li> +<li>3. status</li> +<li>4. load balance weight</li> +</ul> + +<p>Status is represented by a digit from [0 to 3].</p> +<ul> +<li>0 - This state is only used during the initialization. PCP will never display it.</li> +<li>1 - Node is up. No connections yet.</li> +<li>2 - Node is up. Connections are pooled.</li> +<li>3 - Node is down.</li> +</ul> +<p>The load balance weight is displayed in normalized format.</p> + +<p>The <code>--verbose</code> option can help understand the output. For example:</p> + <pre> -2010-07-22 14:18:32 ERROR: pid 9966: kind mismatch among backends. Possible last query was: "FETCH ALL FROM c;" kind details are: 0[T] 1[E: cursor "c" does not exist] +$ pcp_node_info --verbose 10 localhost 9898 postgres hogehoge 0 +Hostname: host1 +Port : 5432 +Status : 1 +Weight : 0.5 </pre> - <p> - Pgpool-II waits for responses from the DB nodes after sending an SQL command to them. - This message indicates that not all DB nodes returned the same kind of response. - You'll get the SQL statement which possibly caused the error after "Possible last query was:". - Then the kind of response follows. If the response indicates an error, the - error message from PostgreSQL is shown. - Here you see "0[T]" displaying the DB node responses: "0[T]" - (starting to send row description), and "1[E" indicates that DB node 1 returns an error - with message "cursor "c" does not exist", while DB node 0 sends a row description. - </p> - <p> - Caution: You will see this error when operating in master/slave mode as well. - For example, even in the master/slave mode, SET command will be basically sent to all DB nodes - to keep all the DB nodes in the same state. - </p> - <p> - Check the databases and re-sync them using online recovery if you find - that they are out of sync. - </p> - </dd> -<dt id="difference_of_number">Pgpool detected difference of the number of inserted, updated or deleted tuples - <dd> - <p> - In replication mode, pgpool-II detects a different number of - INSERT/UPDATE/DELETE rows on affected nodes. - </p> +<p>Specifying an invalid node ID will result in an error with <a href="#exit_status">exit status 12</a>, +and BackendError will be displayed.</p> +</dd> +</dl> + +<h3><a name="pcp_watchdog_info"/></a>pcp_watchdog_info <span class="version">V3.3 -</span></h3> + +<dl class="flat"> +<dt>Format</dt> +<dd><code>pcp_watchdog_info _timeout_ _host_ _port_ _userid_ _passwd_ [_watchdogid_]</code></dd> +<dt>Desc.</dt> +<p>Displays the watchdog status of the pgpool-II. +_watchdogid_ is the index of other_pgpool_hostname parameter in pgpool.conf.</p> +<p>If this is omitted, display the watchdog status of the pgpool-II specified by _host_:_port_.</p> + +<p>Here is an output example:</p> + <pre> -2010-07-22 11:49:28 ERROR: pid 30710: pgpool detected difference of the number of inserted, updated or deleted tuples. Possible last query was: "update t1 set i = 1;" -2010-07-22 11:49:28 LOG: pid 30710: ReadyForQuery: Degenerate backends: 1 -2010-07-22 11:49:28 LOG: pid 30710: ReadyForQuery: Affected tuples are: 0 1 +$ pcp_watchdog_info 10 localhost 9898 postgres hogehoge 0 +host1 9999 9000 2 +Here is an output example: </pre> - <p> - In the example above, the returned number of updated rows by "update t1 set i = 1" - was different among DB nodes. - The next line indicates that DB 1 got degenerated (disconnected) as a consequence, - and that the number of affected rows for DB node 0 was 0, - while for DB node 1 that was 1. - </p> - <p> - Stop the DB node which is suspected of having wrong data and do an online recovery. - </p> - </dd> -</dl> -<p class="top_link"><a href="#Top">back to top</a></p> +<p>The result is in the following order:</p> +<ul> +<li>1. hostname</li> +<li>2. port number for pgpool-II</li> +<li>3. port number for watchdog</li> +<li>4. watchdog Status</li> +</ul> +<p>Status is represented by a digit from [1 to 4].</p> +<ul> +<li>1 - watchdog is not started</li> +<li>2 - Standby: not holding the virtual IP</li> +<li>3 - Active: holding the virtual IP</li> +<li>4 - Down</li> +</ul> +<p>The load balance weight is displayed in normalized format.</p> -<!-- ================================================================================ --> +<p>Specifying an invalid watchdog ID will result in an error with <a href="#exit_status">exit tatus 12</a>, +and BackendError will be displayed.</p> +</dl> -<h1>Restrictions<a name="restriction"></a></h1> +<h3 id="pcp_proc_count">pcp_proc_count</h3> +<dl class="flat"> +<dt>Format</dt> +<dd><code>pcp_proc_count _timeout_ _host_ _port_ _userid_ _passwd_</code></dd> +<dt>Desc.</dt> +<dd> +Displays the list of pgpool-II children process IDs. If there is more than +one process, IDs will be delimited by a white space. +</dd> +</dl> + +<h3 id="pcp_proc_info">pcp_proc_info</h3> +<dl class="flat"> +<dt>Format</dt> +<dd><code>pcp_proc_info _timeout_ _host_ _port_ _userid_ _passwd_ _processid_</code></dd> +<dt>Desc.</dt> <p> -<h2>Functionality of PostgreSQL</h2> -<p> +Displays the information on the given pgpool-II child process ID. The +output example is as follows: +</p> +<pre> +$ pcp_proc_info 10 localhost 9898 postgres hogehoge 3815 +postgres_db postgres 1150769932 1150767351 3 0 1 1467 1 +postgres_db postgres 1150769932 1150767351 3 0 1 1468 1 +</pre> + +<p>The result is in the following order:</p> <ul> -<li>If you use pg_terminate_backend() to stop a backend, this will trigger - a failover. - The reason why this happens is that PostgreSQL sends exactly the same - message for a terminated backend as for a full postmaster shutdown. - There is no workaround as of today. Please do not use this function. -</li> +<li>1. connected database name</li> +<li>2. connected user name</li> +<li>3. process start-up timestamp</li> +<li>4. connection created timestamp</li> +<li>5. protocol major version</li> +<li>6. protocol minor version</li> +<li>7. connection-reuse counter</li> +<li>8. PostgreSQL backend process id</li> +<li>9. 1 if frontend conncted 0 if not</li> </ul> <p> -<h2><a name="md5"></a>Authentication / Access Controls</h2> +If there is no connection to the backends, nothing will be +displayed. If there are multiple connections, one connection's +information will be displayed on each line multiple +times. Timestamps are displayed in EPOCH format. +</p> <p> -<ul> - <li>In the replication mode or master/slave mode, trust, clear text password, - and pam methods are supported. md5 in also supported since pgpool-II 3.0. - md5 is supported by using a authencitaion file ("pool_passwd"). - "pool_passwd" is default name of the authentication file. - You can change the file name using <a href="#POOL_PASSWD">pool_passwd</a>. - Here are the steps to enable md5 authentication: - <ol> - <li>Login as the database's operating system user and type - "pg_md5 --md5auth --username=<your_username> <your_passwd>" - user name and md5 encrypted password are registered into pool_passwd. +The </code>--verbose</code> option can help understand the output. For example: +</p> + +<pre> +$ pcp_proc_info --verbose 10 localhost 9898 postgres hogehoge 3815 +Database : postgres_db +Username : postgres +Start time : 1150769932 +Creation time: 1150767351 +Major : 3 +Minor : 0 +Counter : 1 +PID : 1467 +Connected : 1 +Database : postgres_db +Username : postgres +Start time : 1150769932 +Creation time: 1150767351 +Major : 3 +Minor : 0 +Counter : 1 +PID : 1468 +Connected : 1 +</pre> + +<p>Specifying an invalid node ID will result in an error with <a href="#exit_status">exit status 12</a>, +and BackendError will be displayed.</p> +</dl> + +<h3 id="pcp_pool_status">pcp_pool_status <span class="version">V3.1 -</span></h3> +<dl class="flat"> +<dt>Format</dt> +<dd><code>pcp_pool_status _timeout_ _host_ _port_ _userid_ _passwd_</code></dd> +<dt>Desc.</dt> +<dd> +<p>Displays parameters in pgpool.conf. The output example is as follows:</p> +<pre> +$ pcp_pool_status 10 localhost 9898 postgres hogehoge +name : listen_addresses +value: localhost +desc : host name(s) or IP address(es) to listen to + +name : port +value: 9999 +desc : pgpool accepting port number + +name : socket_dir +value: /tmp +desc : pgpool socket directory + +name : pcp_port +value: 9898 +desc : PCP port # to bind +</pre> +</dd> +</dl> + +<h3 id="pcp_systemdb_info">pcp_systemdb_info</h3> + +<dl class="flat"> +<dt>Format</dt> +<dd><code>pcp_systemdb_info _timeout_ _host_ _port_ _userid_ _passwd_</code></dd> +<dt>Desc.</dt> +<dd> +<p>Displays the System DB information. The output example is as follows:</p> +<pre> +$ pcp_systemdb_info 10 localhost 9898 postgres hogehoge +localhost 5432 yamaguti '' pgpool_catalog pgpool 3 +yamaguti public accounts aid 4 aid bid abalance filler integer integer integer character(84) dist_def_accounts +yamaguti public branches bid 3 bid bbalance filler integer integer character(84) dist_def_branches +yamaguti public tellers bid 4 tid bid tbalance filler integer integer integer character(84) dist_def_tellers +</pre> + +<p>First, the System DB information will be displayed on the first line. +The result is in the following order:</p> +<ul> +<li>1. hostname</li> +<li>2. port number</li> +<li>3. user name</li> +<li>4. password. '' for no password.</li> +<li>5. schema name</li> +<li>6. database name</li> +<li>7. number of partioning rules defined</li> +</ul> + +<p> +Second, partitioning rules will be displayed on the following lines. If +there are multiple definitions, one definition will be displayed on +each line multiple times. The result is in the following order: +</p> +<ul> +<li>1. targeted partitioning database name</li> +<li>2. targeted partitioning schema name</li> +<li>3. targeted partitioning table name</li> +<li>4. partitioning key column name</li> +<li>5. number of columns in the targeted table</li> +<li>6. column names (displayed as many as said in 5.)</li> +<li>7. column types (displayed as many as said in 5.)</li> +<li>8. partitioning rule function name</li> +</ul> +<p> +If the System DB is not defined (i.e. not in pgpool-II mode, and query +cache is disabled), it results in error with <a href="#exit_status">exit status 12</a>, and +BackendError will be displayed.</p> + +</dd> +</dl> + +<h2>PCP Commands to control backend nodes, etc.</h2> + +<h3 id="pcp_detach_node">pcp_detach_node</h3> + +<dl class="flat"> +<dt>Format</dt> +<dd><code>pcp_detach_node [-g] _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_</code></dd> +<dt>Desc.</dt> +<dd> +<p> +Detaches the given node from pgpool-II. +If -g is given, wait until all clients are disconnected (unless +client_idle_limit_in_recovery is -1 or recovery_timeout is expired). +</p> +</dd> +</dl> + + +<h3 id="pcp_attach_node">pcp_attach_node</h3> +<dl class="flat"> +<dt>Format</dt> +<dd><code>pcp_attach_node _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_</code></dd> +<dt>Desc.</dt> +<dd><p>Attaches the given node to pgpool-II.</p></dd> +</dl> + +<h3 id="pcp_promote_node">pcp_promote_node <span class="version">V3.1 -</span></h3> + +<dl class="flat"> +<dt>Format</dt> +<dd><code>pcp_promote_node [-g] _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_</code></dd> +<dt>Desc.</dt> +<dd> +<p> +Promotes the given node as new master to pgpool-II. In master/slave streaming replication only. +If -g is given, wait until all clients are disconnected (unless +client_idle_limit_in_recovery is -1 or recovery_timeout is expired). +</p> +</dd> +</dl> + +<h3 id="pcp_stop_pgpool">pcp_stop_pgpool</h3> +<dl class="flat"> +<dt>Format:</dt> +<dd><code>pcp_stop_pgpool _timeout_ _host_ _port_ _userid_ _passwd_ _mode_</code></dd> +<dt>Desc.</dt> +<dd> +<p>Terminate the pgpool-II process with the given shutdown mode. The available modes are as follows:</p> +<ul> +<li>s - smart mode</li> +<li>f - fast mode</li> +<li>i - immediate mode</li> +</ul> +<p> +If the pgpool-II process does not exist, it results in error with <a href="#exit_status">exit status 8</a>, +and ConnectionError will be displayed. +</p> +<p> +* Currently, there is no difference between the fast and immediate +mode. pgpool-II terminates all the processes whether there are clients +connected to the backends or not.</p> +</dd> +</dl> + +<h3 id="pcp_recovery_node">pcp_recovery_node</h3> +<dl class="flat"> +<dt>Formet</dt> +<dd><code>pcp_recovery_node _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_</code></dd> +<dt>Desc.</dt> +<dd>Attaches the given backend node with recovery.</dd> +</dl> + +<h2 id="exit_status">Exit Status</h2> + +<p>PCP commands exits with status 0 when everything goes well. If any +error had occurred, it will exit with the following error status. + +<table border> +<tr><th>UNKNOWNERR</th> + <td>1</td><td>Unknown Error (should not occur)</td></tr> +<tr><th>EOFERR</th> + <td>2</td><td>EOF Error</td></tr> +<tr><th>NOMEMERR</th> + <td>3</td><td>Memory shortage</td></tr> +<tr><th>READERR</th> + <td>4</td><td>Error while reading from the server</td></tr> +<tr><th>WRITEERR</th> + <td>5</td><td>Error while writing to the server</td></tr> +<tr><th>TIMEOUTERR</th> + <td>6</td><td>Timeout</td></tr> +<tr><th>INVALERR</th> + <td>7</td><td>Argument(s) to the PCP command was invalid</td></tr> +<tr><th>CONNERR</th> + <td>8</td><td>Server connection error</td></tr> +<tr><th>NOCONNERR</th> + <td>9</td><td>No connection exists</td></tr> +<tr><th>SOCKERR</th> + <td>10</td><td>Socket error</td></tr> +<tr><th>HOSTERR</th> + <td>11</td><td>Hostname resolution error</td></tr> +<tr><th>BACKENDERR</th> + <td>12</td><td>PCP process error on the server (specifying an invalid ID, etc.)</td></tr> +<tr><th>AUTHERR</th> + <td>13</td><td>Authorization failure</td></tr> +</table> + +<p class="top_link"><a href="#Top">back to top</a></p> + +<!-- ================================================================================ --> + +<h1><a name="troubleshooting"></a>Troubleshooting</h1> +<p> +This section describes problems and their workarounds while you are using +pgpool-II. +</p> + +<dl> + +<dt id="health_check_failed">Health check failed</dt> + <dd> + <p> + Pgpool-II's health checking feature detects DB nodes failure. + </p> + +<pre> +2010-07-23 16:42:57 ERROR: pid 20031: health check failed. 1 th host foo at port 5432 is down +2010-07-23 16:42:57 LOG: pid 20031: set 1 th backend down status +2010-07-23 16:42:57 LOG: pid 20031: starting degeneration. shutdown host foo(5432) +2010-07-23 16:42:58 LOG: pid 20031: failover_handler: set new master node: 0 +2010-07-23 16:42:58 LOG: pid 20031: failover done. shutdown host foo(5432) +</pre> + + <p> + The log shows that the DB node 1 (host foo) goes down and disconnected (shutdown) + from pgpool, and then that DB node 0 becomes new master. + Check DB node 1 and remove the cause of failure. After that perform an online + recovery against DB node 1 if possible. + </p> + </dd> + +<dt id="failed_to_read_kind_from_frontend">Failed to read kind from frontend</dt> + <dd> +<pre> +2010-07-26 18:43:24 LOG: pid 24161: ProcessFrontendResponse: failed to read kind from frontend. frontend abnormally exited +</pre> + <p> + This log indicates that the frontend program didn't disconnect properly from + pgpool-II. + The possible causes are: bugs of client applications, forced termination (kill) + of a client application, or temporary network failure. + This kind of events don't lead to a DB destruction or data consistency problem. + It's only a warning about a protocol violation. + It is advised that you check the applications and networks if the + message keeps on occurring. + </p> + </dd> + +<dt id="kind_mismatch">Kind mismatch errors</dt> + <dd> + <p> + It is possible that you get this error when pgpool-II operates in replication mode. + </p> +<pre> +2010-07-22 14:18:32 ERROR: pid 9966: kind mismatch among backends. Possible last query was: "FETCH ALL FROM c;" kind details are: 0[T] 1[E: cursor "c" does not exist] +</pre> + <p> + Pgpool-II waits for responses from the DB nodes after sending an SQL command to them. + This message indicates that not all DB nodes returned the same kind of response. + You'll get the SQL statement which possibly caused the error after "Possible last query was:". + Then the kind of response follows. If the response indicates an error, the + error message from PostgreSQL is shown. + Here you see "0[T]" displaying the DB node responses: "0[T]" + (starting to send row description), and "1[E" indicates that DB node 1 returns an error + with message "cursor "c" does not exist", while DB node 0 sends a row description. + </p> + <p> + Caution: You will see this error when operating in master/slave mode as well. + For example, even in the master/slave mode, SET command will be basically sent to all DB nodes + to keep all the DB nodes in the same state. + </p> + <p> + Check the databases and re-sync them using online recovery if you find + that they are out of sync. + </p> + </dd> + +<dt id="difference_of_number">Pgpool detected difference of the number of inserted, updated or deleted tuples + <dd> + <p> + In replication mode, pgpool-II detects a different number of + INSERT/UPDATE/DELETE rows on affected nodes. + </p> +<pre> +2010-07-22 11:49:28 ERROR: pid 30710: pgpool detected difference of the number of inserted, updated or deleted tuples. Possible last query was: "update t1 set i = 1;" +2010-07-22 11:49:28 LOG: pid 30710: ReadyForQuery: Degenerate backends: 1 +2010-07-22 11:49:28 LOG: pid 30710: ReadyForQuery: Affected tuples are: 0 1 +</pre> + <p> + In the example above, the returned number of updated rows by "update t1 set i = 1" + was different among DB nodes. + The next line indicates that DB 1 got degenerated (disconnected) as a consequence, + and that the number of affected rows for DB node 0 was 0, + while for DB node 1 that was 1. + </p> + <p> + Stop the DB node which is suspected of having wrong data and do an online recovery. + </p> + </dd> +</dl> + +<p class="top_link"><a href="#Top">back to top</a></p> + + +<!-- ================================================================================ --> + +<h1>Restrictions<a name="restriction"></a></h1> + +<p> +<h2>Functionality of PostgreSQL</h2> +<p> +<ul> +<li>If you use pg_terminate_backend() to stop a backend, this will trigger + a failover. + The reason why this happens is that PostgreSQL sends exactly the same + message for a terminated backend as for a full postmaster shutdown. + There is no workaround as of today. Please do not use this function. +</li> +</ul> + +<p> +<h2><a name="md5"></a>Authentication / Access Controls</h2> + +<p> +<ul> + <li>In the replication mode or master/slave mode, trust, clear text password, + and pam methods are supported. md5 in also supported since pgpool-II 3.0. + md5 is supported by using a authencitaion file ("pool_passwd"). + "pool_passwd" is default name of the authentication file. + You can change the file name using <a href="#POOL_PASSWD">pool_passwd</a>. + Here are the steps to enable md5 authentication: + <ol> + <li>Login as the database's operating system user and type + "pg_md5 --md5auth --username=<your_username> <your_passwd>" + user name and md5 encrypted password are registered into pool_passwd. If pool_passwd does not exist yet, pg_md5 command will automatically create it for you.</li> <li>The format of pool_passwd is "username:encrypted_passwd".</li> @@ -4732,571 +5179,159 @@ SELECT * FROM t ORDER BY a; &lt;-- INSERT above is not visible from this SELECT END; </pre> -<h3 id="ng_view">Views / Rules (for parallel mode)</h3> - -<p> -The same definition will be created on all the backends for views and rules. -</p> - -<pre> -SELECT * FROM a, b where a.i = b.i -</pre> -<p> -<code>JOIN</code>s like above will be executed on each backend, and -then merged with the results returned by each backend. Views and Rules -that join across the nodes cannot be created. -However, to JOIN tables that access data only in the same node, a VIEW can be made. -This VIEW has to be registered in the pgpool_catalog.dist_def table. A col_name and -a dist_def_func will have to be registered too. These are used when an insert is -performed on the view. -</p> - -<h3 id="ng_fuction">Functions / Triggers (for parallel mode)</h3> - -<p>The same definition will be created on all the backends for -functions. Joining across the nodes, and accessing data on the other nodes cannot -be performed inside the functions.</p> - -<h3>Extended Query Protocol (for parallel mode)</h3> - -<p>The extended query protocol used by JDBC drivers, etc. is not -supported. The simple query protocol must be used. This means you cannot use -prepared statements.</p> - -<h3 id="ng_natural_join">Natural Join (for parallel mode)</h3> - -<p>The Natural Join is not supported. -"ON join condition" or "USING (join_column)" must be used.</p> - -<h3 id="ng_extended_protocol">USING CLAUSE (for parallel mode)</h3> - -<p>The USING CLAUSE is converted to an ON CLAUSE by the query rewrite process. -Therefore, when "*" is used at target list, the joined column(s) appear twice.</p> -<p> -Here is an example: -</p> -<pre> -=# SELECT * FROM t1 JOIN t2 USING(id); - id | t | t -----+-----+------- - 1 | 1st | first -(1 row) -</pre> -<p> -In the rewrite process "USING" is translated into "ON". So the -effective result is as follows: -</p> -<pre> -=# SELECT * FROM t1 JOIN t2 ON t1.id = t2.id; - id | t | id | t -----+-----+----+------- - 1 | 1st | 1 | first -(1 row) -</pre> - -<p> -Notice that column "t" is duplicated. -</p> - -<h3 id="ng_multibyte_chars">Multi-byte Characters (for all modes)</h3> - -<p>pgpool-II does not translate between different multi-byte -characters. The encoding for the client, backend and System DB must be -the same.</p> - -<h3 id="ng_multi_statement">Multi-statement Query (for all modes)</h3> -<p> -pgpool-II cannot process multi-statement queries. -</p> - -<h3 id="ng_dead_lock">Deadlocks (for parallel mode)</h3> - -<p>Deadlocks across the backends cannot be detected. For example: -</p> -<pre> -(tellers table is partitioned using the following rule) - tid &lt;= 10 --&gt; node 0 - tid &gt;= 10 --&gt; node 1 - -A) BEGIN; -B) BEGIN; -A) SELECT * FROM tellers WHERE tid = 11 FOR UPDATE; -B) SELECT * FROM tellers WHERE tid = 1 FOR UPDATE; -A) SELECT * FROM tellers WHERE tid = 1 FOR UPDATE; -B) SELECT * FROM tellers WHERE tid = 11 FOR UPDATE; -</pre> -<p> -In the case above, a single node cannot detect the deadlock, so -pgpool-II will wait for the response indefinitely. This phenomenon -can occur with any query that acquires row level locks. -</p> -<p>Also, if a deadlock occurs in one node, transaction states in each -node will not be consistent. Therefore, pgpool-II terminates the -process if a deadlock is detected. -</p> -<pre> -pool_read_kind: kind does not match between master(84) slot[1] (69) -</pre> - -<h3 id="ng_schema">Schemas (for parallel mode)</h3> - -<p>Objects in a schema other than public must be fully qualified like: -</p> -<pre> -schema.object -</pre> -<p> -pgpool-II cannot resolve the correct schema when the path is set as -follows: -</p> -<pre> -set search_path = xxx -</pre> -<p> -and the schema name is omitted in a query. -</p> - -<h3 id="ng_relname">table name - column name(for parallel mode)</h3> -<p> -Limitation object:Parallel mode -</p> -<p> -A table or a column name cannot start by pool_. -When rewriting queries, these names are used by internal processing. -</p> - -<h2 id="caution_system_db">System DB</h2> - -<h3>Partitioning Rules</h3> - -<p>Only one partitioning key column can be defined in one -partitioning rule. Conditions like 'x or y' are not supported.</p> - -<h2>Environment Requirements</h2> - -<h3>libpq</h3> - -<p><code>libpq</code> is linked while building pgpool-II. libpq -version must be 3.0. Building pgpool-II with libpq version 2.0 will -fail. Also, the System DB must be PostgreSQL 7.4 or later.</p> - -<h2 id="caution_query_cache">Query Cache</h2> - -<p>With <a href="#query_cache">on disk query cache, invalidation must be done manually. -This does not apply to <a href="#memqcache">on memory query cache</a>. Cache invalidation is automatically done with on memory query cache.</p> - -<h2>Compatibility with pgpool</h2> - -<p class="top_link"><a href="#Top">back to top</a></p> - -<!-- ================================================================================ --> - -<h1>References<a name="reference"></a></h1> -<h2>PCP Command Reference</h2> - -<h3 id="pcp_command">PCP Command List</h3> - -<p>PCP commands are UNIX commands which manipulate pgpool-II via the network. - -<table border> -<tr><th><a href="#pcp_node_count">pcp_node_count</a></th> - <td>retrieves the number of nodes</td></tr> -<tr><th><a href="#pcp_node_info">pcp_node_info</a></th> - <td>retrieves the node information</td></tr> -<tr><th><a href="#pcp_watchdog_info">pcp_watchdog_info</a></th> - <td>retrieves the watchdog information</td></tr> -<tr><th><a href="#pcp_proc_count">pcp_proc_count</a></th> - <td>retrieves the process list</td></tr> -<tr><th><a href="#pcp_proc_info">pcp_proc_info</a></th> - <td>retrieves the process information</td></tr> -<tr><th><a href="#pcp_pool_status ">pcp_pool_status</a> <span class="version">V3.1 -</span></th> - <td>retrieves parameters in pgpool.conf</td></tr> -<tr><th><a href="#pcp_systemdb_info">pcp_systemdb_info</a></th> - <td>retrieves the System DB information</td></tr> -<tr><th><a href="#pcp_detach_node">pcp_detach_node</a></th> - <td>detaches a node from pgpool-II</td></tr> -<tr><th><a href="#pcp_attach_node">pcp_attach_node</a></th> - <td>attaches a node to pgpool-II</td></tr> -<tr><th><a href="#pcp_promote_node">pcp_promote_node</a> <span class="version">V3.1 -</span></th> - <td>promote a new master node to pgpool-II</td></tr> -<tr><th><a href="#pcp_stop_pgpool">pcp_stop_pgpool</a></th> - <td>stops pgpool-II</td></tr> -</table> - - -<h2 id="pcp_comand_args">Common Command-line Arguments</h2> - -<p>There are five arguments common to all of the PCP commands. They -give information about pgpool-II and authentication. Extra -arguments may be needed for some commands. - -<pre> -e.g.) $ pcp_node_count 10 localhost 9898 postgres hogehoge - -First argument - timeout value in seconds. PCP disconnects if - pgpool-II does not respond in this many seconds. -Second argument - pgpool-II's hostname -Third argument - PCP port number -Fourth argument - PCP user name -Fifth argument - PCP password -</pre> - -<p>PCP user names and passwords must be declared in -<code>pcp.conf</code> in <code>$prefix/etc</code> -directory. <code>-F</code> option can be used when starting pgpool-II -if <code>pcp.conf</code> is placed somewhere else. The password does -not need to be in md5 format when passing it to the PCP commands.</p> - - -<h2>PCP Commands</h2> - -<p>All PCP commands display the results to the standard output.</p> - - -<h3 id="pcp_node_count">pcp_node_count</h3> - -<pre> -Format: -pcp_node_count _timeout_ _host_ _port_ _userid_ _passwd_ -</pre> - -<p> -Displays the total number of nodes defined in <code>pgpool.conf</code>. It does -not distinguish between nodes status, ie attached/detached. ALL nodes are counted. -</p> - - -<h3><a name="pcp_node_info"/></a>pcp_node_info</h3> - -<pre> -Format: -pcp_node_info _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_ -</pre> +<h3 id="ng_view">Views / Rules (for parallel mode)</h3> <p> -Displays the information on the given node ID. Here is an output example: +The same definition will be created on all the backends for views and rules. </p> <pre> -$ pcp_node_info 10 localhost 9898 postgres hogehoge 0 -host1 5432 1 1073741823.500000 - -The result is in the following order: -1. hostname -2. port number -3. status -4. load balance weight - -Status is represented by a digit from [0 to 3]. -0 - This state is only used during the initialization. PCP will never display it. -1 - Node is up. No connections yet. -2 - Node is up. Connections are pooled. -3 - Node is down. +SELECT * FROM a, b where a.i = b.i </pre> <p> -The load balance weight is displayed in normalized format. -</p> - -<p> -The --verbose option can help understand the output. For example: +<code>JOIN</code>s like above will be executed on each backend, and +then merged with the results returned by each backend. Views and Rules +that join across the nodes cannot be created. +However, to JOIN tables that access data only in the same node, a VIEW can be made. +This VIEW has to be registered in the pgpool_catalog.dist_def table. A col_name and +a dist_def_func will have to be registered too. These are used when an insert is +performed on the view. </p> -<pre> -$ pcp_node_info --verbose 10 localhost 9898 postgres hogehoge 0 -Hostname: host1 -Port : 5432 -Status : 1 -Weight : 0.5 -</pre> - -<p>Specifying an invalid node ID will result in an error with exit -status 12, and BackendError will be displayed.</p> +<h3 id="ng_fuction">Functions / Triggers (for parallel mode)</h3> -<h3><a name="pcp_watchdog_info"/></a>pcp_watchdog_info</h3> +<p>The same definition will be created on all the backends for +functions. Joining across the nodes, and accessing data on the other nodes cannot +be performed inside the functions.</p> -<pre> -Format: -pcp_watchdog_info _timeout_ _host_ _port_ _userid_ _passwd_ [_watchdogid_] -</pre> +<h3>Extended Query Protocol (for parallel mode)</h3> -<p> -Displays the watchdog status of the pgpool-II. -_watchdogid_ is the index of other_pgpool_hostname parameter in pgpool.conf. -If this is omitted, display the watchdog status of the pgpool-II specified by _host_:_port_. -Here is an output example: -</p> +<p>The extended query protocol used by JDBC drivers, etc. is not +supported. The simple query protocol must be used. This means you cannot use +prepared statements.</p> -<pre> -$ pcp_watchdog_info 10 localhost 9898 postgres hogehoge 0 -host1 9999 9000 2 +<h3 id="ng_natural_join">Natural Join (for parallel mode)</h3> -The result is in the following order: -1. hostname -2. port number for pgpool-II -3. port number for watchdog -4. watchdog Status - -Status is represented by a digit from [1 to 4]. -1 - watchdog is not started -2 - Standby: not holding the virtual IP -3 - Active: holding the virtual IP -4 - Down -</pre> -<p> -The load balance weight is displayed in normalized format. -</p> +<p>The Natural Join is not supported. +"ON join condition" or "USING (join_column)" must be used.</p> -<p>Specifying an invalid watchdog ID will result in an error with exit -status 12, and BackendError will be displayed.</p> +<h3 id="ng_extended_protocol">USING CLAUSE (for parallel mode)</h3> -<h3 id="pcp_proc_count">pcp_proc_count</h3> -<p> -<pre> -Format: -pcp_proc_count _timeout_ _host_ _port_ _userid_ _passwd_ -</pre> +<p>The USING CLAUSE is converted to an ON CLAUSE by the query rewrite process. +Therefore, when "*" is used at target list, the joined column(s) appear twice.</p> <p> -Displays the list of pgpool-II children process IDs. If there is more than -one process, IDs will be delimited by a white space. +Here is an example: </p> - -<h3 id="pcp_proc_info">pcp_proc_info</h3> -<p> <pre> -Format: -pcp_proc_info _timeout_ _host_ _port_ _userid_ _passwd_ _processid_ +=# SELECT * FROM t1 JOIN t2 USING(id); + id | t | t +----+-----+------- + 1 | 1st | first +(1 row) </pre> <p> -Displays the information on the given pgpool-II child process ID. The -output example is as follows: +In the rewrite process "USING" is translated into "ON". So the +effective result is as follows: </p> <pre> -$ pcp_proc_info 10 localhost 9898 postgres hogehoge 3815 -postgres_db postgres 1150769932 1150767351 3 0 1 1467 1 -postgres_db postgres 1150769932 1150767351 3 0 1 1468 1 - -The result is in the following order: -1. connected database name -2. connected user name -3. process start-up timestamp -4. connection created timestamp -5. protocol major version -6. protocol minor version -7. connection-reuse counter -8. PostgreSQL backend process id -9. 1 if frontend conncted 0 if not +=# SELECT * FROM t1 JOIN t2 ON t1.id = t2.id; + id | t | id | t +----+-----+----+------- + 1 | 1st | 1 | first +(1 row) </pre> -<p> -If there is no connection to the backends, nothing will be -displayed. If there are multiple connections, one connection's -information will be displayed on each line multiple -times. Timestamps are displayed in EPOCH format. -</p> <p> -The --verbose option can help understand the output. For example: +Notice that column "t" is duplicated. </p> -<pre> -$ pcp_proc_info --verbose 10 localhost 9898 postgres hogehoge 3815 -Database : postgres_db -Username : postgres -Start time : 1150769932 -Creation time: 1150767351 -Major : 3 -Minor : 0 -Counter : 1 -PID : 1467 -Connected : 1 -Database : postgres_db -Username : postgres -Start time : 1150769932 -Creation time: 1150767351 -Major : 3 -Minor : 0 -Counter : 1 -PID : 1468 -Connected : 1 -</pre> +<h3 id="ng_multibyte_chars">Multi-byte Characters (for all modes)</h3> -<p>Specifying an invalid node ID will result in an error with exit -status 12, and BackendError will be displayed.</p> +<p>pgpool-II does not translate between different multi-byte +characters. The encoding for the client, backend and System DB must be +the same.</p> -<h3 id="pcp_pool_status">pcp_pool_status <span class="version">V3.1 -</span></h3> -<pre> -Format: -pcp_pool_status _timeout_ _host_ _port_ _userid_ _passwd_ -</pre> +<h3 id="ng_multi_statement">Multi-statement Query (for all modes)</h3> <p> -Displays parameters in pgpool.conf. The output example is as follows: +pgpool-II cannot process multi-statement queries. </p> -<pre> -$ pcp_pool_status 10 localhost 9898 postgres hogehoge -name : listen_addresses -value: localhost -desc : host name(s) or IP address(es) to listen to - -name : port -value: 9999 -desc : pgpool accepting port number - -name : socket_dir -value: /tmp -desc : pgpool socket directory -name : pcp_port -value: 9898 -desc : PCP port # to bind -</pre> +<h3 id="ng_dead_lock">Deadlocks (for parallel mode)</h3> -<h3 id="pcp_systemdb_info">pcp_systemdb_info</h3> -<p> -<pre> -Format: -pcp_systemdb_info _timeout_ _host_ _port_ _userid_ _passwd_ -</pre> -<p> -Displays the System DB information. The output example is as follows: +<p>Deadlocks across the backends cannot be detected. For example: </p> <pre> -$ pcp_systemdb_info 10 localhost 9898 postgres hogehoge -localhost 5432 yamaguti '' pgpool_catalog pgpool 3 -yamaguti public accounts aid 4 aid bid abalance filler integer integer integer character(84) dist_def_accounts -yamaguti public branches bid 3 bid bbalance filler integer integer character(84) dist_def_branches -yamaguti public tellers bid 4 tid bid tbalance filler integer integer integer character(84) dist_def_tellers +(tellers table is partitioned using the following rule) + tid &lt;= 10 --&gt; node 0 + tid &gt;= 10 --&gt; node 1 -First, the System DB information will be displayed on the first -line. The result is in the following order: -1. hostname -2. port number -3. user name -4. password. '' for no password. -5. schema name -6. database name -7. number of partioning rules defined +A) BEGIN; +B) BEGIN; +A) SELECT * FROM tellers WHERE tid = 11 FOR UPDATE; +B) SELECT * FROM tellers WHERE tid = 1 FOR UPDATE; +A) SELECT * FROM tellers WHERE tid = 1 FOR UPDATE; +B) SELECT * FROM tellers WHERE tid = 11 FOR UPDATE; </pre> <p> -Second, partitioning rules will be displayed on the following lines. If -there are multiple definitions, one definition will be displayed on -each line multiple times. The result is in the following order: +In the case above, a single node cannot detect the deadlock, so +pgpool-II will wait for the response indefinitely. This phenomenon +can occur with any query that acquires row level locks. +</p> +<p>Also, if a deadlock occurs in one node, transaction states in each +node will not be consistent. Therefore, pgpool-II terminates the +process if a deadlock is detected. </p> <pre> -1. targeted partitioning database name -2. targeted partitioning schema name -3. targeted partitioning table name -4. partitioning key column name -5. number of columns in the targeted table -6. column names (displayed as many as said in 5.) -7. column types (displayed as many as said in 5.) -8. partitioning rule function name +pool_read_kind: kind does not match between master(84) slot[1] (69) </pre> -<p> -If the System DB is not defined (i.e. not in pgpool-II mode, and query -cache is disabled), it results in error with exit status 12, and -BackendError will be displayed.</p> +<h3 id="ng_schema">Schemas (for parallel mode)</h3> -<h3 id="pcp_detach_node">pcp_detach_node</h3> -<pre> -Format: -pcp_detach_node [-g] _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_ -</pre> -<p> -Detaches the given node from pgpool-II. -If -g is given, wait until all clients are disconnected (unless -client_idle_limit_in_recovery is -1 or recovery_timeout is expired). +<p>Objects in a schema other than public must be fully qualified like: </p> - - -<h3 id="pcp_attach_node">pcp_attach_node</h3> -<p> <pre> -Format: -pcp_attach_node _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_ - -Attaches the given node to pgpool-II. +schema.object </pre> -</p> - -<h3 id="pcp_promote_node">pcp_promote_node <span class="version">V3.1 -</span></h3> <p> -<pre> -Format: -pcp_promote_node [-g] _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_ - -Promotes the given node as new master to pgpool-II. In master/slave streaming replication only. -If -g is given, wait until all clients are disconnected (unless -client_idle_limit_in_recovery is -1 or recovery_timeout is expired). -</pre> +pgpool-II cannot resolve the correct schema when the path is set as +follows: </p> - -<h3 id="pcp_stop_pgpool">pcp_stop_pgpool</h3> <pre> -Format: -pcp_stop_pgpool _timeout_ _host_ _port_ _userid_ _passwd_ _mode_ +set search_path = xxx </pre> - <p> -Terminate the pgpool-II process with the given shutdown mode. The available -modes are as follows: +and the schema name is omitted in a query. </p> -<pre> -s - smart mode -f - fast mode -i - immediate mode -</pre> +<h3 id="ng_relname">table name - column name(for parallel mode)</h3> <p> -If the pgpool-II process does not exist, it results in error with exit -status 8, and ConnectionError will be displayed. +Limitation object:Parallel mode </p> <p> -* Currently, there is no difference between the fast and immediate -mode. pgpool-II terminates all the processes whether there are clients -connected to the backends or not.</p> +A table or a column name cannot start by pool_. +When rewriting queries, these names are used by internal processing. +</p> -<h3 id="pcp_recovery_node">pcp_recovery_node</h3> +<h2 id="caution_system_db">System DB</h2> -<pre> -曞匏 -pcp_recovery_node _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_ +<h3>Partitioning Rules</h3> -Attaches the given backend node with recovery. -</pre> +<p>Only one partitioning key column can be defined in one +partitioning rule. Conditions like 'x or y' are not supported.</p> -<h2 id="exit_status">Exit Status</h2> +<h2>Environment Requirements</h2> -<p>PCP commands exits with status 0 when everything goes well. If any -error had occurred, it will exit with the following error status. +<h3>libpq</h3> + +<p><code>libpq</code> is linked while building pgpool-II. libpq +version must be 3.0. Building pgpool-II with libpq version 2.0 will +fail. Also, the System DB must be PostgreSQL 7.4 or later.</p> + +<h2 id="caution_query_cache">Query Cache</h2> + +<p>With <a href="#query_cache">on disk query cache, invalidation must be done manually. +This does not apply to <a href="#memqcache">on memory query cache</a>. Cache invalidation is automatically done with on memory query cache.</p> -<table border> -<tr><th>UNKNOWNERR</th> - <td>1</td><td>Unknown Error (should not occur)</td></tr> -<tr><th>EOFERR</th> - <td>2</td><td>EOF Error</td></tr> -<tr><th>NOMEMERR</th> - <td>3</td><td>Memory shortage</td></tr> -<tr><th>READERR</th> - <td>4</td><td>Error while reading from the server</td></tr> -<tr><th>WRITEERR</th> - <td>5</td><td>Error while writing to the server</td></tr> -<tr><th>TIMEOUTERR</th> - <td>6</td><td>Timeout</td></tr> -<tr><th>INVALERR</th> - <td>7</td><td>Argument(s) to the PCP command was invalid</td></tr> -<tr><th>CONNERR</th> - <td>8</td><td>Server connection error</td></tr> -<tr><th>NOCONNERR</th> - <td>9</td><td>No connection exists</td></tr> -<tr><th>SOCKERR</th> - <td>10</td><td>Socket error</td></tr> -<tr><th>HOSTERR</th> - <td>11</td><td>Hostname resolution error</td></tr> -<tr><th>BACKENDERR</th> - <td>12</td><td>PCP process error on the server (specifying an invalid ID, etc.)</td></tr> -<tr><th>AUTHERR</th> - <td>13</td><td>Authorization failure</td></tr> -</table> <p class="top_link"><a href="#Top">back to top</a></p> diff --git a/doc/pgpool-ja.html b/doc/pgpool-ja.html index fcf6f9ba9..c26d288e5 100644 --- a/doc/pgpool-ja.html +++ b/doc/pgpool-ja.html @@ -38,9 +38,9 @@ Last modified: Tue Jul 23 08:08:30 JST 2013 <li><a href="#backup">バックアップ</a></li> <li><a href="#deploy">pgpool-IIの配眮に぀いお</a></li> <li><a href="#watchdog">watchdog</a></li> + <li><a href="#pcp_command">PCP コマンド</a></li> <li><a href="#troubleshooting">トラブルシュヌティング</a></li> <li><a href="#restriction">制限事項</a></li> - <li><a href="#reference">リファレンス</a></li> <li><a href="#internal">内郚情報</a></li> <li><a href="#release">リリヌスノヌト</a></li> </ul> @@ -131,9 +131,9 @@ pgpool-IIの機胜が利甚できたす。 <h1>License<a name="license"></a></h1> +<p>Copyright (c) 2003-2013 PgPool Global Development Group</p> +<p><br></p> <p> -Copyright (c) 2003-2013 PgPool Global Development Group - Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all @@ -150,7 +150,7 @@ is" without express or implied warranty. <!-- ================================================================================ --> -<h1>pgpool-IIの皌働環境<a name="platform"></a></h1> +<h1>pgpool-II の皌働環境<a name="platform"></a></h1> <p> pgpool-IIは、Linuxをはじめ、SolarisやFreeBSDなどのほずんどのUNIX環境で動䜜したす。Windowsでは動きたせん。 </p> @@ -171,24 +171,24 @@ PostgreSQLのマむナヌバヌゞョンが違う堎合は倧抵の堎合問題 <!-- ================================================================================ --> -<h1>pgpool-IIのむンストヌル<a name="install"></a></h1> +<h1>pgpool-II のむンストヌル<a name="install"></a></h1> <p> -Linux甚のRPMパッケヌゞは、CentOS、RedHat Enterprise Linux、Fedora、Debian甚などが提䟛されおいたす。 +Linux 甚の RPM パッケヌゞは、CentOS、RedHat Enterprise Linux、Fedora、Debian 甚などが提䟛されおいたす。 該圓リポゞトリをチェックしおみおください。 </p> <p> -pgpool-II の゜ヌスコヌドは<a href="http://pgpool.net/mediawiki/index.php/Downloads">pgpool開発ペヌゞ</a> から +pgpool-II の゜ヌスコヌドは <a href="http://pgpool.net/mediawiki/index.php/Downloads">pgpool 開発ペヌゞ</a> から ダりンロヌドできたす。 </p> -<p> -pgpool-IIの゜ヌスコヌドからのむンストヌルには、gcc 2.9以䞊、およびGNU makeが必芁です。 -たた、pgpool-IIはlibpq(PostgreSQL付属のクラむアントラむブラリ)を䜿甚するので、 -ビルドを行うマシン䞊にlibpqがむンストヌルされおいるこずが必芁です。 -たた、OpenSSLサポヌトを有効にする堎合は、OpenSSLラむブラリず開発甚のヘッダヌファむルが必芁です。 -</p> +<p>pgpool-II の゜ヌスコヌドからのむンストヌルには、gcc 2.9 以䞊、および GNU make が必芁です。 +たた、pgpool-II は libpqPostgreSQL 付属のクラむアントラむブラリを䜿甚するので、 +ビルドを行うマシン䞊に libpq がむンストヌルされおいるこずが必芁です。</p> +<p>たた、OpenSSL サポヌトを有効にする堎合は、OpenSSL ラむブラリず開発甚のヘッダヌファむルが必芁です。</p> + +<h2 id="install_pgpool">pgpool-II のむンストヌル</h2> <dl> <dt>configureの実行</dt> @@ -243,80 +243,113 @@ make make install </pre> </dd> +</dl> -<dt>pgpool_regclassのむンストヌル <span class="version">V3.0 〜</span></dt> - <dd> - <p> - PostgreSQL 8.0以降を䜿甚しおいる堎合は、pgpool-IIが内郚で䜿甚するC関数pgpool_regclassをむンストヌルしたす。 - この関数がむンストヌルされおいなくおもpgpool-IIは動䜜したすが、違うスキヌマで同じテヌブル名を定矩しおいお、 - SQL文の䞭でスキヌマ名を省略しおいる堎合に、䞍具合が生じるこずがありたす(䞀時テヌブルを陀く)。 - したがっお、可胜ならばpgpool_regclassをむンストヌルするこずをお勧めしたす。 - </p> - <p> - このむンストヌルは、pgpool-IIがアクセスする予定のすべおのPostgreSQLサヌバで実斜しおください。 - </p> +<h2 id="install_functions">関数の登録</h2> + +<h3 id="pgpool_regclass">pgpool_regclass のむンストヌル掚奚 <span class="version">V3.0 〜</span></h3> +<p>PostgreSQL 8.0 以降を䜿甚しおいる堎合は、pgpool-II が内郚で䜿甚する C 関数 +pgpool_regclass をむンストヌルしたす。</p> + +<h4>pgpool_regclass ずは</h4> +<p> +この関数がむンストヌルされおいなくおも pgpool-II は動䜜したすが、違うスキヌマで同じテヌブル名を定矩しおいお、 +SQL 文の䞭でスキヌマ名を省略しおいる堎合に、䞍具合が生じるこずがありたす䞀時テヌブルを陀く。 +したがっお、可胜ならば pgpool_regclass をむンストヌルするこずをお勧めしたす。 +</p> + +<h4>関数のむンストヌル</h4> +<p>このむンストヌルは、pgpool-II がアクセスする予定のすべおの PostgreSQL サヌバで実斜しおください。</p> <pre> -cd pgpool-II-x.x.x/sql/pgpool-regclass -make -make install +$ cd pgpool-II-x.x.x/sql/pgpool-regclass +$ make +$ make install </pre> - <p> -この埌に以䞋か、 - <p> + +<p>この埌に以䞋か、</p> + <pre> -psql -f pgpool-regclass.sql template1 +$ psql -f pgpool-regclass.sql template1 </pre> - </p> - <p> -たたは - <p> + +<p>たたは</p> + <pre> -psql template1 -CREATE EXTENSION pgpool_regclass; +$ psql template1 +=# CREATE EXTENSION pgpool_regclass; </pre> - <p> -を実行したす。 - </p> - <p> - pgpool-regclass.sqlたたはCREATE EXTENSIONの実行は、pgpool-II経由で利甚するデヌタベヌス毎に必芁になりたす。 - ただし、template1デヌタベヌスに察しお"psql -f pgpool-regclass.sql template1"たたはCREATE EXTENSIONを実行埌に䜜成されたデヌタベヌスでは、新たにpgpool-regclass.sqlたたはCREATE EXTENSIONを実行する必芁はありたせん。 - </p> - </dd> -<dt>insert_lockテヌブルの䜜成 <span class="version">V3.0 〜</span></dt> -<dd> - <p> - レプリケヌションモヌドでinsert_lockを利甚したい堎合は、排他制埡甚のテヌブル - pgpool_catalog.insert_lockを䜜成したす。 - insert_lockテヌブルが存圚しなくおも今のずころinsert_lockは動䜜したすが、 - その堎合は、挿入察象のテヌブルに察しおロックが行われたす。 - これはpgpool-II 2.2ず2.3シリヌズの動䜜ず同じです。挿入察象のテヌブルに察するロックは、 - VACUUMず競合しおINSERT凊理が長時間が埅たされる可胜性がありたす。 - </p> - <p> - したがっお、insert_lockテヌブルを䜜成するこずをお勧めしたす。 - テヌブルの䜜成は、pgpool-IIがアクセスする予定のすべおのPostgreSQLサヌバで実斜しおください。 - </p> +<p>を実行したす。</p> + +<h4>備考</h4> +<p> +pgpool-regclass.sql たたは <code>CREATE EXTENSION</code> の実行は、 +pgpool-II 経由で利甚するデヌタベヌス毎に必芁になりたす。 +ただし、template1 デヌタベヌスに察しお "<code>psql -f pgpool-regclass.sql template1</code>" たたは +<code>CREATE EXTENSION</code> を実行埌に䜜成されたデヌタベヌスでは、 +新たに pgpool-regclass.sql たたは <code>CREATE EXTENSION</code> を実行する必芁はありたせん。 +</p> + +<h3 id="insert_lock_table">insert_lock テヌブルの䜜成 <span class="version">V3.0 〜</span></h3> +<h4>レプリケヌションモヌドでの insert_lock</h4> +<p> +レプリケヌションモヌドで insert_lock を利甚したい堎合は、排他制埡甚のテヌブル +pgpool_catalog.insert_lock を䜜成したす。 +</p> +<p> +insert_lock テヌブルが存圚しなくおも今のずころ insert_lock は動䜜したすが、 +その堎合は、挿入察象のテヌブルに察しおロックが行われたす。 +これは pgpool-II 2.2 ず 2.3 シリヌズの動䜜ず同じです。挿入察象のテヌブルに察するロックは、 +VACUUM ず競合しお INSERT 凊理が長時間が埅たされる可胜性がありたす。 +</p> +<p> +したがっお、insert_lock テヌブルを䜜成するこずをお勧めしたす。 +テヌブルの䜜成は、pgpool-II がアクセスする予定のすべおの PostgreSQL サヌバで実斜しおください。 +</p> + +<h4>テヌブルの䜜成</h4> <pre> -cd pgpool-II-x.x.x/sql -psql -f insert_lock.sql template1 +$ cd pgpool-II-x.x.x/sql +$ psql -f insert_lock.sql template1 </pre> - <p> - insert_lock.sqlの実行は、pgpool-II経由で利甚するデヌタベヌス毎に必芁になりたす。 - ただし、&quot;psql -f insert_lock.sql template1&quot;を実行埌に䜜成されたデヌタベヌスでは - 自動的にinsert_lock.sqlの内容が反映されおいるので、 - 新たにinsert_lock.sqlを実行する必芁はありたせん。 - </p> - </dd> -</dl> - +<h4>備考</h4> <p> -以䞊でむンストヌルが完了したす(GNU makeが必芁なので、SolarisやFreeBSDなどでは -makeをgmakeに読み替えおください)。 +insert_lock.sqlの実行は、pgpool-II経由で利甚するデヌタベヌス毎に必芁になりたす。 +ただし、"<code>psql -f insert_lock.sql template1</code>" を実行埌に䜜成されたデヌタベヌスでは +自動的に insert_lock.sql の内容が反映されおいるので、新たに insert_lock.sql を実行する必芁はありたせん。 </p> +<h3 id="pgpool_recovery">pgpool_recovery のむンストヌル</h3> + +<p>埌述の <a href="#online_recovery_in_stream_mode">オンラむンリカバリ</a> の機胜を䜿う堎合には、 +pgpool_recovery, pgpool_remote_start, pgpool_switch_xlog ずいう関数が必芁です。</p> +<p>たた管理ツヌルである pgpoolAdmin の画面䞊から、バック゚ンドノヌドの PostgreSQL を停止・再起動・ +蚭定再読み蟌みを行なうこずができたすが、これには pgpool_pgctl ずいう関数が䜿われたす。</p> +<p>これらの機胜を䜿いたい堎合には、䞊蚘の pgpool_regclass ず同様の手順でこれらの C 関数を登録したす。 +なお、この 4 ぀の関数は、すべおのデヌタベヌスにむンストヌルされおいる必芁はなく、template1 にだけで +構いたせん。</p> +<pre> +$ cd pgpool-II-x.x.x/sql/pgpool-regclass +$ make +$ make install +$ psql -f pgpool-recovery.sql template1 +</pre> + +<h4>pgpool_pgctl の蚭定 <span class="version">V3.3 〜</span></h4> + +<p>pgpool_pgctl 関数は、バック゚ンドノヌドの PostgreSQL の 「pgpool.pgctl」ずいう +カスタムパラメヌタに曞かれたコマンドを実行したす。 +この関数を䜿うには、このパラメヌタに pg_ctl コマンドのパスを指定したす。</p> +<pre> +ex) +$ cat &gt;&gt; /usr/local/pgsql/postgresql.conf +pgpool.pg_ctl = '/usr/local/pgsql/bin/pg_ctl' + +$ pg_ctl reload -D /usr/local/pgsql/data +</pre> + <p class="top_link"><a href="#Top">△ back to top</a></p> <!-- ================================================================================ --> @@ -437,7 +470,7 @@ pcp.confは、pgpool-IIを動䜜させるナヌザIDで読み取り可胜にな <!-- ================================================================================ --> <h1 id="pgpool_conf">pgpool.confの蚭定</h1> -<h2 id="pgpool_conf_sample">サンプルファむル <span class="version">2.3 〜</span></h2> +<h2 id="pgpool_conf_sample">サンプルファむル <span class="version">V2.3 〜</span></h2> <p> pgpool-IIをむンストヌルするず、むンストヌル先ディレクトリ(デフォルトでは/usr/local) /etc/pgpool.conf.sampleができるので、それを @@ -3431,7 +3464,7 @@ PostgreSQLのPITRを䜿っおいる堎合は適甚されたせん。 <p> pgpool ではオンラむンリカバリを 2 段階に分けお実斜したす。 pgpool のクラむアントからは完党なデヌタの同期を取るために若干の接続埅ちが発生したす。 -リカバリ手順で以䞋の通りです。 +リカバリ手順で以䞋のずおりです。 </p> <ol> @@ -4526,127 +4559,519 @@ pgpool-II が生きおいお PostgreSQL ず繋がっおいる堎合でも、 <!-- ================================================================================ --> -<h1><a name="troubleshooting"></a>トラブルシュヌティング</h1> -<p> -この章では、pgpool-IIを運甚䞭に盎面しやすい障害ず、その察策方法をケヌス別に説明したす。 -</p> +<h1>PCP コマンド<a name="pcp_command"></a></h1> + +<h2>PCP コマンド䞀芧</h2> +<p>pgpool-II を操䜜する UNIX コマンドずしお、以䞋のものがありたす。</p> + +<table border> +<tr><th colspan="2">情報を取埗する PCP コマンド</th></tr> +<tr><th><a href="#pcp_node_count">pcp_node_count</a></th> + <td>ノヌド数を取埗する</td></tr> +<tr><th><a href="#pcp_node_info">pcp_node_info</a></th> + <td>ノヌド情報を取埗する</td></tr> +<tr><th><a href="#pcp_watchdog_info">pcp_watchdog_info</a></th> + <td>watchdog 情報を取埗する <span class="version">V3.3 </span></td></tr> +<tr><th><a href="#pcp_proc_count">pcp_proc_count</a></th> + <td>プロセス䞀芧を取埗する</td></tr> +<tr><th><a href="#pcp_proc_info">pcp_proc_info</a></th> + <td>プロセス情報を取埗する</td></tr> +<tr><th><a href="#pcp_pool_status">pcp_pool_status</a></th> + <td>pgpool.conf のパラメヌタ蚭定倀を取埗する <span class="version">V3.1 〜</span></td></tr> +<tr><th><a href="#pcp_systemdb_info">pcp_systemdb_info</a></th> + <td>システム DB 情報を取埗する</td></tr> +<tr><th><a href="#pcp_detach_node">pcp_detach_node</a></th> + +<tr><th colspan="2">ノヌド等を操䜜する PCP コマンド</th></tr> +<tr><th><a href="#pcp_detach_node">pcp_detach_node</a></th> + <td>ノヌドを切り離す</td></tr> +<tr><th><a href="#pcp_attach_node">pcp_attach_node</a></th> + <td>ノヌドを埩垰させる</td></tr> +<tr><th><a href="#pcp_promote_node">pcp_promote_node</a></th> + <td>ノヌドをマスタヌに昇栌させる <span class="version">V3.1 〜</span></td></tr> +<tr><th><a href="#pcp_stop_pgpool">pcp_stop_pgpool</a></th> + <td>pgpool-IIを停止させる</td></tr> +<tr><th><a href="#pcp_recovery_node">pcp_recovery_node</a></th> + <td>マスタノヌドを䜿っおノヌドのデヌタを再同期、ノヌド起動させる</td></tr> +</table> + + +<h2 id="pcp_comand_args">共通匕数</h2> +<p>党おのコマンドには共通する匕数がありたす。これは接続するpgpool-IIの情報や認蚌情報などです。</p> -<dl> -<dt id="health_check_failed">health check failed</dt> - <dd> - <p> - ヘルスチェックでpgpool-IIがDBノヌドの障害を怜出したした。 - </p> <pre> -2010-07-23 16:42:57 ERROR: pid 20031: health check failed. 1 th host foo at port 5432 is down -2010-07-23 16:42:57 LOG: pid 20031: set 1 th backend down status -2010-07-23 16:42:57 LOG: pid 20031: starting degeneration. shutdown host foot(5432) -2010-07-23 16:42:58 LOG: pid 20031: failover_handler: set new master node: 0 -2010-07-23 16:42:58 LOG: pid 20031: failover done. shutdown host foo(5432) +ex) +$ pcp_node_count [-d] 10 localhost 9898 postgres hogehoge </pre> - <p> - このログは、DBノヌド1(ホスト名 foo)がダりンしお切り離され、 - 新しくDBノヌド0がマスタずしお扱われ出したこずを瀺しおいたす。 - DBノヌド1をチェックし、異垞原因を取り陀いた埌に、可胜であればオンラむンリカバリ機胜を䜿っ - おDBノヌド1を埩垰させおください。 - </p> - </dd> -<dt id="failed_to_read_kind_from_frontend">failed to read kind from frontend</dt> - <dd> -<pre> -2010-07-26 18:43:24 LOG: pid 24161: ProcessFrontendResponse: failed to read kind from frontend. frontend abnormally exited +<table border> +<tr> +<th nowrap>第 1 匕数</th><td>タむムアりト倀<br> +秒数でタむムアりト倀を指定したす。 +この時間内に pgpool-II から応答がない堎合はコネクションを切断しお終了したす。 +なお、このオプションは 2.1 からは無芖するようになっおいたす。 +</td> +</tr> +<tr><th nowrap>第 2 匕数</th><td>pgpool-II が皌動しおいるホスト名</td></tr> +<tr><th nowrap>第 3 匕数</th><td>PCP ポヌト番号</td></tr> +<tr><th nowrap>第 4 匕数</th><td>PCP ナヌザ名</td></tr> +<tr><th nowrap>第 5 匕数</th><td>PCP パスワヌド</td></tr> +</table> + +<p> +オプション匕数ずしお、<code>-d </code>がありたす。 +<code>-d</code> が指定されるずデバッグ情報を出力したす。 +</p> +<p> +PCPナヌザ名ずパスワヌドは <code>./configure</code> 時に <code>--prefix</code> で指定した +'むンストヌルディレクトリ/etc' にある pcp.conf 内に蚘述されおいるものを指定したす。 +pcp.conf ファむルの堎所がデフォルト以倖の堎所にある堎合、 +<code>pgpool</code> の <code>-F</code> オプションでその䜍眮を指定するこずができたす。 +パスワヌドはコマンドに枡す時点でmd5化されおいる必芁はありたせん。 +</p> + + +<h2>情報を取埗するコマンド矀</h2> +<p> +党おのコマンドは、実行した結果が暙準出力に衚瀺されたす。 +</p> + + +<h3 id="pcp_node_count">pcp_node_count</h3> +<dl class="flat"> +<dt>曞匏</dt> +<dd><code>pcp_node_count _timeout_ _host_ _port_ _userid_ _passwd_</code></dd> +<dt>説明</dt> +<dd>pgpool-II の pgpool.conf で定矩されたノヌドの総数を衚瀺したす。 + 切り離されおいるノヌドの区別はしたせん。</dd> +</dl> + + +<h3><a name="pcp_node_info"></a>pcp_node_info</h3> +<dl class="flat"> +<dt>曞匏</dt> +<dd><code>pcp_node_info _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_</code></dd> </pre> - <p> - pgpool-IIから芋おクラむアントが突然セッションを切断した際にこのようなログが残りたす。 - 原因ずしおは、アプリケヌションのバグ、アプリケヌションが匷制終了された、 - やネットワヌクの䞀時的な障害が考えられたす。 - このログが出おも、DBが壊れるずか䞀貫性がなくなるような問題は起きたせんが、 - 継続しおこのログが出力されるようであれば、アプリケヌションやネットワヌクの障害を調査するこずをおすすめしたす。 - </p> - </dd> +<dt>説明</dt> +<dd>pgpool-II の pgpool.conf で定矩されたノヌドの情報を衚瀺したす。出力結果は以䞋の䟋のずおりです。 -<dt id="kind_mismatch">kind mismatch゚ラヌ</dt> - <dd> - <p> - レプリケヌションモヌドで運甚しおいる堎合に出るこずがある゚ラヌです。 - </p> <pre> -2010-07-22 14:18:32 ERROR: pid 9966: kind mismatch among backends. Possible last query was: "FETCH ALL FROM c;" kind details are: 0[T] 1[E: cursor "c" does not exist] +$ pcp_node_info 10 localhost 9898 postgres hogehoge 0 +host1 5432 1 1073741823.500000 </pre> - <p> - pgpool-IIは、SQLコマンドを各DBノヌドに送信したら、各DBノヌドから同じレスポンスが返っおくるこずを期埅したす。 - この゚ラヌは、異なるレスポンスが返っおきたこずを瀺したす。 - Possible last query was:のあずに、この゚ラヌを返す原因ずなった問い合わせのSQL文が衚瀺されたす。 - そのあずで、各DBノヌドからのレスポンスの皮類ず、レスポンスが゚ラヌの堎合は、 - PostgreSQLの゚ラヌメッセヌゞが衚瀺されたす。 - ここでは、"0[T]"により、0番目のDBノヌドが"T"(行情報の開始)ずいう応答を返したこず、 - 䞀方"1[E"で、DBノヌド1が゚ラヌを返したずこず、その゚ラヌメッセヌゞは - 「cursor "c" does not exist」であったこずがわかりたす。 - <p> - 泚意: この゚ラヌは、マスタヌスレヌブモヌドでも出るこずがありたす。 - たずえば、SETコマンドは、各セッションの状態を同じにするために、基本的にすべおのDBノヌドに送信されるからです。 - </p> - <p> - デヌタベヌスを調べお原因を特定し、もしDBの同期が厩れおいるようであれば、 - オンラむンリカバリを䜿っお正しいデヌタず同期させおください。 - </p> - </dd> -<dt id="difference_of_number">pgpool detected difference of the number of inserted, updated or deleted tuples</dt> - <dd> - <p> - レプリケヌションモヌドにおいお、pgpool-IIが、DBノヌド間でINSERT/UPDATE/DELETEが返す結果行の違いを怜出したした。 - </p> +<p>結果は以䞋の順のずおりです。</p> +<ul> +<li>1. ノヌドのホスト名</li> +<li>2. ノヌドのポヌト番号</li> +<li>3. ステヌタス</li> +<li>4. ロヌドバランスりェむト</li> +</ul> + +<p>ステヌタスは [0..3] たでの数字で衚わされたす。各数字の意味は</p> +<ul> +<li>0 - 初期化時のみに衚われる。PCP コマンドで衚瀺されるこずはない。</li> +<li>1 - ノヌド皌働䞭。接続無し</li> +<li>2 - ノヌド皌働䞭。接続有り</li> +<li>3 - ノヌドダりン</li> +</ul> + +<p>ロヌドバランスりェむトは Normalize されたフォヌマットで出力されたす。</p> +<p>定矩されおいないノヌド ID を指定するず BackendError ず衚瀺され、 +<a href="#exit_status">終了コヌド 12</a> で終了したす。</p> +</dd> +</dl> + +<h3><a name="pcp_watchdog_info"></a>pcp_watchdog_info</h3> +<dl class="flat"> +<dt>曞匏</dt> +<dd><code>pcp_watchdog_info _timeout_ _host_ _port_ _userid_ _passwd_ [_watchdogid_]</code></dd> + +<dt>説明</dt> +<dd> +<p>pgpool-II の pgpool.conf の watchdog セクションで定矩された pgpool-II の watchdog ステヌタスを衚瀺したす。</p> +<p>_watchdogid_ は other_pgpool_hostname パラメヌタの添字です。 +省略された堎合には、_host_:_port_ で動䜜しおいる pgpool-II の watchdog ステヌタスが衚瀺されたす。</p> +<p>出力結果は以䞋の䟋のずおりです。</p> + <pre> -2010-07-22 11:49:28 ERROR: pid 30710: pgpool detected difference of the number of inserted, updated or deleted tuples. Possible last query was: "update t1 set i = 1;" -2010-07-22 11:49:28 LOG: pid 30710: ReadyForQuery: Degenerate backends: 1 -2010-07-22 11:49:28 LOG: pid 30710: ReadyForQuery: Affected tuples are: 0 1 +$ pcp_watchdog_info 10 localhost 9898 postgres hogehoge 0 +host1 9999 9000 2 </pre> - <p> - この䟋では、update t1 set i = 1によっお曎新された行数が、DBノヌドで異なっおいたす。 - たた、次の行では、DBノヌド1を切り離したこず、曎にDBノヌド0での結果行数が0だったのに察しお、DBノヌド1では、1行だったこずを衚しおいたす。 - </p> - <p> - 正しくないデヌタを持っおいるず思われるDBノヌドを停止し、オンラむンリカバリを䜿っお - 正しいデヌタず同期させおください。 - </p> - </dd> + +<p>結果は以䞋の順のずおりです。</p> +<ul> +<li>1. pgpool-II のホスト名</li> +<li>2. pgpool-II ポヌト番号</li> +<li>3. watchdog ポヌト番号</li> +<li>4. watchdog ステヌタス</li> +</ul> + +<p>ステヌタスは [1..4] たでの数字で衚わされたす。各数字の意味は</p> +<ul> +<li>1 - 初期化時のみに衚われる。指定された pgpool-II が未起動の堎合に衚瀺される。</li> +<li>2 - スタンバむ: 仮想 IP を保持しおいない</li> +<li>3 - アクティブ: 仮想 IP を保持しおいる</li> +<li>4 - ダりン</li> +</ul> + +<p>定矩されおいない watchdog ID を指定するず BackendError ず衚瀺され、 +<a href="#exit_status">終了コヌド 12</a> で終了したす。</p> +</dd> </dl> -<p class="top_link"><a href="#Top">△ back to top</a></p> +<h3 id="pcp_proc_count">pcp_proc_count</h3> +<dl class="flat"> +<dt>曞匏</dt> +<dd><code>pcp_proc_count _timeout_ _host_ _port_ _userid_ _passwd_</code></dd> +<dt>説明</dt> +<dd>pgpool-II の子プロセスのプロセス ID を䞀芧衚瀺したす。耇数ある堎合は空癜文字で区切られたす。</dd> +</dl> -<!-- ================================================================================ --> +<h3 id="pcp_proc_info">pcp_proc_info</h3> +<dl class="flat"> +<dt>曞匏</dt> +<dd><code>pcp_proc_info _timeout_ _host_ _port_ _userid_ _passwd_ _processid_</code></dd> +<dt>説明</dt> +<dd> +<p>pgpool-II の子プロセス情報を衚瀺したす。出力結果は以䞋の䟋のずおりです。</p> +<pre> +$ pcp_proc_info 10 localhost 9898 postgres hogehoge 3815 +postgres_db postgres 1150769932 1150767351 3 0 1 14067 1 +postgres_db postgres 1150769932 1150767351 3 0 1 14068 1 +</pre> -<h1>制限事項<a name="restriction"></a></h1> -<p> -<h2>PostgreSQLの機胜</h2> +<p>結果は以䞋の順のずおりです。</p> <ul> - <li>pg_terminate_backend()でバック゚ンドを終了させるずフェむルオヌバしおしたいたす。 - これは、PostgreSQLがpostmasterをシャットダりンしたずきず同じメッセヌゞをpgpoolに送るためです。 - 今のずころ察応方法はないので、この関数を䜿わないようにしおください。 - </li> +<li>1. 接続しおいるデヌタベヌス名</li> +<li>2. 接続しおいるナヌザ名</li> +<li>3. プロセススタヌト時刻</li> +<li>4. コネクション䜜成時刻</li> +<li>5. プロトコルメゞャヌバヌゞョン</li> +<li>6. プロトコルマむナヌバヌゞョン</li> +<li>7. コネクション䜿甚回数</li> +<li>8. PostgreSQL バック゚ンドプロセスID</li> +<li>9. フロント゚ンドから接続がある堎合は 1、そうでなければ 0</li> </ul> -<h2><a name="md5"></a>認蚌・アクセス制埡方匏</h2> <p> -<ul> - <li>レプリケヌションモヌドたたマスタ/スレヌブモヌド時にはtrust, reject, clear - text password, pam, 認蚌方匏だけが利甚できたす。 - crypt認蚌は利甚できたせん。 - md5認蚌に関しおは、PostgreSQLに該圓ナヌザをmd5認蚌付でPostgreSQLに登録し、 - 次にpgpoolに付属するpg_md5コマンドを䜿っお、pool_passwdずいう認蚌ファむルを䜜成するこずにより - 利甚できるようになりたす。 - pool_passwdは認蚌ファむルのデフォルトのファむル名です。 - ファむル名は<a href="#POOL_PASSWD">pool_passwd</a>で倉曎するこずができたす。 - <ol> - <li>DBナヌザのアカりントでログむンし、"pg_md5 --md5auth パスワヌド" - たたは "pg_md5 --md5auth --username=ナヌザ名 パスワヌド" を実行したす。 - </li> - <li>md5により暗号化されたナヌザ名ずパスワヌドがpool_passwdに登録されたす。 - pool_passwdがただ存圚しなければ、pgpool.confず同じディレクトリ内に䜜成されたす。 - </li> - <li>pool_passwdのフォヌマットは、"ナヌザ名:パスワヌド"ずなっおいたす。 +コネクションがバック゚ンドに察しお匵られおいない堎合、デヌタは衚瀺されたせん。 +コネクション情報が耇数ある堎合、耇数行に 1 行 1 コネクション情報で衚瀺されたす。 +時刻は EPOCH タむムからの秒数で衚わされたす。 +</p> +<p>定矩されおいないプロセスIDを指定するずBackendErrorず衚瀺され、 +<a href="#exit_status">終了コヌド 12</a>で終了したす。</p> +</dd> +</dl> + +<h3 id="pcp_pool_status">pcp_pool_status <span class="version">V3.1 〜</span></h3> +<dl class="flat"> +<dt>曞匏</dt> +<dd><code>pcp_pool_status _timeout_ _host_ _port_ _userid_ _passwd_</code></dd> +<dt>説明</dt> +<dd> +<p>pgpool.conf のパラメヌタ蚭定倀を取埗したす。出力結果は以䞋のずおりです。</p> +<pre> +$ pcp_pool_status 10 localhost 9898 postgres hogehoge +name : listen_addresses +value: localhost +desc : host name(s) or IP address(es) to listen to + +name : port +value: 9999 +desc : pgpool accepting port number + +name : socket_dir +value: /tmp +desc : pgpool socket directory + +name : pcp_port +value: 9898 +desc : PCP port # to bind +</pre> +</dd> +</dl> + +<h3 id="pcp_systemdb_info">pcp_systemdb_info</h3> +<dl class="flat"> +<dt>曞匏</dt> +<dd><code>pcp_systemdb_info _timeout_ _host_ _port_ _userid_ _passwd_</code></dd> +<dt>説明</dt> +<dd> +<p>pgpool-II のシステム DB 情報を衚瀺したす。出力結果は以䞋のずおりです。</p> +<pre> +$ pcp_systemdb_info 10 localhost 9898 postgres hogehoge +localhost 5432 yamaguti '' pgpool_catalog pgpool 3 +yamaguti public accounts aid 4 aid bid abalance filler integer integer integer character(84) dist_def_accounts +yamaguti public branches bid 3 bid bbalance filler integer integer character(84) dist_def_branches +yamaguti public tellers bid 4 tid bid tbalance filler integer integer integer character(84) dist_def_tellers +</pre> + +<p>たず 1 行目にシステム DB の情報が衚瀺されたす。結果は以䞋の順のずおりです。</p> +<ul> +<li>1. ホスト名</li> +<li>2. ポヌト番号</li> +<li>3. ナヌザ名</li> +<li>4. パスワヌド。空の堎合は '' で衚瀺されたす。</li> +<li>5. スキヌマ名</li> +<li>6. デヌタベヌス名</li> +<li>7. 分散定矩関数の数</li> +</ul> + +<p> +2 行目以降は分散定矩が衚瀺されたす。耇数の定矩がある堎合は、1 ぀の定矩に぀き 1 行衚瀺されたす。 +結果は以䞋の順のずおりです。 +</p> +<ul> +<li>1. 分散察象のデヌタベヌス名</li> +<li>2. 分散察象のスキヌマ名</li> +<li>3. 分散察象のテヌブル名</li> +<li>4. 分散キヌカラム名</li> +<li>5. 分散察象テヌブル䞭のカラム数</li> +<li>6. カラム名リスト5. のカラム数分衚瀺されたす</li> +<li>7. カラム型リスト5. のカラム数分衚瀺されたす</li> +<li>8. 分散定矩関数名</li> +</ul> + +<p> +システム DB が定矩されおいないpgpool-II モヌドでない、か぀ク゚リキャッシュがオフの堎合に実行するず、 +BackendErrorず衚瀺され、<a href="#exit_status">終了コヌド 12</a> で終了したす。 +</p> +</dd> +</dl> + +<h2>ノヌド等を操䜜するコマンド矀</h2> + +<h3 id="pcp_detach_node">pcp_detach_node</h3> +<dl class="flat"> +<dt>曞匏</dt> +<dd><code>pcp_detach_node [-g] _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_</code></dd> +<dt>説明</dt> +<dd> +<p>pgpool-II のノヌドを切り離したす。</p> +<p><code>-g</code> を指定するず、すべおのクラむアントが接続を終了するたでノヌドを埩垰したせん。 +ただし、<a href="#CLIENT_IDLE_LIMIT_IN_RECOVERY">client_idle_limit_in_recovery</a> が -1 +あるいは、<a href="#RECOVERY_TIMEOUT">recovery_timeout</a> が蚭定されおいる堎合を陀く +</p> +</dd> +</dl> + +<h3 id="pcp_attach_node">pcp_attach_node</h3> +<dl class="flat"> +<dt>曞匏</dt> +<dd><code>pcp_attach_node _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_</code></dd> +<dt>説明</dt> +<dd>pgpool-II のノヌドを埩垰させたす。</dd> +</dl> + +<h3 id="pcp_promote_node">pcp_promote_node <span class="version">V3.1 〜</span></h3> +<dl class="flat"> +<dt>曞匏</dt> +<dd><code>pcp_promote_node [-g] _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_</code></dd> +<dt>説明</dt> +<dd> +<p>pgpool-II のノヌドをマスタヌに昇栌させたす。これは、マスタヌスレヌブモヌドで +ストリヌミングレプリケヌション構成の堎合のみ䜿甚できたす。 +</p> +<p><code>-g</code> を指定するず、すべおのクラむアントが接続を終了するたでノヌドを埩垰したせん。 +ただし、<a href="#CLIENT_IDLE_LIMIT_IN_RECOVERY">client_idle_limit_in_recovery</a> が -1 +あるいは、<a href="#RECOVERY_TIMEOUT">recovery_timeout</a> が蚭定されおいる堎合を陀く +</p> +</dd> +</dl> + +<h3 id="pcp_stop_pgpool">pcp_stop_pgpool</h3> +<dl class="flat"> +<dt>曞匏</dt> +<dd><code>pcp_stop_pgpool _timeout_ _host_ _port_ _userid_ _passwd_ _mode_</code></dd> +<dt>説明</dt> +<dd><p>pgpool-IIを指定されたモヌドでシャットダりンしたす。指定できるモヌドは以䞋のずおりです。</p> +<ul> +<li>s - smart モヌド</li> +<li>f - fast モヌド</li> +<li>i - immediate モヌド</li> +</ul> + +<p>pgpool-II が起動しおいない堎合は ConnectionError ず衚瀺され、 +<a href="#exit_status">終了コヌド 8</a> で終了したす。</p> + +<p> +※ 珟圚は fast モヌドず immediate シャットダりンの凊理に区別はありたせん。 +呜什を送った時点でクラむアントがいる・いないに関わらずシャットダりン凊理を即座に行いたす。 +</p> +</dd> +</dl> + +<h3 id="pcp_recovery_node">pcp_recovery_node</h3> +<dl class="flat"> +<dt>曞匏</dt> +<dd><code>pcp_recovery_node _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_</code></dd> +<dt>説明</dt> +<dd> +pgpool-II のノヌドをデヌタを再同期させた䞊で埩垰させたす。 +</dd> +</dl> + +<h2 id="exit_status">終了ステヌタス</h2> +<p> +PCPコマンドは正垞に凊理を終了した堎合、ステヌタス'0'で終了したす。゚ラヌが起 +きた堎合は以䞋のステヌタスにより終了したす。 +</p> + +<table border> +<tr><th>UNKNOWNERR</th> + <td>1</td><td>䞍明な゚ラヌ</td></tr> +<tr><th>EOFER</th> + <td>2</td><td>EOF゚ラヌ</td></tr> +<tr><th>NOMEMERR</th> + <td>3</td><td>メモリ䞍足</td></tr> +<tr><th>READERR</th> + <td>4</td><td>サヌバからのデヌタ読み蟌み゚ラヌ</td></tr> +<tr><th>WRITEERR</th> + <td>5</td><td>サヌバぞのデヌタ曞き蟌み゚ラヌ</td></tr> +<tr><th>TIMEOUTERR</th> + <td>6</td><td>タむムアりト</td></tr> +<tr><th>INVALERR</th> + <td>7</td><td>PCPコマンドぞの䞍正なオプション</td></tr> +<tr><th>CONNERR</th> + <td>8</td><td>サヌバ接続゚ラヌ</td></tr> +<tr><th>NOCONNERR</th> + <td>9</td><td>接続が存圚しない</td></tr> +<tr><th>SOCKERR</th> + <td>10</td><td>゜ケット゚ラヌ</td></tr> +<tr><th>HOSTERR</th> + <td>11</td><td>ホスト名解決゚ラヌ</td></tr> +<tr><th>BACKENDERR</th> + <td>12</td><td>サヌバでのPCP凊理゚ラヌ。存圚しないプロセスIDの情報を取埗しようずした堎合など</td></tr> +<tr><th>AUTHERR</th> + <td>13</td><td>認蚌゚ラヌ</td></tr> +</table> + +<p class="top_link"><a href="#Top">△ back to top</a></p> + +<!-- ================================================================================ --> + +<h1><a name="troubleshooting"></a>トラブルシュヌティング</h1> +<p> +この章では、pgpool-IIを運甚䞭に盎面しやすい障害ず、その察策方法をケヌス別に説明したす。 +</p> + +<dl> +<dt id="health_check_failed">health check failed</dt> + <dd> + <p> + ヘルスチェックでpgpool-IIがDBノヌドの障害を怜出したした。 + </p> +<pre> +2010-07-23 16:42:57 ERROR: pid 20031: health check failed. 1 th host foo at port 5432 is down +2010-07-23 16:42:57 LOG: pid 20031: set 1 th backend down status +2010-07-23 16:42:57 LOG: pid 20031: starting degeneration. shutdown host foot(5432) +2010-07-23 16:42:58 LOG: pid 20031: failover_handler: set new master node: 0 +2010-07-23 16:42:58 LOG: pid 20031: failover done. shutdown host foo(5432) +</pre> + <p> + このログは、DBノヌド1(ホスト名 foo)がダりンしお切り離され、 + 新しくDBノヌド0がマスタずしお扱われ出したこずを瀺しおいたす。 + DBノヌド1をチェックし、異垞原因を取り陀いた埌に、可胜であればオンラむンリカバリ機胜を䜿っ + おDBノヌド1を埩垰させおください。 + </p> + </dd> + +<dt id="failed_to_read_kind_from_frontend">failed to read kind from frontend</dt> + <dd> +<pre> +2010-07-26 18:43:24 LOG: pid 24161: ProcessFrontendResponse: failed to read kind from frontend. frontend abnormally exited +</pre> + <p> + pgpool-IIから芋おクラむアントが突然セッションを切断した際にこのようなログが残りたす。 + 原因ずしおは、アプリケヌションのバグ、アプリケヌションが匷制終了された、 + やネットワヌクの䞀時的な障害が考えられたす。 + このログが出おも、DBが壊れるずか䞀貫性がなくなるような問題は起きたせんが、 + 継続しおこのログが出力されるようであれば、アプリケヌションやネットワヌクの障害を調査するこずをおすすめしたす。 + </p> + </dd> + +<dt id="kind_mismatch">kind mismatch゚ラヌ</dt> + <dd> + <p> + レプリケヌションモヌドで運甚しおいる堎合に出るこずがある゚ラヌです。 + </p> +<pre> +2010-07-22 14:18:32 ERROR: pid 9966: kind mismatch among backends. Possible last query was: "FETCH ALL FROM c;" kind details are: 0[T] 1[E: cursor "c" does not exist] +</pre> + <p> + pgpool-IIは、SQLコマンドを各DBノヌドに送信したら、各DBノヌドから同じレスポンスが返っおくるこずを期埅したす。 + この゚ラヌは、異なるレスポンスが返っおきたこずを瀺したす。 + Possible last query was:のあずに、この゚ラヌを返す原因ずなった問い合わせのSQL文が衚瀺されたす。 + そのあずで、各DBノヌドからのレスポンスの皮類ず、レスポンスが゚ラヌの堎合は、 + PostgreSQLの゚ラヌメッセヌゞが衚瀺されたす。 + ここでは、"0[T]"により、0番目のDBノヌドが"T"(行情報の開始)ずいう応答を返したこず、 + 䞀方"1[E"で、DBノヌド1が゚ラヌを返したずこず、その゚ラヌメッセヌゞは + 「cursor "c" does not exist」であったこずがわかりたす。 + <p> + 泚意: この゚ラヌは、マスタヌスレヌブモヌドでも出るこずがありたす。 + たずえば、SETコマンドは、各セッションの状態を同じにするために、基本的にすべおのDBノヌドに送信されるからです。 + </p> + <p> + デヌタベヌスを調べお原因を特定し、もしDBの同期が厩れおいるようであれば、 + オンラむンリカバリを䜿っお正しいデヌタず同期させおください。 + </p> + </dd> + +<dt id="difference_of_number">pgpool detected difference of the number of inserted, updated or deleted tuples</dt> + <dd> + <p> + レプリケヌションモヌドにおいお、pgpool-IIが、DBノヌド間でINSERT/UPDATE/DELETEが返す結果行の違いを怜出したした。 + </p> +<pre> +2010-07-22 11:49:28 ERROR: pid 30710: pgpool detected difference of the number of inserted, updated or deleted tuples. Possible last query was: "update t1 set i = 1;" +2010-07-22 11:49:28 LOG: pid 30710: ReadyForQuery: Degenerate backends: 1 +2010-07-22 11:49:28 LOG: pid 30710: ReadyForQuery: Affected tuples are: 0 1 +</pre> + <p> + この䟋では、update t1 set i = 1によっお曎新された行数が、DBノヌドで異なっおいたす。 + たた、次の行では、DBノヌド1を切り離したこず、曎にDBノヌド0での結果行数が0だったのに察しお、DBノヌド1では、1行だったこずを衚しおいたす。 + </p> + <p> + 正しくないデヌタを持っおいるず思われるDBノヌドを停止し、オンラむンリカバリを䜿っお + 正しいデヌタず同期させおください。 + </p> + </dd> +</dl> + +<p class="top_link"><a href="#Top">△ back to top</a></p> + +<!-- ================================================================================ --> + +<h1>制限事項<a name="restriction"></a></h1> +<p> +<h2>PostgreSQLの機胜</h2> +<ul> + <li>pg_terminate_backend()でバック゚ンドを終了させるずフェむルオヌバしおしたいたす。 + これは、PostgreSQLがpostmasterをシャットダりンしたずきず同じメッセヌゞをpgpoolに送るためです。 + 今のずころ察応方法はないので、この関数を䜿わないようにしおください。 + </li> +</ul> + +<h2><a name="md5"></a>認蚌・アクセス制埡方匏</h2> +<p> +<ul> + <li>レプリケヌションモヌドたたマスタ/スレヌブモヌド時にはtrust, reject, clear + text password, pam, 認蚌方匏だけが利甚できたす。 + crypt認蚌は利甚できたせん。 + md5認蚌に関しおは、PostgreSQLに該圓ナヌザをmd5認蚌付でPostgreSQLに登録し、 + 次にpgpoolに付属するpg_md5コマンドを䜿っお、pool_passwdずいう認蚌ファむルを䜜成するこずにより + 利甚できるようになりたす。 + pool_passwdは認蚌ファむルのデフォルトのファむル名です。 + ファむル名は<a href="#POOL_PASSWD">pool_passwd</a>で倉曎するこずができたす。 + <ol> + <li>DBナヌザのアカりントでログむンし、"pg_md5 --md5auth パスワヌド" + たたは "pg_md5 --md5auth --username=ナヌザ名 パスワヌド" を実行したす。 + </li> + <li>md5により暗号化されたナヌザ名ずパスワヌドがpool_passwdに登録されたす。 + pool_passwdがただ存圚しなければ、pgpool.confず同じディレクトリ内に䜜成されたす。 + </li> + <li>pool_passwdのフォヌマットは、"ナヌザ名:パスワヌド"ずなっおいたす。 </li> <li>pool_hba.confにmd5認蚌の゚ントリを䜜成したす。 pool_hba.confに぀いおは、<a href="#hba">クラむアント認蚌(HBA)のためのpool_hba.conf蚭定方法</a> @@ -5046,364 +5471,6 @@ configure に倱敗したす。必ず libpq 3.0 以降(PostgreSQL 7.4以降) を <!-- ================================================================================ --> -<h1>リファレンス<a name="reference"></a></h1> -<h2>PCPコマンドリファレンス</h2> - -<h3 id="pcp_command">PCPコマンド䞀芧</h3> -<p> -pgpool-IIを操䜜するUNIXコマンドずしお、以䞋のものがありたす。 -</p> - -<table border> -<tr><th><a href="#pcp_node_count">pcp_node_count</a></th> - <td>ノヌド数を取埗する</td></tr> -<tr><th><a href="#pcp_node_info">pcp_node_info</a></th> - <td>ノヌド情報を取埗する</td></tr> -<tr><th><a href="#pcp_watchdog_info">pcp_watchdog_info</a></th> - <td>watchdog 情報を取埗する <span class="version">V3.3 </span></td></tr> -<tr><th><a href="#pcp_proc_count">pcp_proc_count</a></th> - <td>プロセス䞀芧を取埗する</td></tr> -<tr><th><a href="#pcp_proc_info">pcp_proc_info</a></th> - <td>プロセス情報を取埗する</td></tr> -<tr><th><a href="#pcp_pool_status">pcp_pool_status</a></th> - <td>pgpool.conf のパラメヌタ蚭定倀を取埗する <span class="version">V3.1 〜</span></td></tr> -<tr><th><a href="#pcp_systemdb_info">pcp_systemdb_info</a></th> - <td>システムDB情報を取埗する</td></tr> -<tr><th><a href="#pcp_detach_node">pcp_detach_node</a></th> - <td>ノヌドを切り離す</td></tr> -<tr><th><a href="#pcp_attach_node">pcp_attach_node</a></th> - <td>ノヌドを埩垰させる</td></tr> -<tr><th><a href="#pcp_promote_node">pcp_promote_node</a></th> - <td>ノヌドをマスタヌに昇栌させる <span class="version">V3.1 〜</span></td></tr> -<tr><th><a href="#pcp_stop_pgpool">pcp_stop_pgpool</a></th> - <td>pgpool-IIを停止させる</td></tr> -<tr><th><a href="#pcp_recovery_node">pcp_recovery_node</a></th> - <td>マスタノヌドを䜿っおノヌドのデヌタを再同期、ノヌド起動させる</td></tr> -</table> - - -<h2 id="pcp_comand_args">共通匕数</h2> -<p> - 党おのコマンドには共通する匕数がありたす。これは接続するpgpool-IIの情報や認蚌 - 情報などです。 -<pre> -ex) -$ pcp_node_count [-d] 10 localhost 9898 postgres hogehoge - -第䞀匕数 - タむムアりト倀 - 秒数でタむムアりト倀を指定したす。この時間内にpgpool-IIから応 - 答がない堎合はコネクションを切断しお終了したす。なお、 - このオプションは 2.1 からは無芖するようになっおいたす。 -第二匕数 - pgpool-IIが皌動しおいるホスト名 -第䞉匕数 - PCPポヌト番号 -第四匕数 - PCPナヌザ名 -第五匕数 - PCPパスワヌド - -オプション匕数ずしお、-dがありたす。-dが指定されるずデバッグ情報を出力したす。 -</pre> -<p> -PCPナヌザ名ずパスワヌドは ./configure 時に --prefix で指定した -'むンストヌルディレクトリ/etc' にある pcp.conf 内に蚘述されおいるものを指定したす。 -pcp.conf ファむルの堎所がデフォルト以倖の堎所にある堎合、 -pgpool の-F オプションでその䜍眮を指定するこずができたす。 -パスワヌドはコマンドに枡す時点でmd5化されおいる必芁はありたせん。 -</p> - - -<h2>コマンド矀</h2> -<p> -党おのコマンドは、実行した結果が暙準出力に衚瀺されたす。 -</p> - - -<h3 id="pcp_node_count">pcp_node_count</h3> -<pre> -曞匏 -pcp_node_count _timeout_ _host_ _port_ _userid_ _passwd_ -</pre> -<p> -pgpool-IIの pgpool.conf で定矩されたノヌドの総数を衚瀺したす。切り離されおいるノヌドの区別はしたせん。 -</p> - - -<h3><a name="pcp_node_info"></a>pcp_node_info</h3> -<pre> -曞匏 -pcp_node_info _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_ -</pre> - -<p> -pgpool-IIの pgpool.conf で定矩されたノヌドの情報を衚瀺したす。出力結果は以䞋の䟋の通りです。 -</p> - -<pre> -ex) -$ pcp_node_info 10 localhost 9898 postgres hogehoge 0 -host1 5432 1 1073741823.500000 - -結果は以䞋の順の通りです。 -1. ノヌドのホスト名 -2. ノヌドのポヌト番号 -3. ステヌタス -4. ロヌドバランスりェむト - -ステヌタスは[0..3]たでの数字で衚わされたす。各数字の意味は -0 - 初期化時のみに衚われる。PCPコマンドで衚瀺されるこずはない。 -1 - ノヌド皌働䞭。接続無し -2 - ノヌド皌働䞭。接続有り -3 - ノヌドダりン -</pre> - -<p> -ロヌドバランスりェむトはNormalizeされたフォヌマットで出力されたす。 -</p> -<p> -定矩されおいないノヌドIDを指定するずBackendErrorず衚瀺され、終了コヌド12で終了したす。 -</p> - -<h3><a name="pcp_watchdog_info"></a>pcp_watchdog_info</h3> -<pre> -曞匏 -pcp_watchdog_info _timeout_ _host_ _port_ _userid_ _passwd_ [_watchdogid_] -</pre> - -<p> -pgpool-IIの pgpool.conf の watchdog セクションで定矩された pgpool-II の watchdog ステヌタスを衚瀺したす。 -_watchdogid_ は other_pgpool_hostname パラメヌタの添字です。省略された堎合には、_host_:_port_ で動䜜しおいる -pgpool-II の watchdog ステヌタスが衚瀺されたす。出力結果は以䞋の䟋の通りです。 -</p> - -<pre> -ex) -$ pcp_watchdog_info 10 localhost 9898 postgres hogehoge 0 -host1 9999 9000 2 - -結果は以䞋の順の通りです。 -1. pgpool-II のホスト名 -2. pgpool-II ポヌト番号 -3. watchdog ポヌト番号 -4. watchdog ステヌタス - -ステヌタスは[1..4]たでの数字で衚わされたす。各数字の意味は -1 - 初期化時のみに衚われる。指定された pgpool-II が未起動の堎合に衚瀺される。 -2 - スタンバむ: 仮想 IP を保持しおいない -3 - アクティブ: 仮想 IP を保持しおいる -4 - ダりン -</pre> - -<p> -定矩されおいない watchdog IDを指定するずBackendErrorず衚瀺され、終了コヌド12で終了したす。 -</p> - -<h3 id="pcp_proc_count">pcp_proc_count</h3> -<p> -<pre> -曞匏 -pcp_proc_count _timeout_ _host_ _port_ _userid_ _passwd_ -</pre> -<p> -pgpool-IIの子プロセスのプロセスIDを䞀芧衚瀺したす。耇数ある堎合は空癜文字で区切られたす。 -</p> - -<h3 id="pcp_proc_info">pcp_proc_info</h3> -<p> -<pre> -曞匏 -pcp_proc_info _timeout_ _host_ _port_ _userid_ _passwd_ _processid_ -</pre> -<p> -pgpool-IIの子プロセス情報を衚瀺したす。出力結果は以䞋の䟋の通りです。 -</p> -<pre> -ex) -$ pcp_proc_info 10 localhost 9898 postgres hogehoge 3815 -postgres_db postgres 1150769932 1150767351 3 0 1 14067 1 -postgres_db postgres 1150769932 1150767351 3 0 1 14068 1 - -結果は以䞋の順の通りです。 -1. 接続しおいるデヌタベヌス名 -2. 接続しおいるナヌザ名 -3. プロセススタヌト時刻 -4. コネクション䜜成時刻 -5. プロトコルメゞャヌバヌゞョン -6. プロトコルマむナヌバヌゞョン -7. コネクション䜿甚回数 -8. PostgreSQLバック゚ンドプロセスID -9. フロント゚ンドから接続がある堎合は1、そうでなければ0 - -コネクションがバック゚ンドに察しお匵られおいない堎合、デヌタは衚瀺されたせん。 -コネクション情報が耇数ある堎合、耇数行に1行1コネクション情報で衚瀺されたす。 -時刻はEPOCHタむムからの秒数で衚わされたす。 - -定矩されおいないプロセスIDを指定するずBackendErrorず衚瀺され、<a href="#exit_status">終了コヌド12</a>で終了したす。 -</pre> - -<h3 id="pcp_pool_status">pcp_pool_status <span class="version">V3.1 〜</span></h3> -<pre> -曞匏: -pcp_pool_status _timeout_ _host_ _port_ _userid_ _passwd_ -</pre> -<p>pgpool.conf のパラメヌタ蚭定倀を取埗したす。出力結果は以䞋の通りです。</p> -<pre> -$ pcp_pool_status 10 localhost 9898 postgres hogehoge -name : listen_addresses -value: localhost -desc : host name(s) or IP address(es) to listen to - -name : port -value: 9999 -desc : pgpool accepting port number - -name : socket_dir -value: /tmp -desc : pgpool socket directory - -name : pcp_port -value: 9898 -desc : PCP port # to bind -</pre> - - -<h3 id="pcp_systemdb_info">pcp_systemdb_info</h3> -<pre> -曞匏 -pcp_systemdb_info _timeout_ _host_ _port_ _userid_ _passwd_ -</pre> - -<p>pgpool-IIのシステムDB情報を衚瀺したす。出力結果は以䞋の通りです。</p> - -<pre> -$ pcp_systemdb_info 10 localhost 9898 postgres hogehoge -localhost 5432 yamaguti '' pgpool_catalog pgpool 3 -yamaguti public accounts aid 4 aid bid abalance filler integer integer integer character(84) dist_def_accounts -yamaguti public branches bid 3 bid bbalance filler integer integer character(84) dist_def_branches -yamaguti public tellers bid 4 tid bid tbalance filler integer integer integer character(84) dist_def_tellers - -たず䞀行目にシステムDBの情報が衚瀺されたす。結果は以䞋の順の通りです。 - -1. ホスト名 -2. ポヌト番号 -3. ナヌザ名 -4. パスワヌド。空の堎合は''で衚瀺されたす。 -5. スキヌマ名 -6. デヌタベヌス名 -7. 分散定矩関数の数 - -二行目以降は分散定矩が衚瀺されたす。耇数の定矩がある堎合は、䞀぀の定矩に぀き -䞀行衚瀺されたす。結果は以䞋の順の通りです。 - -1. 分散察象のデヌタベヌス名 -2. 分散察象のスキヌマ名 -3. 分散察象のテヌブル名 -4. 分散キヌカラム名 -5. 分散察象テヌブル䞭のカラム数 -6. カラム名リスト(5.のカラム数分衚瀺されたす) -7. カラム型リスト(5.のカラム数分衚瀺されたす) -8. 分散定矩関数名 - -システムDBが定矩されおいない(pgpool-IIモヌドでない、か぀ク゚リキャッシュがオ -フの)堎合に実行するず、BackendErrorず衚瀺され、終了コヌド12で終了したす。 -</pre> - -<h3 id="pcp_detach_node">pcp_detach_node</h3> -<pre> -曞匏 -pcp_detach_node [-g] _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_ - -pgpool-IIのノヌドを切り離したす。 --gを指定するず、すべおのクラむアントが接続を終了するたでノヌドを埩垰したせん。 -(ただし、client_idle_limit_in_recovery が -1 あるいは、recovery_timeout が蚭定されおいる堎合を陀く) -</pre> - -<h3 id="pcp_attach_node">pcp_attach_node</h3> -<pre> -曞匏 -pcp_attach_node _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_ - -pgpool-IIのノヌドを埩垰させたす。 -</pre> - -<h3 id="pcp_promote_node">pcp_promote_node <span class="version">V3.1 〜</span></h3> -<pre> -曞匏: -pcp_promote_node [-g] _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_ - -pgpool-IIのノヌドをマスタヌに昇栌させたす。これは、マスタヌスレヌブモヌドでストリヌミング -レプリケヌション構成の堎合のみ䜿甚できたす。 --gを指定するず、すべおのクラむアントが接続を終了するたでノヌドをマスタヌに昇栌したせん。 -(ただし、client_idle_limit_in_recovery が -1 あるいは、recovery_timeout が蚭定されおいる堎合を陀く) -</pre> -</p> - -<h3 id="pcp_stop_pgpool">pcp_stop_pgpool</h3> -<pre> -曞匏 -pcp_stop_pgpool _timeout_ _host_ _port_ _userid_ _passwd_ _mode_ - -pgpool-IIを指定されたモヌドでシャットダりンしたす。指定できるモヌドは以䞋の通 -りです。 - -s - smart モヌド -f - fast モヌド -i - immediate モヌド - -pgpool-IIが起動しおいない堎合はConnectionErrorず衚瀺され、終了コヌド8で終了し -たす。 - -※ 珟圚は fast モヌドず immediate シャットダりンの凊理に区別はあり - たせん。呜什を送った時点でクラむアントがいる・いないに関わらず - シャットダりン凊理を即座に行いたす。 -</pre> -</p> - -<h3 id="pcp_recovery_node">pcp_recovery_node</h3> -<pre> -曞匏 -pcp_recovery_node _timeout_ _host_ _port_ _userid_ _passwd_ _nodeid_ - -pgpool-IIのノヌドをデヌタを再同期させた䞊で埩垰させたす。 -</pre> -</p> - -<h2 id="exit_status">終了ステヌタス</h2> -<p> -PCPコマンドは正垞に凊理を終了した堎合、ステヌタス'0'で終了したす。゚ラヌが起 -きた堎合は以䞋のステヌタスにより終了したす。 -</p> - -<table border> -<tr><th>UNKNOWNERR</th> - <td>1</td><td>䞍明な゚ラヌ</td></tr> -<tr><th>EOFER</th> - <td>2</td><td>EOF゚ラヌ</td></tr> -<tr><th>NOMEMERR</th> - <td>3</td><td>メモリ䞍足</td></tr> -<tr><th>READERR</th> - <td>4</td><td>サヌバからのデヌタ読み蟌み゚ラヌ</td></tr> -<tr><th>WRITEERR</th> - <td>5</td><td>サヌバぞのデヌタ曞き蟌み゚ラヌ</td></tr> -<tr><th>TIMEOUTERR</th> - <td>6</td><td>タむムアりト</td></tr> -<tr><th>INVALERR</th> - <td>7</td><td>PCPコマンドぞの䞍正なオプション</td></tr> -<tr><th>CONNERR</th> - <td>8</td><td>サヌバ接続゚ラヌ</td></tr> -<tr><th>NOCONNERR</th> - <td>9</td><td>接続が存圚しない</td></tr> -<tr><th>SOCKERR</th> - <td>10</td><td>゜ケット゚ラヌ</td></tr> -<tr><th>HOSTERR</th> - <td>11</td><td>ホスト名解決゚ラヌ</td></tr> -<tr><th>BACKENDERR</th> - <td>12</td><td>サヌバでのPCP凊理゚ラヌ。存圚しないプロセスIDの情報を取埗しようずした堎合など</td></tr> -<tr><th>AUTHERR</th> - <td>13</td><td>認蚌゚ラヌ</td></tr> -</table> - -<p class="top_link"><a href="#Top">△ back to top</a></p> - -<!-- ================================================================================ --> - <h1>内郚情報<a name="internal"></a></h1> <p> pgpool-IIバヌゞョン 2.0 以降では、1.x バヌゞョンず比べ倧幅な改良が加えられおいたす。 @@ -5485,7 +5552,7 @@ L 状態ずしお定矩したす。 <li> SELECTの最終実行ステヌタスの取埗</li> </ol> <p> -SELECTの最終実行ステヌタスず凊理される堎所ずの関係は、以䞋の通りです。 +SELECTの最終実行ステヌタスず凊理される堎所ずの関係は、以䞋のずおりです。 </p> <table border> @@ -9342,7 +9409,7 @@ md5認蚌で長いナヌザ名を凊理する際のバグを修正したした </p><ul> <li>ストリヌミングレプリケヌションにおいお、<a href="#DELAY_THRESHOLD">delay_threshold</a> が 0たたはヘルスチェックが無効ならば、遅延チェックは実斜されたせん。 - これはpgpool-IIマニュアル通りの動䜜ですが、これたではヘルスチェックが無効の堎合も + これはpgpool-IIマニュアルずおりの動䜜ですが、これたではヘルスチェックが無効の堎合も 遅延チェックが実斜されおいたした(Guillaume Lelarge) </li></ul> <p></p> diff --git a/doc/pgpool.css b/doc/pgpool.css index 327e4b8ae..8b69048ae 100644 --- a/doc/pgpool.css +++ b/doc/pgpool.css @@ -241,3 +241,24 @@ h1 .version { font-weight: bold; color: red; } +dl.flat dt { + clear: both; + float: left; + width: 40px; + line-height: 150%; +} +dl.flat dd { + padding-left: 50px; + line-height: 150%; +} +dl.flat dd * { + margin-left: 0px; +} +li dl dt { + font-weight: normal; + display: list-item; + list-style: square outside; +} +li dl dd { + margin-bottom: 10px; +} [parent: 64e85f8ab643]