Postgres process management.
Use this module to initialize a postgres data directory and to manage a postgres server.
POSTGRES_VERSION - if specified, this will be the default version of postgres. The documentation for the Manager class describes how the version of postgres is chosen.
Postgres manager object.
Selecting the postgres version:
Parameters: |
|
---|---|
Raises : | DatabaseException if data directory initialization fails. |
Return the process object.
Wait until the worker subprocess is responding to requests.
Parameters: |
|
---|---|
Raises : | WorkerError if the worker is not ready within the time limit. |
Raises : | WorkerError if there is no subprocess. |
Launch the postgres process.
Parameters: |
|
---|---|
Raises : | OSError if postgres fails to launch. |
Terminate the worker subprocess.
Parameters: |
|
---|
Wait for the worker process to exit.
Make sure we have permission to create a postgres postfile.
Raises : | DatabaseException if we do not have write permission on the lockfile directory. |
---|
Select the default version of postgres to use.
If the environment variable POSTGRES_VERSION is set, use that. Otherwise, use the largest numbered directory in /usr/lib/postgresql.
Returns: | the default version of postgres, or None if we can’t determine the default postgres version. |
---|
Return a new environment with Postgres bin directories append to the end.
Initialize a postgres data directory.
Parameters: |
|
---|---|
Raises : | OSError if subprocess execution fails. |
Raises : | DatabaseException on initdb error. |
You can use this script to start a copy of postgres.
Usage: postgres.py [options]
-h, --help | show this help message and exit |
-H HOST, --host=HOST | |
listener hostname | |
-p PORT, --port=PORT | |
listener port | |
-d DATADIR, --datadir=DATADIR | |
data directory | |
-i INITIALIZE, --init=INITIALIZE | |
initialize data directory | |
-v VERSION, --version=VERSION | |
postgres version |