Before starting a backup, make sure that the cluster is properly configured for performing one. (See Section 17.5.3.3, “Configuration for MySQL Cluster Backups”.)
The START BACKUP
command is used to create a
backup:
START BACKUP [backup_id
] [wait_option
]wait_option
: WAIT {STARTED | COMPLETED} | NOWAIT
Successive backups are automatically identified sequentially, so
the backup_id
, an integer greater
than or equal to 1, is optional; if it is omitted, the next
available value is used. If an existing
backup_id
value is used, the backup
fails with the error Backup failed: file already
exists. If used, the
backup_id
must follow START
BACKUP
immediately, before any other options are used.
The maximum supported value for
backup_id
in MySQL 5.0
is 2147483648 (231). (Bug#43042)
If you start a backup using ndb_mgm -e "START
BACKUP", the backup_id
is
required.
The wait_option
can be used to
determine when control is returned to the management client
after a START BACKUP
command is issued, as
shown in the following list:
If NOWAIT
is specified, the management
client displays a prompt immediately, as seen here:
ndb_mgm> START BACKUP NOWAIT
ndb_mgm>
In this case, the management client can be used even while it prints progress information from the backup process.
With WAIT STARTED
the management client
waits until the backup has started before returning control
to the user, as shown here:
ndb_mgm> START BACKUP WAIT STARTED
Waiting for started, this may take several minutes
Node 2: Backup 3 started from node 1
ndb_mgm>
WAIT COMPLETED
causes the management
client to wait until the backup process is complete before
returning control to the user.
WAIT COMPLETED
is the default.
The procedure for creating a backup consists of the following steps:
Start the management client (ndb_mgm), if it not running already.
Execute the START BACKUP
command.
This produces several lines of output indicating the
progress of the backup, as shown here:
ndb_mgm> START BACKUP
Waiting for completed, this may take several minutes
Node 2: Backup 1 started from node 1
Node 2: Backup 1 started from node 1 completed
StartGCP: 177 StopGCP: 180
#Records: 7362 #LogRecords: 0
Data: 453648 bytes Log: 0 bytes
ndb_mgm>
When the backup has started the management client displays this message:
Backupbackup_id
started from nodenode_id
backup_id
is the unique
identifier for this particular backup. This identifier is
saved in the cluster log, if it has not been configured
otherwise. node_id
is the
identifier of the management server that is coordinating
the backup with the data nodes. At this point in the
backup process the cluster has received and processed the
backup request. It does not mean that the backup has
finished. An example of this statement is shown here:
Node 2: Backup 1 started from node 1
The management client indicates with a message like this one that the backup has started:
Backupbackup_id
started from nodenode_id
completed
As is the case for the notification that the backup has
started, backup_id
is the
unique identifier for this particular backup, and
node_id
is the node ID of the
management server that is coordinating the backup with the
data nodes. This output is accompanied by additional
information including relevant global checkpoints, the
number of records backed up, and the size of the data, as
shown here:
Node 2: Backup 1 started from node 1 completed StartGCP: 177 StopGCP: 180 #Records: 7362 #LogRecords: 0 Data: 453648 bytes Log: 0 bytes
It is also possible to perform a backup from the system shell by
invoking ndb_mgm with the -e
or --execute
option, as shown in this example:
shell> ndb_mgm -e "START BACKUP 6 WAIT COMPLETED"
When using START BACKUP
in this way, you must
specify the backup ID.
Cluster backups are created by default in the
BACKUP
subdirectory of the
DataDir
on each data node. This can be
overridden for one or more data nodes individually, or for all
cluster data nodes in the config.ini
file
using the BackupDataDir
configuration
parameter as discussed in
Identifying
Data Nodes. The backup files created for a backup with a
given backup_id
are stored in a
subdirectory named
BACKUP-
in the backup directory.
backup_id
To abort a backup that is already in progress:
Start the management client.
Execute this command:
ndb_mgm> ABORT BACKUP backup_id
The number backup_id
is the
identifier of the backup that was included in the response
of the management client when the backup was started (in the
message Backup
).
backup_id
started from node
management_node_id
The management client will acknowledge the abort request
with Abort of backup
.
backup_id
ordered
At this point, the management client has not yet received a response from the cluster data nodes to this request, and the backup has not yet actually been aborted.
After the backup has been aborted, the management client will report this fact in a manner similar to what is shown here:
Node 1: Backup 3 started from 5 has been aborted. Error: 1321 - Backup aborted by user request: Permanent error: User defined error Node 3: Backup 3 started from 5 has been aborted. Error: 1323 - 1323: Permanent error: Internal error Node 2: Backup 3 started from 5 has been aborted. Error: 1323 - 1323: Permanent error: Internal error Node 4: Backup 3 started from 5 has been aborted. Error: 1323 - 1323: Permanent error: Internal error
In this example, we have shown sample output for a cluster
with 4 data nodes, where the sequence number of the backup
to be aborted is 3
, and the management
node to which the cluster management client is connected has
the node ID 5
. The first node to complete
its part in aborting the backup reports that the reason for
the abort was due to a request by the user. (The remaining
nodes report that the backup was aborted due to an
unspecified internal error.)
There is no guarantee that the cluster nodes respond to an
ABORT BACKUP
command in any particular
order.
The Backup
messages mean that the backup has been
terminated and that all files relating to this backup have
been removed from the cluster file system.
backup_id
started from node
management_node_id
has been
aborted
It is also possible to abort a backup in progress from a system shell using this command:
shell> ndb_mgm -e "ABORT BACKUP backup_id
"
If there is no backup having the ID
backup_id
running when an
ABORT BACKUP
is issued, the management
client makes no response, nor is it indicated in the cluster
log that an invalid abort command was sent.
User Comments
Add your own comment.