{ "info": { "author": "Hannu Valtonen", "author_email": "hannu.valtonen@ohmu.fi", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Database :: Database Engines/Servers", "Topic :: Software Development :: Libraries" ], "description": "pglookout |BuildStatus|_\n========================\n\n.. |BuildStatus| image:: https://travis-ci.org/ohmu/pglookout.png?branch=master\n.. _BuildStatus: https://travis-ci.org/ohmu/pglookout\n\npglookout is a PostgreSQL replication monitoring and failover daemon.\npglookout monitors PG database nodes and their replication status and acts\naccording to that status, for example calling a predefined failover command\nto promote a new master in case the previous one goes missing.\n\npglookout supports two different node types, ones that are installed on the\ndb nodes themselves, and observer nodes that can be installed anywhere. The\npurpose of pglookout on the PostgreSQL DB nodes is to monitor the replication\nstatus of the cluster and act accordingly, the observers have a more limited\nremit: they just observe the cluster status to give another viewpoint to the\ncluster state.\n\nA single observer can observe any number of PostgreSQL replication\nclusters simultaneously. This makes it possible to share an observer\nbetween multiple replication clusters. In general it is recommended\nthat you run with at least one external observer giving an additional\nviewpoint on the health of the cluster.\n\n\nRequirements\n============\n\npglookout can monitor PostgreSQL versions 9.1 and above. Previous versions don't\nprovide enough replication information to support pglookout.\n\npglookout has been developed and tested on modern Linux x86-64 systems, but\nshould work on other platforms that provide the required modules. pglookout is\nimplemented in Python and works with CPython versions 2.7 and 3.3 or\nnewer. pglookout depends on the Requests_ and Psycopg2_ Python modules.\n\n.. _`Requests`: http://www.python-requests.org/en/latest/\n.. _`Psycopg2`: http://initd.org/psycopg/\n\n\nBuilding\n========\n\nTo build an installation package for your distribution, go to the root\ndirectory of a pglookout Git checkout and then run:\n\nDebian::\n\n make deb\n\nThis will produce a .deb package into the parent directory of the Git checkout.\n\nFedora::\n\n make rpm\n\nThis will produce a ``.rpm`` package into ``rpm/RPMS/noarch/``.\n\nPython/Other::\n\n python setup.py bdist_egg\n\nThis will produce an egg file into a dist directory within the same folder.\n\n\nInstallation\n============\n\nTo install it run as root:\n\nDebian::\n\n dpkg -i ../pglookout*.deb\n\nFedora::\n\n dnf install rpm/RPMS/noarch/*\n\nOn Linux systems it is recommended to simply run ``pglookout`` under\n``systemd``::\n\n systemctl enable pglookout.service\n\nand eventually after the setup section, you can just run::\n\n systemctl start pglookout.service\n\nPython/Other::\n\n easy_install dist/pglookout-1.4.0-py2.7.egg\n\nOn systems without ``systemd`` it is recommended that you run ``pglookout``\nunder Supervisor_ or other similar process control system.\n\n.. _`Supervisor`: http://supervisord.org\n\n\nSetup\n=====\n\nAfter this you need to create a suitable JSON configuration file for your\ninstallation.\n\n1. Create a suitable PostgreSQL user account for pglookout::\n\n CREATE USER pglookout PASSWORD 'putyourpasswordhere';\n\n2. Edit the local ``pg_hba.conf`` to allow access for the newly\n created account to the ``postgres`` (or other suitable database of your choice)\n from the master, slave and possible observer nodes. While pglookout will\n only need to run a few builtin functions within the database, it is\n still recommended to setup a separate empty database for this\n use. Remember to reload the configuration with either::\n\n SELECT pg_reload_conf();\n\n or by sending directly a ``SIGHUP`` to the PostgreSQL postmaster process.\n\n3. Fill in the created user account and master/slave/observer\n addresses into the configuration file ``pglookout.json`` to the\n section ``remote_conns``.\n\n4. Create a failover script and add the path to it into the\n configuration key ``failover_command``. As an example\n failover script, a shell script that uses IP aliasing is provided\n in the examples. It is recommended to provide some way to provide\n STONITH (Shoot The Other Node In The Head) capability in the\n script. Other common methods of doing the failover and getting DB\n traffic diverted to the newly promoted master are the switching of\n PgBouncer (or other poolers) traffic, or changes in PL/Proxy configuration.\n\n You should try to run the failover script you provide with pglookout's\n user privileges to see that it does indeed work.\n\n5. Now copy the same ``pglookout.json`` configuration to the slave\n and possible observer nodes but you need to edit the configuration\n on the other nodes so that the ``own_db`` configuration\n variable matches the ``remote_conns`` key of the node.\n For observer nodes, you can leave it as an empty '' value, since they\n don't have a DB of their own.\n\nOther possible configuration settings are covered in more detail\nunder the `Configuration keys`_ section of this README.\n\n6. If all has been set up correctly up to this point, pglookout should\n now be ready to be started.\n\n\nAlert files\n===========\n\nAlert files are created whenever an error condition that requires\nhuman intervention to solve. You're recommended to add checks for the\nexistence of these files to your alerting system.\n\n``authentication_error``\n\nThere has been a problem in the authentication of at least one of the\nPostgreSQL connections. This usually denotes either a wrong\nusername/password or incorrect ``pg_hba.conf`` settings.\n\n``multiple_master_warning``\n\nThis alert file is created when multiple masters are detected in the\nsame cluster.\n\n``replication_delay_warning``\n\nThis alert file is created when replication delay goes over the set\nwarning limit. (this is warning is an exception to the rule that human\nintervention is required. It is only meant as an informative heads up\nalert that a failover may be imminent. In case the replication delay\ndrops below the warning threshold again, the alert will be removed)\n\n``failover_has_happened``\n\nThis alert file is created whenever the failover command has been\nissued.\n\n\nGeneral notes\n=============\n\nIf correctly installed, pglookout comes with two executables,\n``pglookout`` and ``pglookout_current_master`` that both take as\ntheir arguments the path to the node's JSON configuration file.\n\n``pglookout`` is the main process that should be run under systemd or\nsupervisord.\n\n``pglookout_current_master`` is a helper that will simply parse the\nstate file and return which node is the current master.\n\nWhile pglookout is running it may be useful to read the JSON state\nfile that exists where ``json_state_file_path`` points. The JSON\nstate file is human readable and should give an understandable\ndescription of the current state of the cluster which is under monitoring.\n\n\nConfiguration keys\n==================\n\n``autofollow`` (default ``false``)\n\nDo you want pglookout to try to start following the new master. Useful\nin scenarios where you have a master and two standbys, master dies\nand another standby is promoted. This will allow the remaining standby\nto start following the new master. Requires ``pg_data_directory``, ``pg_start_command``\nand ``pg_stop_command`` configuration keys to be set.\n\n``db_poll_interval`` (default ``5.0``)\n\nInterval on how often should the connections defined in remote_conns\nbe polled for information on DB replication state.\n\n``remote_conns`` (default ``{}``)\n\nPG database connection strings that the pglookout process should monitor.\nKeys of the object should be names of the remotes and values must be valid\nPostgreSQL connection strings or connection info objects.\n\n``primary_conninfo_template``\n\nConnection string or connection info object template to use when setting a new\nprimary_conninfo value for recovery.conf after a failover has happened. Any\nprovided hostname and database name in the template is ignored and they are\nreplaced with a replication connection to the new master node.\n\nRequired when ``autofollow`` is true.\n\n``observers`` (default ``{}``)\n\nThis object contains key value pairs like ``{\"1.2.3.4\":\n\"http://2.3.4.5:15000\"}``. They are used to determine the location of\npglookout observer processes. Observers are processes that don't take any\nactions, but simply give a third party viewpoint on the state of the\ncluster. Useful especially during net splits.\n\n``http_address`` (default ``\"\"``)\n\nHTTP webserver address, by default pglookout binds to all interfaces.\n\n``http_port`` (default ``15000``)\n\nHTTP webserver port.\n\n``replication_state_check_interval`` (default ``10.0``)\n\nHow often should pglookout check the replication state in order to\nmake decisions on should the node be promoted.\n\n``failover_sleep_time`` (default ``0.0``)\n\nTime to sleep after a failover command has been issued.\n\n``maintenance_mode_file`` (default ``\"/tmp/pglookout_maintenance_mode_file\"``)\n\nIf a file exists in this location, this node will not be considered\nfor promotion to master.\n\n``missing_master_from_config_timeout`` (default ``15``)\n\nIn seconds the amount of time before we do a failover decision if a\npreviously existing master has been removed from the config file and\nwe have gotten a SIGHUP.\n\n``alert_file_dir`` (default ``os.getcwd()``)\n\nDirectory in which alert files for replication warning and failover\nare created.\n\n``json_state_file_path`` (default ``\"/tmp/pglookout_state.json\"``)\n\nLocation of a JSON state file which describes the state of the\npglookout process.\n\n``max_failover_replication_time_lag`` (default ``120.0``)\n\nReplication time lag after which failover_command will be executed and a\nfailover_has_happened file will be created.\n\n``warning_replication_time_lag`` (default ``30.0``)\n\nReplication time lag at which point to execute\nover_warning_limit_command and to create a warning file.\n\n``failover_command`` (default ``\"\"``)\n\nShell command to execute in case the node has deemed itself in need of promotion\n\n``never_promote_these_nodes`` (default ``[]``)\n\nLists the nodes that will never be considered valid for promotion. As\nin if you have master m which fails and standby a and b. b is ahead but is listed\nin never_promote_these_nodes, a will be promoted.\n\n``over_warning_limit_command`` (default ``null``)\n\nShell command to be executed once replication lag is warning_replication_time_lag\n\n``own_db``\n\nThe key of the entry in ``remote_conns`` that matches this node.\n\n``log_level`` (default ``\"INFO\"``)\n\nDetermines log level of pglookout.\n\n``pg_data_directory`` (default ``\"/var/lib/pgsql/data\"``)\n\nPG data directory that needs to be set when autofollow has been turned on.\nNote that pglookout needs to have the permissions to write there. (specifically\nto recovery.conf)\n\n``pg_start_command`` (default ``\"\"``)\n\nCommand to start a PostgreSQL process on a node which has autofollow set to\ntrue. Usually something like \"sudo systemctl start postgresql\".\n\n``pg_stop_command`` (default ``\"\"``)\n\nCommand to stop a PostgreSQL process on a node which has autofollow set to\ntrue. Usually something like \"sudo systemctl start postgresql\".\n\n``syslog`` (default ``false``)\n\nDetermines whether syslog logging should be turned on or not.\n\n``syslog_address`` (default ``\"/dev/log\"``)\n\nDetermines syslog address to use in logging (requires syslog to be\ntrue as well)\n\n``syslog_facility`` (default ``\"local2\"``)\n\nDetermines syslog log facility. (requires syslog to be true as well)\n\n``statsd`` (default: disabled)\n\nEnables metrics sending to a statsd daemon that supports the StatsD /\nTelegraf syntax with tags.\n\nThe value is a JSON object::\n\n {\n \"host\": \"\",\n \"port\": \"\",\n \"tags\": {\n \"\": \"\"\n }\n }\n\nThe ``tags`` setting can be used to enter optional tag values for the metrics.\n\nMetrics sending follows the `Telegraf spec`_.\n\n.. _`Telegraf spec`: https://github.com/influxdata/telegraf/tree/master/plugins/inputs/statsd\n\n\nLicense\n=======\n\npglookout is licensed under the Apache License, Version 2.0. Full license\ntext is available in the ``LICENSE`` file and at\nhttp://www.apache.org/licenses/LICENSE-2.0.txt\n\n\nCredits\n=======\n\npglookout was created by Hannu Valtonen for\nF-Secure_ and is now maintained by `Ohmu Ltd`_ hackers and `Aiven Cloud\nDatabase`_ developers .\n\n.. _`F-Secure`: https://www.f-secure.com/\n.. _`Ohmu Ltd`: https://ohmu.fi/\n.. _`Aiven Cloud Database`: https://aiven.io/\n\nRecent contributors are listed on the GitHub project page,\nhttps://github.com/ohmu/pglookout/graphs/contributors\n\n\nContact\n=======\n\nBug reports and patches are very welcome, please post them as GitHub issues\nand pull requests at https://github.com/ohmu/pglookout . Any possible\nvulnerabilities or other serious issues should be reported directly to the\nmaintainers .\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ohmu/pglookout/", "keywords": "", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "pglookout", "package_url": "https://pypi.org/project/pglookout/", "platform": "POSIX", "project_url": "https://pypi.org/project/pglookout/", "project_urls": { "Homepage": "https://github.com/ohmu/pglookout/" }, "release_url": "https://pypi.org/project/pglookout/1.4.0/", "requires_dist": null, "requires_python": "", "summary": "PostgreSQL replication monitoring and failover daemon", "version": "1.4.0" }, "last_serial": 2934648, "releases": { "1.2.0.dev66": [ { "comment_text": "", "digests": { "md5": "f89baece19592af1213045062e8bcfee", "sha256": "7b15e12fac61660c178aaa19a338c42ce59c03a7479f528f633db36e6816b414" }, "downloads": -1, "filename": "pglookout-1.2.0.dev66.tar.gz", "has_sig": false, "md5_digest": "f89baece19592af1213045062e8bcfee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33673, "upload_time": "2016-05-31T19:17:12", "url": "https://files.pythonhosted.org/packages/87/0e/8510f38f061f1b3604256ecfb4effc12f1201d85472d907c6e9af92022b4/pglookout-1.2.0.dev66.tar.gz" } ], "1.3.0": [], "1.3.1": [ { "comment_text": "", "digests": { "md5": "80710e444b8f75425a231a5816b8500a", "sha256": "85b6dc1dd5238e0e700ce1ea16f6b651458c847d43403c126e67a5be846d0b62" }, "downloads": -1, "filename": "pglookout-1.3.1.tar.gz", "has_sig": false, "md5_digest": "80710e444b8f75425a231a5816b8500a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33658, "upload_time": "2016-05-31T19:20:49", "url": "https://files.pythonhosted.org/packages/86/f7/abc150f4056028d795453c4a09bb0a06d169e1ec28f85224503e43bd414f/pglookout-1.3.1.tar.gz" } ], "1.4.0": [ { "comment_text": "", "digests": { "md5": "36ddee4c49054bf2dc6014c293ff1bdd", "sha256": "dfd87e771159415248f924c2817f19e7a02fe7b19d97b26888dbf7f4d68f3efc" }, "downloads": -1, "filename": "pglookout-1.4.0.tar.gz", "has_sig": false, "md5_digest": "36ddee4c49054bf2dc6014c293ff1bdd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 42373, "upload_time": "2017-06-08T07:43:17", "url": "https://files.pythonhosted.org/packages/1b/bd/52a9b86b9522977bf650a1c7f792def50770cd721759af91ac997e407bab/pglookout-1.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "36ddee4c49054bf2dc6014c293ff1bdd", "sha256": "dfd87e771159415248f924c2817f19e7a02fe7b19d97b26888dbf7f4d68f3efc" }, "downloads": -1, "filename": "pglookout-1.4.0.tar.gz", "has_sig": false, "md5_digest": "36ddee4c49054bf2dc6014c293ff1bdd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 42373, "upload_time": "2017-06-08T07:43:17", "url": "https://files.pythonhosted.org/packages/1b/bd/52a9b86b9522977bf650a1c7f792def50770cd721759af91ac997e407bab/pglookout-1.4.0.tar.gz" } ] }