EnglishFrenchSpanish

Ad


OnWorks favicon

mongodump - Online in the Cloud

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

This is the command mongodump 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


mongodump - MongoDB

SYNOPSIS


mongodump is a utility for creating a binary export of the contents of a database.
Consider using this utility as part an effective backup strategy. Use in conjunction with
mongorestore to provide restore functionality.

Note The format of data created by mongodump tool from the 2.2 distribution or later is
different and incompatible with earlier versions of mongod.

See also

"mongorestore" and "/administration/backups".

OPTIONS


mongodump

--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 mongodump utility and exits.

--host <hostname><:port>
Specifies a resolvable hostname for the mongod that you wish to use to create the
database dump. By default mongodump will attempt to connect to a MongoDB process
ruining on the localhost port number 27017.

Optionally, specify a port number to connect a MongoDB instance running on a port
other than 27017.

To connect to a replica set, use the --host argument with a setname, followed by a
slash and a comma-separated list of host names and port numbers. The mongodump
utility will, given the seed of at least one connected set member, connect to the
primary member of that set. This option would resemble:

mongodump --host repl0/mongo0.example.net,mongo0.example.net:27018,mongo1.example.net,mongo2.example.net

You can always connect directly to a single MongoDB instance by specifying the host
and port number directly.

--port <port>
Specifies the port number, if the MongoDB instance is not running on the standard
port. (i.e. 27017) You may also specify a port number using the --host option.

--ipv6 Enables IPv6 support that allows mongodump to connect to the MongoDB instance using
an IPv6 network. All MongoDB programs and processes, including mongodump, disable
IPv6 support by default.

--ssl New in version 2.4: MongoDB added support for SSL connections to mongod instances
in mongodump.

Note SSL support in mongodump is not compiled into the default distribution of MongoDB.
See /administration/ssl for more information on SSL and MongoDB.

Additionally, mongodump does not support connections to mongod instances that
require client certificate validation.

Allows mongodump 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, mongodump 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, mongodump 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, mongodump 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 the directory of the MongoDB data files. If used, the --dbpath option
enables mongodump to attach directly to local data files and copy the data without
the mongod. To run with --dbpath, mongodump needs to restrict access to the data
directory: as a result, no mongod can access the same path while the process runs.

--directoryperdb
Use the --directoryperdb in conjunction with the corresponding option to mongod.
This option allows mongodump to read data files organized with each database
located in a distinct directory. This option is only relevant when specifying the
--dbpath option.

--journal
Allows mongodump operations to use the durability journal to ensure that the export
is in a consistent state. This option is only relevant when specifying the --dbpath
option.

--db <db>, -d <db>
Use the --db option to specify a database for mongodump to backup. If you do not
specify a DB, mongodump copies all databases in this instance into the dump files.
Use this option to backup or copy a smaller subset of your data.

--collection <collection>, -c <collection>
Use the --collection option to specify a collection for mongodump to backup. If you
do not specify a collection, this option copies all collections in the specified
database or instance to the dump files. Use this option to backup or copy a smaller
subset of your data.

--out <path>, -o <path>
Specifies a path where mongodump and store the output the database dump. To output
the database dump to standard output, specify a - rather than a path.

--query <json>, -q <json>
Provides a query to limit (optionally) the documents included in the output of
mongodump.

--oplog
Use this option to ensure that mongodump creates a dump of the database that
includes an oplog, to create a point-in-time snapshot of the state of a mongod
instance. To restore to a specific point-in-time backup, use the output created
with this option in conjunction with mongorestore --oplogReplay.

Without --oplog, if there are write operations during the dump operation, the dump
will not reflect a single moment in time. Changes made to the database during the
update process can affect the output of the backup.

--oplog has no effect when running mongodump against a mongos instance to dump the
entire contents of a sharded cluster. However, you can use --oplog to dump
individual shards.

Note --oplog only works against nodes that maintain a oplog. This includes all members
of a replica set, as well as master nodes in master/slave replication deployments.

--repair
Use this option to run a repair option in addition to dumping the database. The
repair option attempts to repair a database that may be in an inconsistent state as
a result of an improper shutdown or mongod crash.

--forceTableScan
Forces mongodump to scan the data store directly: typically, mongodump saves
entries as they appear in the index of the _id field. Use --forceTableScan to skip
the index and scan the data directly. Typically there are two cases where this
behavior is preferable to the default:

1. If you have key sizes over 800 bytes that would not be present in the _id index.

2. Your database uses a custom _id field.

When you run with --forceTableScan, mongodump does not use $snapshot. As a result,
the dump produced by mongodump can reflect the state of the database at many
different points in time.

Warning
Use --forceTableScan with extreme caution and consideration.

Warning
Changed in version 2.2: When used in combination with fsync or db.fsyncLock(),
mongod may block some reads, including those from mongodump, when queued write
operation waits behind the fsync lock.

BEHAVIOR


When running mongodump against a mongos instance where the sharded cluster consists of
replica sets, the read preference of the operation will prefer reads from secondary
members of the set.

USAGE


See the /tutorial/backup-databases-with-binary-database-dumps for a larger overview of
mongodump usage. Also see the "mongorestore" document for an overview of the mongorestore,
which provides the related inverse functionality.

The following command, creates a dump file that contains only the collection named
collection in the database named test. In this case the database is running on the local
interface on port 27017:

mongodump --collection collection --db test

In the next example, mongodump creates a backup of the database instance stored in the
/srv/mongodb directory on the local machine. This requires that no mongod instance is
using the /srv/mongodb directory.

mongodump --dbpath /srv/mongodb

In the final example, mongodump creates a database dump located at
/opt/backup/mongodump-2011-10-24, from a database running on port 37017 on the host
mongodb1.example.net and authenticating using the username user and the password pass, as
follows:

mongodump --host mongodb1.example.net --port 37017 --username user --password pass /opt/backup/mongodump-2011-10-24

Use mongodump online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

Linux commands

Ad