3.2.8 Backup Functions

This section provides information about the functions provided in the MGM API for starting and stopping NDB Cluster backups.

ndb_mgm_start_backup()

Description

This function is used to initiate a backup of an NDB Cluster.

Signature
int ndb_mgm_start_backup
    (
      NdbMgmHandle          handle,
      int                   wait,
      unsigned int*         id,
      struct ndb_mgm_reply* reply
    )
Parameters

This function requires the four parameters listed here:

  • A management server handle (an NdbMgmHandle).

  • A wait flag, with the following possible values:

    • 0: Do not wait for confirmation of the backup.

    • 1: Wait for the backup to be started.

    • 2: Wait for the backup to be completed.

  • Create the backup having backup ID id. (This is also the function's return value.)

    No backup id is returned if wait is set equal to 0.

  • A pointer to an ndb_mgm_reply structure to accommodate a reply.

Return value

On success, the backup ID (id). In the event of failure, the function returns -1.

ndb_mgm_start_backup2()

Description

This function is used to initiate a backup of an NDB Cluster. It is the same as ndb_mgm_start_backup(), except that it additionally specifies a value to be used for the next backup taken.

Signature
int ndb_mgm_start_backup
    (
      NdbMgmHandle          handle,
      int                   wait,
      unsigned int*         id,
      struct ndb_mgm_reply* reply,
      unsigned int          nextBackupId
    )
Parameters

This function requires the five parameters listed here:

  • A management server handle (an NdbMgmHandle).

  • A wait flag, with the following possible values:

    • 0: Do not wait for confirmation of the backup.

    • 1: Wait for the backup to be started.

    • 2: Wait for the backup to be completed.

  • Create the backup having backup ID id. (This is also the function's return value.)

    No backup id is returned if wait is set equal to 0.

  • A pointer to an ndb_mgm_reply structure to accommodate a reply.

  • The ID of the next backup taken is set to the value of nextBackupID + 1.

Return value

On success, the backup ID passed as id. Otherwise, the function returns -1.

ndb_mgm_start_backup3()

Description

This function is used to initiate a backup of an NDB Cluster. It is the same as ndb_mgm_start_backup2(), but adds an argument for specifying whether the the state of the backup matches that of the cluster when the backup is started, or when it is completed.

Signature
int ndb_mgm_start_backup
    (
      NdbMgmHandle          handle,
      int                   wait,
      unsigned int*         id,
      struct ndb_mgm_reply* reply,
      unsigned int          nextBackupId,
      unsigned int          backupPoint
    )
Parameters

This function requires the six parameters listed here:

  • A management server handle (an NdbMgmHandle).

  • A wait flag, with the following possible values:

    • 0: Do not wait for confirmation of the backup.

    • 1: Wait for the backup to be started.

    • 2: Wait for the backup to be completed.

  • Create the backup having backup ID id. (This is also the function's return value.)

    No backup id is returned if wait is set equal to 0.

  • A pointer to an ndb_mgm_reply structure to accommodate a reply.

  • The ID of the next backup taken is set to the value of nextBackupID + 1.

  • backupPoint is 1 if the state of the backup should reflect that of the cluster the time when the backup is started, or 0 if its state should reflect that of the cluster when the backup is complete. Using 1 is equivalent to invoking the ndb_mgm client START BACKUP command with SNAPSHOTSTART; 0 is equivalent to invoking the command with SNAPSHOTEND.

Return value

On success, the backup ID passed as id. Otherwise, the function returns -1.

ndb_mgm_start_backup4()

Description

This function is used to initiate a backup of an NDB Cluster. It is the same as ndb_mgm_start_backup3(), except that it produces an encrypted backup using the password provided of the length specified.

This function was added in NDB 8.0.22.

Signature
int ndb_mgm_start_backup
    (
      NdbMgmHandle          handle,
      int                   wait,
      unsigned int*         id,
      struct ndb_mgm_reply* reply,
      unsigned int          nextBackupId,
      unsigned int          backupPoint,
      const char*           password,
      unsigned int          password_length
    )
Parameters

This function requires the eight parameters listed here:

  • A management server handle (an NdbMgmHandle).

  • A wait flag, with the following possible values:

    • 0: Do not wait for confirmation of the backup.

    • 1: Wait for the backup to be started.

    • 2: Wait for the backup to be completed.

  • Create the backup having backup ID id. (This is also the function's return value.)

    No backup id is returned if wait is set equal to 0.

  • A pointer to an ndb_mgm_reply structure to accommodate a reply.

  • The ID of the next backup taken is set to the value of nextBackupID + 1.

  • backupPoint is 1 if the state of the backup should reflect that of the cluster the time when the backup is started, or 0 if its state should reflect that of the cluster when the backup is complete. Using 1 is equivalent to invoking the ndb_mgm client START BACKUP command with SNAPSHOTSTART; 0 is equivalent to invoking the command with SNAPSHOTEND.

  • A password used to protect the encrypted backup. This is a string of up to 256 characters in length; any printable ASCII characters can be used in the password string with the exception of !, ', ", $, %, \, and ^.

  • The length of the password.

It is possible to specify an empty password, but this is not recommended.

Return value

On success, the backup ID passed as id. Otherwise, the function returns -1.

ndb_mgm_abort_backup()

Description

This function is used to stop an NDB Cluster backup.

Signature
int ndb_mgm_abort_backup
    (
      NdbMgmHandle          handle,
      unsigned int          id,
      struct ndb_mgm_reply* reply)
Parameters

This function takes 3 parameters:

  • An NdbMgmHandle.

  • The id of the backup to be aborted.

  • A pointer to an ndb_mgm_reply structure.

Return value

In case of an error, this function returns -1.