FANDOM


(Draft)Edit

What is GTM standbyEdit

GTM is Postgres-XC's central component which provides MVCC (multi-version concurrent control) information and sequence information to all the Postgres-XC transaction to implement single database view. Postgres-XC assumes that GTM is running and GTM crash leads to whole XC cluster crash. Because GTM provides tens of thousands of MVCC information per second, it is not practical to make static backup of GTM status used in the failover.

GTM standby usually runs on different server and backs up all the status change in GTM and maintains copy of GTM status for the failover. For the test or for your experience, GTM standby can run on the same server though. This page describes how to configure GTM standby and how it can be failed over when the master GTM crashes.

You should be familiar with GTM configuration. Plase visit Real Server configuration and Configure Server GTM pages to learn this. All the configurations here are based upon these pages. Please note that GTM standby assumes Postgres-XC is configured with GTM proxy to handle GTM failover.

GTM standby configurationEdit

Here, we're going to configure GTM standby as follows:

  1. Server: runs on the server node04
  2. Port: uses the port 20001
  3. Nodename: gtm (same as Master GTM) --> Need to test of this is okay!!
  4. Working directory: /home/postgresxc/pgxc/gtm
  5. Master GM server: master GTM runs on the server node03 (Real Server configuration)
  6. Master GTM server port: 20001

4 and 5 are taken from the fundamental configuration we've used in basic XC configuration.

To configure the above GTM standby, do as follows:

[main]$ ssh node04
[node04]$ initgtm -Z gtm -D /home/postgresxc/pgxc/gtm
[node04]$ cat >> /home/postgresxc/pgxc/gtm/gtm.conf << EOF
nodename = 'gtm'
listen_address = '*'
port = 20001
startup = STANDBY
active_host = 'node03'
active_port = 20001
EOF
[node04]$ exit
[main]

Please note configuration is very similar to GTM configuration as found in Configure Server GTM except for the last three lines of the configuration file.

Starting GTM standbyEdit

You can start GTM standby in the same manner as GTM. When GTM is running, please do as follows:

[main]$ ssh node04
[node04]$ gtm_ctl start -Z gtm -D /home/postgresxc/pgxc/gtm
[node-4]$ exit
[main]

Stop GTM standbyEdit

You can stop GTM standby in a similar way as usual GTM.

[main]$ ssh node04
[node04]$ gtm_ctl stop -Z gtm -D /home/postgresxc/pgxc/gtm
[node04]$ exit
[main]$

When GTM crashesEdit

When you find GTM crashes, then you need to promote GTM standby as the new GTM. You can do this as follows:

[main]$ ssh node04
[node04]$ gtm_ctl promote -Z gtm -D /home/postgresxc/pgxc/gtm
[node04]$ exit
[main]$

At this moment, GTM running on the server node04 takes over all the present GTM status on node03 and begin to run as the new GTM.

Please note that all the GTM proxies don't know this and you have to notify all the GTM proxy to reconnect to the new GTM as follows:

[main]$ ssh node01
[node01]$ gtm_ctl reconnect -Z gtm_proxy -D /home/postgresxc/pgxc/gtm_proxy -o "-s node04 -t 20001"
[node01]$ exit
[main$]$ ssh node002
[node02]$ gtm_ctl reconnect -Z gtm_proxy -D /home/postgresxc/pgxc/gtm_proxy -o "-s node04 -t 20001"
[node02]$ exit
[main]

No transaction loss will occur with the above operation.

Restarting GTM after failoverEdit

If you would like to stop GTM after failover and then restart it as the master, you need to configure gtm.conf file because it is configured as the STANDBY.

To stop the new GTM after the failover and then restart it as the master, you should do it as follows:

[main]$ ssh node04
[node04]$ gtm_ctl stop -Z gtm -D /home/postgresxc/pgxc/gtm
[node04]$ cat >> /home/postgresxc/pgxc/gtm << EOF
startup = ACT
EOF
[node04]$ gtm_ctl start -Z gtm -D /home/postgresxc/pgxc/gtm
[node04]$ exit
[main]$

Configuration parameters only needed for GTM standby remains in the configuration file but they are just ignored.

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.