Skip to main content

Pgpool-II Communication Protocol(PCP) library.

Project description

Python library for Pgpool-II Communication Protocol(PCP).

pyPCP provides a interface for administrators to perform management operation, such as getting Pgpool-II status or terminating Pgpool-II processes remotely.

Pgpool-II installation is not required on local machine

Installing

Install and Update using pip.

$ pip install pypcp

Example Usage

from pypcp import PCP, ResultStateType

pcp = PCP()
pcp.pcp_connect('remote_ip', 9898, 'postgres', 'secret')
result = pcp.pcp_node_count()
if result and pcp.PCPResultStatus(result) == ResultStateType.COMMAND_OK:
     print('Node Count  : ', result.pcp_get_data(0))
pcp.pcp_disconnect()
$ Node Count  : 2

JSON Support

You can also get results for each command in JSON format.

print(result.pcp_get_json_data(0))
$ {'command_status': 'success', 'node_count': 2}

Supported Commands

Following commands are supported by pyPCP. Details about each command can be found at PCP Commands

  • pcp_proc_count

  • pcp_proc_info

  • pcp_attach_node

  • pcp_detach_node

  • pcp_stop_pgpool

  • pcp_pool_status

  • pcp_node_count

  • pcp_watchdog_info

  • pcp_node_info

  • pcp_stop_pgpool

  • pcp_promote_node

  • pcp_recovery_node

  • pcp_health_check_stats

  • pcp_reload_config

  • pcp_set_backend_parameter

PCP_CLI

Based on pyPCP library, a cli utility is also available with name pcp_cli pcp_cli provide functionality of all pcp_* utilities provided with Pgpool-II in a single app. Multiple commands are available with there respective sub-commands/groups.

Following example show ‘pcp_cli node count’:

$ pcp_cli node count -U postgres -H pgpool_host -v
Password:
Node Count
____________
2

List of pcp_cli commands & sub-commands:

  • pool status

  • pool stop

  • pool reload-config

  • pool check-health-stats

  • node count

  • node info

  • node attach

  • node detach

  • node promote

  • node recovery

  • process count

  • process info

  • watchdog info

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypcp-1.0.0rc1.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypcp-1.0.0rc1-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file pypcp-1.0.0rc1.tar.gz.

File metadata

  • Download URL: pypcp-1.0.0rc1.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.9

File hashes

Hashes for pypcp-1.0.0rc1.tar.gz
Algorithm Hash digest
SHA256 31a0372ce654fa68755c8e769ee6b34b3b4795a22bbd45627d239365731af866
MD5 59334008f7ebc563da79a9bf1b54544e
BLAKE2b-256 19797ae791b122094177ca32d8ec61f5e01f15db4d74f637cd2a7299358960de

See more details on using hashes here.

File details

Details for the file pypcp-1.0.0rc1-py3-none-any.whl.

File metadata

  • Download URL: pypcp-1.0.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.9

File hashes

Hashes for pypcp-1.0.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 c0472933ad70c8545d1a6f6eaeb39988a7f63d546015ae98394572e871b412ce
MD5 360af903ff44e6a463e079613e22f2ee
BLAKE2b-256 cac69eda4777f49c3d726c8f5c1b9c8d0d1b83f2eac2fc514086eefaf219e811

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page