This is the command mongooplog that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator
PROGRAM:
NAME
mongooplog - MongoDB
New 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, "/administration/backups", "Oplog Internals Overview", and
"Replica Set Oplog Sizing".
OPTIONS
mongooplog
--help Returns a basic help and usage text.
--verbose, -v
Increases the amount of internal reporting returned on the command line. Increase
the verbosity with the -v form by including the option multiple times, (e.g.
-vvvvv.)
--version
Returns the version of the mongooplog utility.
--host <hostname><:port>, -h
Specifies a resolvable hostname for the mongod instance to which mongooplog will
apply oplog operations retrieved from the serve specified by the --from option.
mongooplog assumes that all target mongod instances are accessible by way of port
27017. You may, optionally, declare an alternate port number as part of the
hostname argument.
You can always connect directly to a single mongod instance by specifying the host
and port number directly.
To connect to a replica set, you can specify the replica set seed name, and a seed
list of set members, in the following format:
<replica_set_name>/<hostname1><:port>,<hostname2:<port>,...
--port Specifies the port number of the mongod instance where mongooplog will apply oplog
entries. Only specify this option if the MongoDB instance that you wish to connect
to is not running on the standard port. (i.e. 27017) You may also specify a port
number using the --host command.
--ipv6 Enables IPv6 support that 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.4: MongoDB added support for SSL connections to mongod instances
in mongooplog.
Note SSL support in mongooplog is not compiled into the default distribution of MongoDB.
See /administration/ssl for more information on SSL and MongoDB.
Additionally, mongooplog does not support connections to mongod instances that
require client certificate validation.
Allows mongooplog to connect to mongod instance over an SSL connection.
--username <username>, -u <username>
Specifies a username to authenticate to the MongoDB instance, if your database
requires authentication. Use in conjunction with the --password option to supply a
password.
--password <password>, -p <password>
Specifies a password to authenticate to the MongoDB instance. Use in conjunction
with the --username option to supply a username.
If you specify a --username without the --password option, mongooplog will prompt
for a password interactively.
--authenticationDatabase <dbname>
New in version 2.4.
Specifies the database that holds the user's (e.g --username) credentials.
By default, mongooplog assumes that the database specified to the --db argument
holds the user's credentials, unless you specify --authenticationDatabase.
See userSource, /reference/privilege-documents and /reference/user-privileges for
more information about delegated authentication in MongoDB.
--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
the MongoDB Subscriber Edition, mongooplog also includes support for GSSAPI to
handle Kerberos authentication.
See /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
Use the --directoryperdb in conjunction with the corresponding option to mongod.
This option allows mongooplog to write to data files organized with each database
located in a distinct directory. This option is only relevant when specifying the
--dbpath option.
--journal
Allows mongooplog operations to use the durability journal to ensure that the data
files will remain in a consistent state during the writing process. This option is
only relevant when specifying the --dbpath option.
--fields [field1[,field2]], -f [field1[,field2]]
Specify a field or number fields to constrain which data mongooplog will migrate.
All other fields will be excluded from the migration. Comma separate a list of
fields to limit the applied fields.
--fieldFile <file>
As an alternative to "--fields" the --fieldFile option allows you to specify a file
(e.g. <file>) that holds a list of field names to include in the migration. All
other fields will be excluded from the migration. Place one field per line.
--seconds <number>, -s <number>
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].
Usage
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.
In the next command, the parameters limit this operation to only apply operations to the
database people in the collection usage on the target host (i.e. mongodb1.example.net):
mongooplog --from mongodb0.example.net --host mongodb1.example.net --database people --collection usage
This operation only applies oplog 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 in a consistent state.
Use mongooplog online using onworks.net services