File: pg_autoctl_create_worker.rst

package info (click to toggle)
pg-auto-failover 2.0-2
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 5,156 kB
  • sloc: ansic: 58,245; python: 5,501; sql: 3,171; makefile: 593; sh: 35
file content (114 lines) | stat: -rw-r--r-- 4,458 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
.. _pg_autoctl_create_worker:

pg_autoctl create worker
=============================

pg_autoctl create worker - Initialize a pg_auto_failover worker node

Synopsis
--------

The command ``pg_autoctl create worker`` initializes a pg_auto_failover
Worker node for a Citus formation. The worker is special in a
Citus formation: that's where the client application connects to either to
manage the formation and the sharding of the tables, or for its normal SQL
traffic.

The worker also has to register every worker in the formation.

::

   usage: pg_autoctl create worker

     --pgctl           path to pg_ctl
     --pgdata          path to data director
     --pghost          PostgreSQL's hostname
     --pgport          PostgreSQL's port number
     --hostname        hostname by which postgres is reachable
     --listen          PostgreSQL's listen_addresses
     --proxyport       Proxy's port number
     --username        PostgreSQL's username
     --dbname          PostgreSQL's database name
     --name            pg_auto_failover node name
     --formation       pg_auto_failover formation
     --group           pg_auto_failover group Id
     --monitor         pg_auto_failover Monitor Postgres URL
     --auth            authentication method for connections from monitor
     --skip-pg-hba     skip editing pg_hba.conf rules
     --citus-secondary when used, this worker node is a citus secondary
     --citus-cluster   name of the Citus Cluster for read-replicas
     --ssl-self-signed setup network encryption using self signed certificates (does NOT protect against MITM)
     --ssl-mode        use that sslmode in connection strings
     --ssl-ca-file     set the Postgres ssl_ca_file to that file path
     --ssl-crl-file    set the Postgres ssl_crl_file to that file path
     --no-ssl          don't enable network encryption (NOT recommended, prefer --ssl-self-signed)
     --server-key      set the Postgres ssl_key_file to that file path
     --server-cert     set the Postgres ssl_cert_file to that file path

Description
-----------

This commands works the same as the :ref:`pg_autoctl_create_postgres`
command and implements the following extra steps:

  1. adds ``shared_preload_libraries = citus`` to the local PostgreSQL
     instance configuration.

  2. creates the extension ``citus`` in the target database.

  3. gets the coordinator node hostname from the pg_auto_failover monitor.

     This operation is retried when it fails, as the coordinator might
     appear later than some of the workers when the whole formation is
     initialized at once, in parallel, on multiple nodes.

  4. adds node to the coordinator

     This is done in two steps. First, we call the SQL function
     ``master_add_inactive_node`` on the coordinator, and second, we call
     the SQL function ``master_activate_node``.

     This way allows for easier diagnostics in case things go wrong. In the
     first step, the network and authentication setup needs to allow for
     nodes to connect to each other. In the second step, the Citus
     `reference tables` are distributed to the new node, and this operation
     has its own set of failure cases to handle.

.. important::

   The default ``--dbname`` is the same as the current system user name,
   which in many case is going to be ``postgres``. Please make sure to use
   the ``--dbname`` option with the actual database that you're going to use
   with your application.

   Citus does not support multiple databases, you have to use the database
   where Citus is created. When using Citus, that is essential to the well
   behaving of worker failover.

Options
-------

See the manual page for :ref:`pg_autoctl_create_postgres` for the common
options. This section now lists the options that are specific to
``pg_autoctl create worker``:

--proxyport

  The ``--proxyport`` option allows pg_auto_failover to register the proxy
  port in the ``pg_dist_poolinfo`` entry for the worker node in its
  Coordinator, rather than the ``--pgport`` entry as would usually be done.

--citus-secondary

  Use this option to create a worker dedicated to a Citus Secondary
  cluster.

  See :ref:`citus_secondaries` for more information.

--citus-cluster

  Use this option to name the Citus Secondary cluster that this worker
  node belongs to. Use the same cluster name again for the worker nodes that
  are part of this cluster.

  See :ref:`citus_secondaries` for more information.