Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Backup and restore of Mongodb data

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Backup and restore of mongodb database

1.1 mongodump command parameters

Mongodump-help

Usage:

Mongodump

Export the content of a running server into .bson files.

Specify a database with-d and a collection with-c to only dump that database or collection.

See http://docs.mongodb.org/manual/reference/program/mongodump/ for more information.

General options:

-- help print usage

-- version print the tool version and exit

Verbosity options:

-v,-- verbose= more detailed log output (include multiple times for more verbosity, e.g.-vvvvv

Or specify a numeric value, e.g.-- verbose=N)

-- quiet hide all log output

Connection options:

-h,-- host= mongodb host to connect to (setname/host1,host2 for replica sets)

-- port= server port (can also use-- host hostname:port)

Ssl options:

-- ssl connect to a mongod or mongos that has ssl enabled

-- sslCAFile= the .pem file containing the root certificate chain from the certificate authority

-- sslPEMKeyFile= the .pem file containing the certificate and key

-- sslPEMKeyPassword= the password to decrypt the sslPEMKeyFile, if necessary

-- sslCRLFile= the .pem file containing the certificate revocation list

-- sslAllowInvalidCertificates bypass the validation for server certificates

-- sslAllowInvalidHostnames bypass the validation for server name

-- sslFIPSMode use FIPS mode of the installed openssl library

Authentication options:

-u,-- username= username for authentication

-p,-- password= password for authentication

-- authenticationDatabase= database that holds the user's credentials

-- authenticationMechanism= authentication mechanism to use

Namespace options:

-d,-- db= database to use

-c,-- collection= collection to use

Uri options:

-- uri=mongodb-uri mongodb uri connection string

Query options:

-Q,-- query= query filter, as a JSON string, e.g.,'{x: {$gt:1}}'

-- queryFile= path to a file containing a query filter (JSON)

-- readPreference= | specify either a preference name or a preference json object

-- forceTableScan force a table scan

Output options:

-o,-- out= output directory, or'- 'for stdout (defaults to' dump')

-- gzip compress archive our collection output with Gzip

-repair try to recover documents from damaged data files (not supported by all storage

Engines)

-- oplog use oplog for taking a point-in-time snapshot

-- archive= dump as an archive to the specified path. If flag is specified without a value

Archive is written to stdout

-- dumpDbUsersAndRoles dump user and role definitions for the specified database

-excludeCollection= collection to exclude from the dump (may be specified multiple times to exclude

Additional collections)

-excludeCollectionsWithPrefix= exclude all collections from the dump that have the given prefix (may be specified

Multiple times to exclude additional prefixes)

-j,-- numParallelCollections= number of collections to dump in parallel (4 by default) (default: 4)

-- viewsAsCollections dump views as normal collections with their produced data, omitting standard

Collections

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report