Veritas NetBackup™ for MongoDB Administrator's Guide

Last Published:
Product(s): NetBackup (9.0.0.1, 9.0)
  1. Overview of protecting MongoDB using NetBackup
    1.  
      About protecting a sharded, replica set, or standalone MongoDB cluster using NetBackup
    2.  
      Protecting MongoDB data using NetBackup
    3.  
      NetBackup for MongoDB terminologies
    4.  
      Limitations
    5.  
      Prerequisites and the best practices for protecting MongoDB
  2. Verify the pre-requisites for the MongoDB plug-in for NetBackup
    1.  
      Operating system and platform compatibility
    2.  
      Prerequisites for configuring the MongoDB plug-in
  3. Configuring NetBackup for MongoDB
    1.  
      About the MongoDB configuration tool
    2.  
      Prerequisites for manually creating the mongodb.conf file
    3. Configuring backup options for MongoDB using the mongodb.conf file
      1.  
        Whitelisting the configuration file path on NetBackup master server
    4.  
      Obtaining the RSA key of the MongoDB nodes
    5. Adding MongoDB credentials in NetBackup
      1.  
        About the credential configuration file
      2.  
        How to add the MongoDB credentials in NetBackup
      3.  
        About the MongoDB roles for protecting the data
    6.  
      Using a non-root user as a host user
    7. Managing backup hosts
      1.  
        Whitelisting a NetBackup client on NetBackup master server
  4. Backing up MongoDB using NetBackup
    1. Backing up MongoDB data
      1.  
        Backing up a MongoDB cluster
    2.  
      Prerequisites for backing up a MongoDB cluster
    3. Configuring NetBackup policies for MongoDB plug-in
      1.  
        Creating a BigData backup policy
      2.  
        Creating BigData policy using the NetBackup Administration Console
      3.  
        Using the Policy Configuration Wizard to create a BigData policy for MongoDB clusters
      4.  
        Using the NetBackup Policies utility to create a BigData policy for MongoDB clusters
      5.  
        Using NetBackup Command Line Interface (CLI) to create a BigData policy for MongoDB clusters
  5. Restoring or recovering MongoDB data using NetBackup
    1.  
      Restoring MongoDB data
    2.  
      Prerequisites for MongoDB restore and recovery
    3. About the restore scenarios for MongoDB database from the BAR interface
      1.  
        High-level steps involved in the Restore and Recovery process
    4.  
      Using the BAR interface to restore the MongoDB data on the same cluster
    5.  
      Using the BAR interface to restore the MongoDB data on an alternate cluster
    6.  
      About restoring MongoDB data in a high availability setup on an alternate client
    7. Recovering a MongoDB database using the command line
      1.  
        Creating or modifying the rename file
      2.  
        Using the command line to recover a MongoDB database
    8.  
      Manual steps after the recovery process
  6. Troubleshooting
    1.  
      About NetBackup for MongoDB debug logging
    2.  
      Known limitations for MongoDB protection using NetBackup
  7. Appendix A. Additional information
    1.  
      Sample MongodB configuration utility workflow to add and update MongodB credentials
  8.  
    Index

Configuring backup options for MongoDB using the mongodb.conf file

Note:

If you use the MongoDB configuration tool, these manual steps are not required.

NetBackup uses the default options to back up MongoDB data. To specify custom options to use during a backup operation, you must create a mongodb.conf file in the /usr/openv/var/global/ directory on a UNIX and <Install_Dir>\NetBackup\var\global\ on a Windows master server.

Caution:

The file name mongodb.conf is case-sensitive.

It is not mandatory to specify all the options in the mongodb.conf file. NetBackup uses the default values for the options that do not have custom values.

Ensure that the mongodb.conf file uses JSON format and whitelist the file path in bp.conf using the BPCD_WHITELIST_PATH option. For more information, See Whitelisting the configuration file path on NetBackup master server.

Backup options in the mongodb.conf file

You can specify the following backup options and their values in the mongodb.conf file:

Caution:

The options in the file are case-sensitive.

Options

Details

application_servers

Fully Qualified Domain Name (FQDN), or hostname, or short name and the port number of the primary configuration server and mongod and mongos port in the following format:

clientFQDN_OR_hostname_OR_shortname:portnumber

Ensure that application_server matches with the hostname value that is used in the MongoDB environment and verified using the db.hostInfo() command.

For example, the hostname value that is displayed by db.hostInfo():

"hostname" : "<hostname_value>:<port>"

Warning:

Do not enter the node that acts an Arbiter node for MongoDB.

alternate_config_server

Fully Qualified Domain Name (FQDN), or hostname, or short name and the port number of the secondary or the alternate configuration server. You can add only one alternate configuration server for one cluster.

Use the following format for the value:

clientFQDN_OR_hostname_OR_shortname:portnumber

Ensure that alternate_config_server matches with the hostname value that is used in the MongoDB environment and verified using the db.hostInfo() command.

For example, the hostname value that is displayed by db.hostInfo():

"hostname" : "<hostname_value>:<port>"

If a connection to the primary configuration server fails, the first, active alternate configuration server is used.

For sharded MongoDB clusters, both the mongod and mongos processes must be running on the alternate config server.

You must enter the value of the alternate_config_server separately for every application_servers entry.

cleanup_time_in_min

Specify the time in minutes to clean up the stale snapshots or oplogstore that are created because of canceled jobs.

The value must be an integer.

free_space_percentage_snapshot

Specifies the percentage of the free space on a volume group that can be used to create a snapshot. This option is used only in case of full backups.

The default value (if not specified) is 20%. The value must be between 0 and 100. Do not use the percentage symbol (%).

For example, run the vgdisplay command to verify the value for the "Free PE / Size" field. The free_space_percentage_snapshot value is the percentage of Free PE / Size of the volume group where the data path resides.

Adjust the free_space_percentage_snapshot value based on the data change rate of the MongoDB instance during the backup operation and the free space that is available on the volume group.

For example, when:

  • Data change rate is 250 MB

  • Volume group has 1 GB Free PE / Size

  • The data change rate is 25% of Free PE / Size

Then specify the minimum value of free_space_percentage_snapshot as 25%.

Keeping the free space snapshot percentage value too low can result in snapshot (and subsequent backup) failure.

Keeping the free space snapshot percentage value too high can reduce the amount of available space on the volume group.

For more information and standard practices, refer to the Linux man page for the lvcreate command.

data_channel_tls

Use this parameter to disable or enable the data channel encryption between the MongoDB cluster and the backup host.

For example, use "data_channel_tls": false to disable the data channel encryption.

By default, all the traffic between the NetBackup backup host and the thin client (mdbserver) is over a TLS channel. You can disable this TLS for data movement from thin client (mdbserver) to the backup host to improve the performance.

Note:

Control data and sensitive data such as credentials are still transferred over the TLS channel when this option is disabled.

logdir

Location where the thin client (mdbserver) logs are generated on the MongoDB nodes.

Default location is /tmp. If the directory path is mentioned, but the directory does not exist on the server, NetBackup creates a directory.

loglevel

Specify the logging level.

Default value is 3.

Refer to the following options for logging level values:

  • ESERROR = 1

  • ESWARN = 2

  • ESINFO = 3

  • ESDEBUG = 4

  • ESTRACE = 5

  • ESCRITICAL = 6

max_log_mbsize

Specify the maximum file size in MB for the NetBackup thin client log file.

The default size is 10 MB. A new log file is created every day or if the existing log file exceeds the maximum size. The log file creation does not affect an ongoing job and the log roll-over happens during the next job that is performed by mdbserver.

The logs are cleaned up after 30 days.

max_streams

Note:

This parameter is applicable only for sharded MongoDB clusters.

Defines the number of parallel data streams per backup host. The minimum value is 32.

If max_streams is not defined, the default value is 32 parallel data streams per backup host.

Add the following entry to the mongodb.conf file:

max_streams:
      {
       "global_default":<set_value>,
       "<backup_host>":<set_value>
      }

Where:

  • global_default

    Default upper limit of the parallel data streams for all the backup hosts.

  • backup_host

    Set the upper limit of the parallel data streams for a specified backup host.

    The backup_host must be the same that is specified in the backup policy. If you have multiple backup hosts, the entry can be repeated for all backup hosts. If you do not specify a backup host, the global_default value is used.

Note:

This option sets the upper limit on the number of parallel data streams per backup host. The backup or the recovery job might not use all the available streams.

mdb_progress_loglevel

Lets you print the progress logging information about the files that are restored to the activity monitor.

Default value is 0 (off).

To enable set "mdb_progress_loglevel": 1.

Note:

Enabling this option can increase the recovery time.

mdbserver_location

Specify a location to copy the thin client (mdbserver) binaries on the MongoDB nodes that are required for the MongoDB backup and restore operation.

The files are copied to the servers that contain the data that needs to be protected and are removed once the backup operation completes.

Default location to copy the files is /tmp.

Note:

Do not specify the mount path or the high-level Linux directories because that can cause conflicts in directory permissions. For example, avoid specifying the path as /root, /etc, /usr, /bin, /home, etc.

mdbserver_port

Port that is used by the backup host to connect with the NetBackup thin client (mdbserver) that is running on the MongoDB node.

Default value is "11000".

This value is a string.

mdbserver_port_range

Use this parameter when multiple mongod instances are running on a single MongoDB node.

This option lets you use the next available port within the range for the backup and restore operation if the existing port is in use.

This option lets you run multiple backup jobs simultaneously on different ports by deploying multiple NetBackup thin clients (mdbserver).

Enter the value as "mdbserver_port_range":range_value, where the range_value is an integer to define the range of port numbers that can be used. For example, if you add the range_value as 10 and the mdbserver_port is defined 12000, the port range is used from 12000 to 12009.

The default value is 10.

Change this value based on the number of mongod instances on a MongoDB host that are backed up simultaneously.

mdbserver_timeout_min

Defines the time in minutes to wait before a NetBackup thin client (mdbserver) process is killed.

The default value is 300 (minutes).

Set the value higher than 300 minutes if your backup window requires more time.

Ideally, mdbserver is killed after the plug-in terminates or the backup is complete.

mongos_port

Port that the mongos process uses for communication.

This is a mandatory parameter for sharded MongoDB clusters.

You must specify this value for each of the application_servers or alternate_config_server entry

This value is a string.

oplog_location

For differential incremental backups, specify a custom directory to store the MongoDB oplog file.

The location is stored in the backup image.

Default location is /tmp/oplogstore.

Ensure that there is enough free space at this location for the oplog data of the incremental backups.

snapshot_mount_path

Specify the path on the MongoDB nodes for mounting LVM snapshots during full backups.

Default path is /tmp.

Note:

Ensure that the HostUser that you have configured in the MongoDB credential file has the read and write permissions to all the paths mentioned in the mongodb.conf file.

If you do not add all the options, an entry is added in the logs about the missing options. The default values are used for the options that are not mentioned and the backup operation proceeds.

Sample of the mongodb.conf file contents
{
  "application_servers": {
    "FQDN_primary_configuration_server_1:port": {
      "alternate_config_server": [
        {
          "hostname:port": "FQDN_alternate_configuration_server_1:26051",
          "mongos_port": "26051"
        }
      ],
      "mongos_port": "26052"
    },
    "FQDN_primary_configuration_server_2:port": {
      "alternate_config_server": [
        {
          "hostname:port": "FQDN_alternate_configuration_server_2:26053",
          "mongos_port": "26053"
        }
      ],
      "mongos_port": "26054"
    }
  },
  "mdbserver_location": "/path/to/store/mdbserver/",
  "logdir": "/path/to/store/logdir/",
  "mdbserver_port": "21020",
  "loglevel": 5,
  "max_log_mbsize": 4,
  "oplog_location": "/path/to/store/oplog/",
  "free_space_percentage_snapshot": "25",
  "mdb_progress_loglevel": 1,
  "snapshot_mount_path": "/path/to/mount/snapshot/",
		"max_streams":
			{
					"global_default":2,
					"FQDN_backup_host_1":1
			}
}