What we've determined[]
As in Real Server configuration, we've assigned the following:
- User: postgresxc
- Configure at: node01 and node02
- Work directory: /home/postgresxc/pgxc/gtm_proxy
- Node name: gtm_pxy1 and gtm_pxy2
- Port number: 20001
- gtm host: node03
- gtm port: 20001
First, we create template of GTM Proxy at node01 as follows:
[main]$ ssh node01 [node01]$ initgtm -Z gtm_proxy -D /home/postgresxc/pgxc/gtm_proxy [node01]$
initgtm creates template configuration file for gtm. For details, please visit initgtm document page.
Now you should add node name and port number to the configuration file, gtm.conf.
It is very simple. Do as follows:
[node01]$ cat >> /home/postgresxc/pgxc/gtm_proxy/gtm_proxy.conf << EOF nodename = 'gtm_pxy1' listen_addresses = '*' port = 20001 gtm_port = 20001 gtm_host = 'node03' EOF [node01]$ exit [main]$
You can do the same thing using your favorite text editor like vi or emacs. With them, you will find many example lines of the configuration file.
Now, configure gtm_pxy2 at node02.
[main]$ ssh node02 [node02]$ initgtm -Z gtm_proxy -D /home/postgresxc/pgxc/gtm_proxy [node02]$ cat >> /home/postgresxc/pgxc/gtm_proxy/gtm_proxy.conf << EOF nodename = 'gtm_pxy2' listen_addresses = '*' port = 20001 gtm_port = 20001 gtm_host = 'node03' EOF [node02]$ exit [main]$
You finished your GTM_proxy configuration.