Veritas NetBackup™ for MongoDB Administrator's Guide
- Overview of protecting MongoDB using NetBackup
- Verify the pre-requisites for the MongoDB plug-in for NetBackup
- Configuring NetBackup for MongoDB
- Configuring backup options for MongoDB using the mongodb.conf file
- Adding MongoDB credentials in NetBackup
- Managing backup hosts
- Backing up MongoDB using NetBackup
- Backing up MongoDB data
- Configuring NetBackup policies for MongoDB plug-in
- Restoring or recovering MongoDB data using NetBackup
- About the restore scenarios for MongoDB database from the BAR interface
- Recovering a MongoDB database using the command line
- Troubleshooting
- Appendix A. Additional information
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.
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:
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 ( Default location is |
loglevel | Specify the logging level. Default value is 3. Refer to the following options for logging level values:
|
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:
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 ( 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 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 " 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 The location is stored in the backup image. Default location is 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 |
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.
{ "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 } }