Giter VIP home page Giter VIP logo

pypcp's Introduction

pyPCP

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

pypcp's People

Contributors

uhayat avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

bellyfat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.