mongooplog (1) - Linux Manuals
mongooplog: MongoDB Oplog Utility
NAME
mongooplog - MongoDB Oplog UtilityNew in version 2.2.
SYNOPSIS
mongooplog is a simple tool that polls operations from the replication oplog of a remote server, and applies them to the local server. This capability supports certain classes of real-time migrations that require that the source server remain online and in operation throughout the migration process.
Typically this command will take the following form:
mongooplog --from mongodb0.example.net --host mongodb1.example.net
This command copies oplog entries from the mongod instance running on the host mongodb0.example.net and duplicates operations to the host mongodb1.example.net. If you do not need to keep the --from host running during the migration, consider using mongodump and mongorestore or another backup operation, which may be better suited to your operation.
NOTE: If the mongod instance specified by the --from argument is running with authentication, then mongooplog will not be able to copy oplog entries.
SEE ALSO: mongodump, mongorestore, http://docs.mongodb.org/manual/core/backups, http://docs.mongodb.org/manual/core/replica-set-oplog.
OPTIONS
- mongooplog
- mongooplog
- --help, -h
- Returns information on mongooplog options and usage.
- --verbose, -v
- Increases the amount of internal reporting returned on standard output or in log files. Increase the verbosity with the -v form by including the option multiple times, (e.g. -vvvvv.)
- --quiet
- Runs mongooplog in a quiet mode that attempts to limit the amount of output. This option suppresses:
- •
- output from database commands
- •
- replication activity
- •
- connection accepted events
- •
- connection closed events
- --version
- Returns the mongooplog release number.
- --host <hostname><:port>, -h
-
Specifies a resolvable hostname for the mongod instance to
which mongooplog will apply oplog operations
retrieved from the server specified by the --from option.
By default mongooplog attempts to connect to a MongoDB instance running on the localhost on port number 27017.
To connect to a replica set, specify the replica set seed name and the seed list of set members. Use the following format:
<replica_set_name>/<hostname1><:port>,<hostname2:<port>,...
You can always connect directly to a single MongoDB instance by specifying the host and port number directly.
- --port
- Specifies the port number of the mongod instance where mongooplog will apply oplog entries. Specify this option only if the MongoDB instance to connect to is not running on the standard port of 27017. You may also specify a port number using the --host command.
- --ipv6
- Enables IPv6 support, which allows mongooplog to connect to the MongoDB instance using an IPv6 network. All MongoDB programs and processes, including mongooplog, disable IPv6 support by default.
- --ssl
-
New in version 2.6.
Enables connection to a mongod or mongos that has SSL support enabled.
The default distribution of MongoDB does not contain support for SSL. For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure-ssl.
- --sslCAFile <filename>
-
New in version 2.6.
Specifies the .pem file that contains the root certificate chain from the Certificate Authority. Specify the file name of the .pem file using relative or absolute paths.
The default distribution of MongoDB does not contain support for SSL. For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure-ssl.
- --sslPEMKeyFile <filename>
-
New in version 2.6.
Specifies the .pem file that contains both the SSL certificate and key. Specify the file name of the .pem file using relative or absolute paths.
This option is required when using the --ssl option to connect to a mongod or mongos that has sslCAFile enabled without sslWeakCertificateValidation.
The default distribution of MongoDB does not contain support for SSL. For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure-ssl.
- --sslPEMKeyPassword <value>
-
New in version 2.6.
Specifies the password to de-crypt the certificate-key file (i.e. --sslPEMKeyFile). Use --sslPEMKeyPassword only if the certificate-key file is encrypted. In all cases, mongooplog will redact the password from all logging and reporting output.
If the private key in the PEM file is encrypted and you do not specify --sslPEMKeyPassword, mongooplog will prompt for a passphrase. See ssl-certificate-password.
The default distribution of MongoDB does not contain support for SSL. For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure-ssl.
- --sslCRLFile <filename>
-
New in version 2.6.
Specifies the .pem file that contains the Certificate Revocation List. Specify the file name of the .pem file using relative or absolute paths.
The default distribution of MongoDB does not contain support for SSL. For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure-ssl.
- --sslAllowInvalidCertificates
-
New in version 2.6.
Bypasses the validation checks for server certificates and allows the use of invalid certificates. When using the sslAllowInvalidCertificates setting, MongoDB logs as a warning the use of the invalid certificate.
The default distribution of MongoDB does not contain support for SSL. For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure-ssl.
- --sslFIPSMode
-
New in version 2.6.
Directs mongooplog to use the FIPS mode of the installed OpenSSL library. Your system must have a FIPS compliant OpenSSL library to use --sslFIPSMode.
The default distribution of MongoDB does not contain support for SSL. For more information on MongoDB and SSL, see http://docs.mongodb.org/manual/tutorial/configure-ssl.
- --username <username>, -u
- Specifies a username with which to authenticate to a MongoDB database that uses authentication. Use in conjunction with the --password and --authenticationDatabase options.
- --password <password>, -p
- Specifies a password with which to authenticate to a MongoDB database that uses authentication. Use in conjunction with the --username and --authenticationDatabase options.
- --authenticationDatabase <dbname>
-
New in version 2.4.
Specifies the database that holds the user's credentials. If you do not specify an authentication database, mongooplog assumes that the database specified as the argument to the --db option holds the user's credentials.
- --authenticationMechanism <name>
-
New in version 2.4.
Specifies the authentication mechanism. By default, the authentication mechanism is MONGODB-CR, which is the MongoDB challenge/response authentication mechanism. In MongoDB Enterprise, mongooplog also includes support for GSSAPI to handle Kerberos authentication. See http://docs.mongodb.org/manual/tutorial/control-access-to-mongodb-with-kerberos-authentication for more information about Kerberos authentication.
- --dbpath <path>
-
Specifies a directory, containing MongoDB data files, to which
mongooplog will apply operations from the oplog of
the database specified with the --from
option.
When used, the --dbpath option enables mongo to attach directly to local data files and write data without a running mongod instance.
To run with --dbpath, mongooplog needs to restrict access to the data directory: as a result, no mongod can be access the same path while the process runs.
- --directoryperdb
- When used in conjunction with the corresponding option in mongod, allows mongooplog to access data from MongoDB instances that use an on-disk format where every database has a distinct directory. This option is only relevant when specifying the --dbpath option.
- --journal
- Allows mongooplog operations to use the durability journal to ensure data files remain valid and recoverable. This option is only relevant when specifying the --dbpath option.
- --db <database>, -d
- Specifies the name of the database on which to run mongooplog.
- --collection <collection>, -c
- Specifies the collection to export.
- --seconds <number>, -s
- Specify a number of seconds of operations for mongooplog to pull from the remote host. Unless specified the default value is 86400 seconds, or 24 hours.
- --from <host[:port]>
-
Specify the host for mongooplog to retrieve oplog
operations from. mongooplog requires this option.
Unless you specify the --host option, mongooplog will apply the operations collected with this option to the oplog of the mongod instance running on the localhost interface connected to port 27017.
- --oplogns <namespace>
- Specify a namespace in the --from host where the oplog resides. The default value is local.oplog.rs, which is the where replica set members store their operation log. However, if you've copied oplog entries into another database or collection, use this option to copy oplog entries stored in another location. Namespaces take the form of [database].[collection].
USE
Consider the following prototype mongooplog command:
mongooplog --from mongodb0.example.net --host mongodb1.example.net
Here, entries from the oplog of the mongod running on port 27017. This only pull entries from the last 24 hours.
Use the --seconds argument to capture a greater or smaller amount of time. Consider the following example:
mongooplog --from mongodb0.example.net --seconds 172800
In this operation, mongooplog captures 2 full days of operations. To migrate 12 hours of oplog entries, use the following form:
mongooplog --from mongodb0.example.net --seconds 43200
For the previous two examples, mongooplog migrates entries to the mongod process running on the localhost interface connected to the 27017 port. mongooplog can also operate directly on MongoDB's data files if no mongod is running on the target host. Consider the following example:
mongooplog --from mongodb0.example.net --dbpath /srv/mongodb --journal
Here, mongooplog imports oplog operations from the mongod host connected to port 27017. This migrates operations to the MongoDB data files stored in the /srv/mongodb directory. Additionally mongooplog will use the durability journal to ensure that the data files remain valid.
AUTHOR
MongoDB Documentation ProjectCOPYRIGHT
2011-2014, MongoDB, Inc.