You can restore to a cluster having fewer data nodes than the original provided that the larger number of nodes is an even multiple of the smaller number. In the following example, we use a backup taken on a cluster having four data nodes to a cluster having two data nodes.
The management server for the original cluster is on host
host10
. The original cluster has four data nodes, with the node IDs and host names shown in the following extract from the management server'sconfig.ini
file:[ndbd] NodeId=2 HostName=host2 [ndbd] NodeId=4 HostName=host4 [ndbd] NodeId=6 HostName=host6 [ndbd] NodeId=8 HostName=host8
We assume that each data node was originally started with ndbmtd
--ndb-connectstring=host10
or the equivalent.Perform a backup in the normal manner. See Section 6.8.2, “Using The NDB Cluster Management Client to Create a Backup”, for information about how to do this.
The files created by the backup on each data node are listed here, where
N
is the node ID andB
is the backup ID.BACKUP-
B
-0.N
.DataBACKUP-
B
.N
.ctlBACKUP-
B
.N
.log
These files are found under
BackupDataDir
/BACKUP/BACKUP-
, on each data node. For the rest of this example, we assume that the backup ID is 1.B
Have all of these files available for later copying to the new data nodes (where they can be accessed on the data node's local file system by ndb_restore). It is simplest to copy them all to a single location; we assume that this is what you have done.
The management server for the target cluster is on host
host20
, and the target has two data nodes, with the node IDs and host names shown, from the management serverconfig.ini
file onhost20
:[ndbd] NodeId=3 hostname=host3 [ndbd] NodeId=5 hostname=host5
Each of the data node processes on
host3
andhost5
should be started with ndbmtd-c host20
--initial
or the equivalent, so that the new (target) cluster starts with clean data node file systems.Copy two different sets of two backup files to each of the target data nodes. For this example, copy the backup files from nodes 2 and 4 from the original cluster to node 3 in the target cluster. These files are listed here:
BACKUP-1-0.2.Data
BACKUP-1.2.ctl
BACKUP-1.2.log
BACKUP-1-0.4.Data
BACKUP-1.4.ctl
BACKUP-1.4.log
Then copy the backup files from nodes 6 and 8 to node 5; these files are shown in the following list:
BACKUP-1-0.6.Data
BACKUP-1.6.ctl
BACKUP-1.6.log
BACKUP-1-0.8.Data
BACKUP-1.8.ctl
BACKUP-1.8.log
For the remainder of this example, we assume that the respective backup files have been saved to the directory
/BACKUP-1
on each of nodes 3 and 5.On each of the two target data nodes, you must restore from both sets of backups. First, restore the backups from nodes 2 and 4 to node 3 by invoking ndb_restore on
host3
as shown here:$> ndb_restore -c host20 --nodeid=2 --backupid=1 --restore-data --backup-path=/BACKUP-1 $> ndb_restore -c host20 --nodeid=4 --backupid=1 --restore-data --backup-path=/BACKUP-1
Then restore the backups from nodes 6 and 8 to node 5 by invoking ndb_restore on
host5
, like this:$> ndb_restore -c host20 --nodeid=6 --backupid=1 --restore-data --backup-path=/BACKUP-1 $> ndb_restore -c host20 --nodeid=8 --backupid=1 --restore-data --backup-path=/BACKUP-1