FANDOM


What we've determinedEdit

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/datanode
  4. Node name: datanode1 and datanode2
  5. Port number: 20006
  6. gtm host: node01 and node02 (we use GTM Proxy)
  7. gtm port: 20001

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

[main]$ ssh node01
[node01]$ initdb --nodename=datanode1 -D /home/postgresxc/pgxc/datanode
[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/datanode/postgresql.conf << EOF
listen_addresses = '*'
gtm_port = 20001
gtm_host = 'node01'
port = 20006
EOF
[node01]$ exit
[main]$

Of course, you can use your favorite text editor here.

Now, configure datanode2 at node02.

[main]$ ssh node02
[node02]$ initdb --nodename=datanode2 -D /home/postgresxc/pgxc/datanode
[node02]$ cat >> /home/postgresxc/pgxc/datanode/postgresql.conf << EOF
listen_addresses = '*'
gtm_port = 20001
gtm_host = 'node02'
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/datanode/pg_hba.conf << EOF
host all all 192.168.1.0/24 trust
EOF
[node01]$ exit
[main]$ ssh node02
[node02]$ cat >> /home/postgresxc/pgxc/datanode/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 to fit to your network configuration.

You have finished your datanode configuration.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.