Adding a New Coordinator

Postgres-XC 1.1 Documentation
Prev | Up | Chapter 30. Adding a New Node | Next

# 30.1. Adding a New Coordinator

Following steps should be performed to add a new coordinator to a running cluster:

1. Initialize the new coordinator. The following example initilizes a coordinator named coord_3.

                 /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data_cord3 --nodename coord_3

2. Make necessary changes in postgresql.conf of the new coordinator, in particular specify new coordinator name and pooler port.

3. Connect to any of the existing coordinators and lock the cluster for backup, do not close this session. The following example assumes a coordinator is running on port 5432. Make sure the function call returns true. The detailed description of the function `pgxc_lock_for_backup` can be found in Table 9-68

                 ./psql postgres -p 5432
                 select pgxc_lock_for_backup();

4. Connect to any of the existing coordinators and take backup of the database. Please note that only schema (i.e. no data) is to be dumped. Also note the use of `--include-nodes`, so that the `CREATE TABLE` contains `TO NODE` clause. Similarly `--dump-nodes` ensures that the dump does contain existing nodes and node groups.

                 ./pg_dumpall -p 5432 -s --include-nodes --dump-nodes --file=/some/valid/path/some_file_name.sql

5. Start the new coordinator specifying `--restoremode` while starting. The following example starts the new coordinator on port 5455

                 ./postgres --restoremode -D ../data_cord3 -p 5455

   You can use `pg_ctl` with `-Z restoremode` option.

       	     ./pg_ctl start -Z restoremode -D ../data_coord3 -p 5455

6. Restore the backup (taken in step 4) by connecting to the new coordinator directly.

                 ./psql -d postgres -f /some/valid/path/some_file_name.sql -p 5455

7. Quit the new coordinator.

8. Start the new coordinator specifying `--coordinator` while starting. The following example starts the new coordinator on port 5455

                 ./postgres --coordinator -D ../data_cord3 -p 5455

9. Create the new coordinator on rest of the coordinators and reload configuration. The following example creates coord_3, with host localhost and port 5455.

                 CREATE NODE COORD_3 WITH (HOST = 'localhost', type = 'coordinator', PORT = 5455);
                 SELECT pgxc_pool_reload();

10. Quit the session of step 3, this will unlock the cluster. The new coordinator is now ready.

Prev | Home | Next
Adding a New Node | Up | Adding a New Datanode