OnWorks favicon

mongooplog - Online in the Cloud

Run mongooplog in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

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



mongooplog - MongoDB

New in version 2.2.


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

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".



--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.

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:


--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>, -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.

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.

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].

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

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Zephyr Project
    Zephyr Project
    The Zephyr Project is a new generation
    real-time operating system (RTOS) that
    supports multiple hardware
    architectures. It is based on a
    small-footprint kernel...
    Download Zephyr Project
  • 2
    SCons is a software construction tool
    that is a superior alternative to the
    classic "Make" build tool that
    we all know and love. SCons is
    implemented a...
    Download SCons
  • 3
    PSeInt is a pseudo-code interpreter for
    spanish-speaking programming students.
    Its main purpose is to be a tool for
    learning and understanding the basic
    Download PSeInt
  • 4
    oStorybook l'outil privil�gi� des
    �crivains. ATTENTION : voir sur
    --en_EN oStorybook the right tool for
    writers. WARNIN...
    Download oStorybook
  • 5
    Asuswrt-Merlin is a third party
    firmware for select Asus wireless
    routers. Based on the Asuswrt firmware
    developed by Asus, it brings tweaks, new
    features and ...
    Download Asuswrt-Merlin
  • 6
    Atom is a text editor that's
    modern, approachable and full-featured.
    It's also easily customizable- you
    can customize it to do anything and be
    able to ...
    Download Atom
  • 7
    Osu! is a simple rhythm game with a well
    thought out learning curve for players
    of all skill levels. One of the great
    aspects of Osu! is that it is
    Download Osu!
  • More »

Linux commands