8.26. The tungsten_provision_slave Script

The tungsten_provision_slave script allows you to easily provision, or reprovision, a database server using information from a remote host. It implements the Tungsten Script Interface as well as these additional options.

tungsten_provision_slave [ --clear-logs ] [ --direct ] [ --directory ] [ -f, --force ] [ --help, -h ] [ --info, -i ] [ --json ] [ --mysqldump ] [ --net-ssh-option ] [ --notice, -n ] [ --offline ] [ --offline-timeout ] [ --online ] [ --service ] [ --source ] [ --source-directory ] [ --validate ] [ --verbose, -v ] [ --xtrabackup ]

Where:

Table 8.37. tungsten_provision_slave Command-line Options

OptionDescription
--clear-logsDelete all THL and relay logs for the service
--directUse the MySQL data directory for staging and preparation
--directoryThe $CONTINUENT_ROOT directory to use for running this command. It will default to the directory you use to run the script.
--force, -fContinue operation even if script validation fails
--help, -hShow help text
--info, -iDisplay info, notice, warning, and error messages
--jsonOutput all messages and the return code as a JSON object
--mysqldumpUse mysqldump for generating the information
--net-ssh-optionProvide custom SSH options to use for SSH communication to other hosts.
--notice, -nDisplay notice, warning, and error messages
--offlinePut required replication services offline before processing
--offline-timeoutPut required replication services offline before processing
--onlinePut required replication services online after successful processing
--serviceReplication service to read information from
--sourceServer to use as a source for the backup
--source-directoryDirectory on --source to find installed software
--validateOnly run script validation
--verbose, -vShow verbose information during processing
--xtrabackupUse xtrabackup for generating the information

Important

It is recommend to run this script in a utility such as screen in case the terminal gets disconnected.

The script will automatically put all replication services offline prior to beginning. If the services were online, the script will put them back online following a successful completion. All THL logs will be cleared prior to going online. The replicator will start replication from the position reflected on the source host.

Provisioning will fail from a Replica that is stopped, or if the Replica is not in either the ONLINE or OFFLINE:NORMAL state. This can be overridden by using the -f or --force options.

When provisioning Primaries, for example in fan-in, or when recovering a failed Primary in a standard Primary-Replica topology, the service must be reset with the trepctl reset after the command is finished. The service must also be reset on all Replicas.

The --service argument is used to determine which database server should be provisioned. If there are multiple services defined in the replicator and one of those is a Primary, the Primary service must be specified.

If the installation directory on --source is different from the target, specify --source-directory to specify where it can be found. This option should point to an installation that is running the --service replication service. The --source-directory option is not required if the software is installed to the same directory on both servers.

Using xtrabackup

The script will use Xtrabackup by default. It will run validation prior to starting to make sure the needed scripts are available. The provision process will run Xtrabackup on the source server and stream the contents to the server you are provisioning. Passing the --direct option will empty the MySQL data directory prior to doing the backup and place the streaming backup there. After taking the backup, the script will prepare the directory and restart the MySQL server.

Using mysqldump

If you have a small dataset or don't have Xtrabackup, you may pass the --mysqldump option to use it. It implements the Tungsten Script Interface as well as these additional options.

Compatibility

The script only works with MySQL at this time.