Postgres-XC Wiki
Register
Advertisement

What we've determined[]

As in Real Server configuration, we've assigned the following:

  1. User: postgresxc
  2. Configure at: node01 and node02
  3. Work directory: /home/postgresxc/pgxc/coordinator
  4. Node name: coord1 and coord2
  5. Port number: 20004
  6. gtm host: node01 and node02 (we use GTM Proxy)
  7. gtm port: 20001

First, we create template of coord1 at node01 as follows:

[main]$ ssh node01
[node01]$ initdb --nodename=coord1 -D /home/postgresxc/pgxc/coordinator
[node01]$

initdb creates template of coordinator and datanode and creates initial database called postgres.

Now you should add several lines of configuration parameters to postgresql.conf file.

It is very simple. Do as follows:

[node01]$ cat >> /home/postgresxc/pgxc/coordinator/postgresql.conf << EOF
listen_addresses = '*'
gtm_port = 20001
gtm_host = 'node01'
port = 20004
pooler_port = 20006
EOF
[node01]$ exit
[main]$

All the configuration parameters are set but there's one we're not familiar with. Pooler_port is another port number which every coordinator needs. Here, we assign another unique port number. Please do not forget to assign this to proper value. Of course, you can use your favorite text editor here.

Now, configure coord2 at node02.

[main]$ ssh node02
[node02]$ initdb --nodename=coord2 -D /home/postgresxc/pgxc/coordinator
[node02]$ cat >> /home/postgresxc/pgxc/coordinator/postgresql.conf << EOF
listen_addresses = '*'
gtm_port = 20001
gtm_host = 'node02'
port = 20004
pooler_port = 20006
EOF
[node02]$ exit
[main]$

Next, you need to edit pg_hba.conf files to accept connections from other servers.

[main]$ ssh node01
[node01]$ cat >> /home/postgresxc/pgxc/coordinator/pg_hba.conf << EOF
host all all 192.168.1.0/24 trust
EOF
[node01]$ exit
[main]$ ssh node02
[node02]$ cat >> /home/postgresxc/pgxc/coordinator/pg_hba.conf << EOF
host all all 192.168.1.0/24 trust
EOF
[node01]$ exit
[main]$

Please change the IP address and the mask value in pg_hba.conf files to fit to your network configuration.

You have finished your coordinator configuration..

Advertisement