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
Option | Description |
---|---|
--clear-logs | Delete all THL and relay logs for the service |
--direct | Use the MySQL data directory for staging and preparation |
--directory | The $CONTINUENT_ROOT directory to use for running this command. It will default to the directory you use to run the script. |
--force , -f | Continue operation even if script validation fails |
--help , -h | Show help text |
--info , -i | Display info, notice, warning, and error messages |
--json | Output all messages and the return code as a JSON object |
--mysqldump | Use mysqldump for generating the information |
--net-ssh-option | Provide custom SSH options to use for SSH communication to other hosts. |
--notice , -n | Display notice, warning, and error messages |
--offline | Put required replication services offline before processing |
--offline-timeout | Put required replication services offline before processing |
--online | Put required replication services online after successful processing |
--service | Replication service to read information from |
--source | Server to use as a source for the backup |
--source-directory | Directory on --source to find installed software |
--validate | Only run script validation |
--verbose , -v | Show verbose information during processing |
--xtrabackup | Use xtrabackup for generating the information |
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.