9.8. The cluster_backup Command

The cluster_backup command provides a simple mechanism to execute a Tungsten Replicator backup inside of the cluster. It is designed to be called manually or as part of cron. The command should be added to cron on every server. When started, the command will check if the server is the current coordinator for the cluster. If not, the command will exit without an error. This design ensures that the command will only run on one server in the cluster.

The command supports command-line options that allow you to alter how and where the backup is executed.

cluster_backup [ --agent ] [ --pass ] [ --user ] [ --datasource ] [ --directory ] [ --help, -h ] [ --info, -i ] [ --json ] [ --net-ssh-option ] [ --notice, -n ] [ --offline-backup String  ] [ --quiet, -q ] [ --require-slave-backup String  ] [ --require-automatic-mode String  ] [ --validate  ] [ --verbose, -v ]

Where:

Table 9.19. cluster_backup Command-line Options

OptionDescription
--agentThe replicator backup agent to use when running the backup, as configured in cctrl
--passAPI Admin user password (if NOT specified in INI via rest-api-admin-pass
--userAPI Admin user (if NOT specified in INI via rest-api-admin-user
--datasourceExecute the backup against the specified datasource
--directoryUse this installed Tungsten directory as the base for all operations
--help, -hDisplay this message
--info, -i
--jsonProvide return code and logging messages as a JSON object after the script finishes
--net-ssh-optionSet the Net::SSH option for remote system calls
--notice, -n
--offline-backup StringPut the datasource OFFLINE prior to taking the backup.
--quiet, -q
--require-slave-backup StringRequire that the backup is taken of a Replica datasource. If this is enabled and there are no Replicas available, no backup will be taken.
--require-automatic-mode StringThe script will fail if the cluster is not in the AUTOMATIC policy mode
--validateOnly run the script validation
--verbose, -v

After the command confirms the current server is the coordinator, it will attempt to find a datasource to backup. Unless --require-slave-backup has been disabled, only Replicas that are ONLINE will be eligible. If no datasource can be found, the command will exit with an error. The backup will then be started on the datasource.

The cluster_backup command will wait until the cctrl command has returned before exiting. The cctrl command can return prior to the backup is completed if it takes too long or if there is another error. The tungsten_nagios_backups check or similar should be used to make sure that you always have a recent backup available in the cluster.

Note

If manager-rest-api-authentication=true and you do not have the rest-api-admin-user and rest-api-admin-pass not specificed in your ini, then you will also need to supply the --user and --password options for cluster_backup to work.

The cluster_backup command may also be configured for use in Composite clusters. In this use case, one backup per cluster will be created.

See Section 6.10.2, “Automating Backups” for more information.

For example:

shell> crontab -l
00 00 * * * /opt/continuent/tungsten/cluster-home/bin/cluster_backup >>/opt/continuent/service_logs/cluster_backup.log 2>&1

All output will be sent to /opt/continuent/service_logs/cluster_backup.log.