diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8578ea0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/mongo-tools-17a5573.tar.gz diff --git a/.rh-mongodb32-mongo-tools.metadata b/.rh-mongodb32-mongo-tools.metadata new file mode 100644 index 0000000..69be6f5 --- /dev/null +++ b/.rh-mongodb32-mongo-tools.metadata @@ -0,0 +1 @@ +8fc05c539975dd05b8ea5a516576d7baaf7beffe SOURCES/mongo-tools-17a5573.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/APACHE-2.0.txt b/SOURCES/APACHE-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/SOURCES/APACHE-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/SOURCES/bsondump.1 b/SOURCES/bsondump.1 new file mode 100644 index 0000000..892b46c --- /dev/null +++ b/SOURCES/bsondump.1 @@ -0,0 +1,170 @@ +.\" Man page generated from reStructuredText. +. +.TH "BSONDUMP" "1" "January 30, 2015" "3.0" "mongodb-manual" +.SH NAME +bsondump \- MongoDB BSON Utility +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.sp +The \fBbsondump\fP converts \fIBSON\fP files into human\-readable +formats, including \fIJSON\fP\&. For example, \fBbsondump\fP is useful +for reading the output files generated by \fBmongodump\fP\&. +.sp +\fBIMPORTANT:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBbsondump\fP is a diagnostic tool for inspecting +BSON files, not a tool for data ingestion or other application use. +.UNINDENT +.UNINDENT +.SH OPTIONS +.sp +Changed in version 3.0.0: \fBbsondump\fP removed the \fB\-\-filter\fP option. + +.INDENT 0.0 +.TP +.B bsondump +.UNINDENT +.INDENT 0.0 +.TP +.B bsondump +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Returns information on the options and use of \fBbsondump\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verbose, \-v +Increases the amount of internal reporting returned on standard output +or in log files. Increase the verbosity with the \fB\-v\fP form by +including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-quiet +Runs the \fBbsondump\fP in a quiet mode that attempts to limit the amount +of output. +.sp +This option suppresses: +.INDENT 7.0 +.IP \(bu 2 +output from \fIdatabase commands\fP +.IP \(bu 2 +replication activity +.IP \(bu 2 +connection accepted events +.IP \(bu 2 +connection closed events +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Returns the \fBbsondump\fP release number. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-objcheck +Validates each \fIBSON\fP object before outputting it in \fIJSON\fP +format. By default, \fBbsondump\fP enables \fI\-\-objcheck\fP\&. +For objects with a high degree of sub\-document nesting, +\fI\-\-objcheck\fP can have a small impact on performance. You can set +\fI\-\-noobjcheck\fP to disable object checking. +.sp +Changed in version 2.4: MongoDB enables \fI\-\-objcheck\fP by default, to prevent any +client from inserting malformed or invalid BSON into a MongoDB +database. + +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-noobjcheck +New in version 2.4. + +.sp +Disables the default document validation that MongoDB performs on all +incoming BSON documents. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-type <=json|=debug> +Changes the operation of \fBbsondump\fP from outputting +"\fIJSON\fP" (the default) to a debugging format. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-pretty +New in version 3.0.0. + +.sp +Outputs documents in a pretty\-printed format JSON. +.UNINDENT +.INDENT 0.0 +.TP +.B +The final argument to \fBbsondump\fP is a document containing +\fIBSON\fP\&. This data is typically generated by +\fBbsondump\fP or by MongoDB in a \fIrollback\fP operation. +.UNINDENT +.SH USE +.sp +By default, \fBbsondump\fP outputs data to standard output. To +create corresponding \fIJSON\fP files, you will need to use the +shell redirect. See the following command: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bsondump collection.bson > collection.json +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Use the following command (at the system shell) to produce debugging +output for a \fIBSON\fP file: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +bsondump \-\-type=debug collection.bson +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB Documentation Project +.SH COPYRIGHT +2011-2015 +.\" Generated by docutils manpage writer. +. diff --git a/SOURCES/change-import-path.patch b/SOURCES/change-import-path.patch new file mode 100644 index 0000000..e74f04b --- /dev/null +++ b/SOURCES/change-import-path.patch @@ -0,0 +1,39 @@ +From 5560b12276574c800325885255917ab5a36fe776 Mon Sep 17 00:00:00 2001 +From: Jan Chaloupka +Date: Tue, 16 Jun 2015 07:21:05 +0200 +Subject: [PATCH] change import path + +--- + common/db/openssl/openssl.go | 2 +- + common/db/openssl/openssl_fips.go | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/common/db/openssl/openssl.go b/common/db/openssl/openssl.go +index 36a788d..144a490 100644 +--- a/common/db/openssl/openssl.go ++++ b/common/db/openssl/openssl.go +@@ -10,7 +10,7 @@ import ( + + "github.com/mongodb/mongo-tools/common/options" + "github.com/mongodb/mongo-tools/common/util" +- "github.com/spacemonkeygo/openssl" ++ "github.com/10gen/openssl" + ) + + var ( +diff --git a/common/db/openssl/openssl_fips.go b/common/db/openssl/openssl_fips.go +index 2c4705e..239d14a 100644 +--- a/common/db/openssl/openssl_fips.go ++++ b/common/db/openssl/openssl_fips.go +@@ -3,7 +3,7 @@ + + package openssl + +-import "github.com/spacemonkeygo/openssl" ++import "github.com/10gen/openssl" + + func init() { sslInitializationFunctions = append(sslInitializationFunctions, SetUpFIPSMode) } + +-- +1.9.3 + diff --git a/SOURCES/mongodump.1 b/SOURCES/mongodump.1 new file mode 100644 index 0000000..fe94bb8 --- /dev/null +++ b/SOURCES/mongodump.1 @@ -0,0 +1,621 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGODUMP" "1" "January 30, 2015" "3.0" "mongodb-manual" +.SH NAME +mongodump \- MongoDB Data Dump Utility +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.sp +\fBmongodump\fP is a utility for creating a binary export of the +contents of a database. Consider using this utility as part of an +effective \fBbackup strategy\fP\&. Use +\fBmongodump\fP in conjunction with \fBmongorestore\fP to +restore databases. +.sp +\fBmongodump\fP can read data from either \fBmongod\fP or \fBmongos\fP +instances, in addition to reading directly from MongoDB data files +without an active \fBmongod\fP\&. +.sp +\fBSEE ALSO:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBmongorestore\fP, +http://docs.mongodb.org/manual/tutorial/backup\-sharded\-cluster\-with\-database\-dumps +and http://docs.mongodb.org/manual/core/backups\&. +.UNINDENT +.UNINDENT +.SH BEHAVIOR +.sp +\fBmongodump\fP does \fInot\fP dump the content of the \fBlocal\fP database. +.sp +The data format used by \fBmongodump\fP from version 2.2 or +later is \fIincompatible\fP with earlier versions of \fBmongod\fP\&. +Do not use recent versions of \fBmongodump\fP to back up older +data stores. +.sp +When running \fBmongodump\fP against a \fBmongos\fP instance +where the \fIsharded cluster\fP consists of \fIreplica sets\fP, the \fIread preference\fP of the operation will prefer reads +from \fIsecondary\fP members of the set. +.sp +Changed in version 2.2: When used in combination with \fBfsync\fP or +\fBdb.fsyncLock()\fP, \fBmongod\fP will block +reads, including those from \fBmongodump\fP, when +queued write operation waits behind the \fBfsync\fP +lock. Do not use \fBmongodump\fP with +\fBdb.fsyncLock()\fP\&. + +.sp +\fBmongodump\fP overwrites output files if they exist in the +backup data folder. Before running the \fBmongodump\fP command +multiple times, either ensure that you no longer need the files in the +output folder (the default is the \fBdump/\fP folder) or rename the +folders or files. +.SH REQUIRED ACCESS +.SS Backup Collections +.sp +To backup all the databases in a cluster via \fBmongodump\fP, you +should have the \fBbackup\fP role. The \fBbackup\fP role provides +the required privileges for backing up all databases. The role confers no +additional access, in keeping with the policy of \fIleast privilege\fP\&. +.sp +To backup a given database, you must have \fBread\fP access on the database. +Several roles provide this access, including the \fBbackup\fP role. +.sp +To backup the \fBsystem.profile\fP +collection, which is created when you activate \fIdatabase profiling\fP, you must have \fBadditional\fP +\fBread\fP access on this collection. Several +roles provide this access, including the \fBclusterAdmin\fP and +\fBdbAdmin\fP roles. +.SS Backup Users +.sp +Changed in version 2.6. + +.sp +To backup users and \fIuser\-defined roles\fP for a +given database, you must have access to the \fBadmin\fP database. MongoDB +stores the user data and role definitions for all databases in the +\fBadmin\fP database. +.sp +Specifically, to backup a given database\(aqs users, you must have the +\fBfind\fP \fIaction\fP on the \fBadmin\fP +database\(aqs \fBadmin.system.users\fP collection. The \fBbackup\fP +and \fBuserAdminAnyDatabase\fP roles both provide this privilege. +.sp +To backup the user\-defined roles on a database, you must have the +\fBfind\fP action on the \fBadmin\fP database\(aqs +\fBadmin.system.roles\fP collection. Both the \fBbackup\fP and +\fBuserAdminAnyDatabase\fP roles provide this privilege. +.SH OPTIONS +.sp +Changed in version 3.0.0: \fBmongodump\fP removed the \fB\-\-dbpath\fP as well as related +\fB\-\-directoryperdb\fP and \fB\-\-journal\fP options. You must use +\fBmongodump\fP while connected to a \fBmongod\fP instance. + +.INDENT 0.0 +.TP +.B mongodump +.UNINDENT +.INDENT 0.0 +.TP +.B mongodump +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Returns information on the options and use of \fBmongodump\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verbose, \-v +Increases the amount of internal reporting returned on standard output +or in log files. Increase the verbosity with the \fB\-v\fP form by +including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-quiet +Runs the \fBmongodump\fP in a quiet mode that attempts to limit the amount +of output. +.sp +This option suppresses: +.INDENT 7.0 +.IP \(bu 2 +output from \fIdatabase commands\fP +.IP \(bu 2 +replication activity +.IP \(bu 2 +connection accepted events +.IP \(bu 2 +connection closed events +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Returns the \fBmongodump\fP release number. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-host <:port>, \-h <:port> +\fIDefault\fP: localhost:27017 +.sp +Specifies a resolvable hostname for the \fBmongod\fP to which to +connect. By default, the \fBmongodump\fP attempts to connect to a MongoDB +instance running on the localhost on port number \fB27017\fP\&. +.sp +To connect to a replica set, specify the +\fBreplSetName\fP and a seed list of set members, as in +the following: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +/<:port>,<:port>,<...> +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +You can always connect directly to a single MongoDB instance by +specifying the host and port number directly. +.sp +Changed in version 3.0.0: If you use IPv6 and use the \fB
:\fP format, you must +enclose the portion of an address and port combination in +brackets (e.g. \fB[
]\fP). + +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-port +\fIDefault\fP: 27017 +.sp +Specifies the TCP port on which the MongoDB instance listens for +client connections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ipv6 +Enables IPv6 support and allows the \fBmongodump\fP to connect to the +MongoDB instance using an IPv6 network. All MongoDB programs and +processes disable IPv6 support by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ssl +New in version 2.6. + +.sp +Enables connection to a \fBmongod\fP or \fBmongos\fP that has +SSL support enabled. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCAFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the root certificate chain +from the Certificate Authority. Specify the file name of the +\fB\&.pem\fP file using relative or absolute paths. +.sp +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\&. +.sp +\fBWARNING:\fP +.INDENT 7.0 +.INDENT 3.5 +If the \fBmongo\fP shell or any other tool that connects to +\fBmongos\fP or \fBmongod\fP is run without +\fI\-\-sslCAFile\fP, it will not attempt to validate +server certificates. This results in vulnerability to expired +\fBmongod\fP and \fBmongos\fP certificates as well as to foreign +processes posing as valid \fBmongod\fP or \fBmongos\fP +instances. Ensure that you \fIalways\fP specify the CA file against which +server certificates should be validated in cases where intrusion is a +possibility. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains both the SSL certificate +and key. Specify the file name of the \fB\&.pem\fP file using relative +or absolute paths. +.sp +This option is required when using the \fI\-\-ssl\fP option to connect +to a \fBmongod\fP or \fBmongos\fP that has +\fBCAFile\fP enabled \fIwithout\fP +\fBallowConnectionsWithoutCertificates\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyPassword +New in version 2.6. + +.sp +Specifies the password to de\-crypt the certificate\-key file (i.e. +\fI\-\-sslPEMKeyFile\fP). Use the \fI\-\-sslPEMKeyPassword\fP option only if the +certificate\-key file is encrypted. In all cases, the \fBmongodump\fP will +redact the password from all logging and reporting output. +.sp +If the private key in the PEM file is encrypted and you do not specify +the \fI\-\-sslPEMKeyPassword\fP option, the \fBmongodump\fP will prompt for a passphrase. See +\fIssl\-certificate\-password\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCRLFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the Certificate Revocation +List. Specify the file name of the \fB\&.pem\fP file using relative or +absolute paths. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidCertificates +New in version 2.6. + +.sp +Bypasses the validation checks for server certificates and allows +the use of invalid certificates. When using the +\fBallowInvalidCertificates\fP setting, MongoDB logs as a +warning the use of the invalid certificate. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidHostnames +New in version 3.0. + +.sp +Disables the validation of the hostnames in SSL certificates. Allows +\fBmongodump\fP to connect to MongoDB instances if the hostname their +certificates do not match the specified hostname. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslFIPSMode +New in version 2.6. + +.sp +Directs the \fBmongodump\fP to use the FIPS mode of the installed OpenSSL +library. Your system must have a FIPS compliant OpenSSL library to use +the \fI\-\-sslFIPSMode\fP option. +.sp +\fBNOTE:\fP +.INDENT 7.0 +.INDENT 3.5 +FIPS Compatible SSL is +available only in \fI\%MongoDB Enterprise\fP\&. See +http://docs.mongodb.org/manual/tutorial/configure\-fips for more information. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-username , \-u +Specifies a username with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-password\fP and +\fB\-\-authenticationDatabase\fP options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-password , \-p +Specifies a password with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-username\fP and +\fB\-\-authenticationDatabase\fP options. +.sp +If you do not specify an argument for \fI\-\-password\fP, \fBmongodump\fP will +prompt interactively for a password on the console. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationDatabase +If you do not specify an authentication database, \fBmongodump\fP +assumes that the database specified to export holds the user\(aqs credentials. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationMechanism +\fIDefault\fP: MONGODB\-CR +.sp +New in version 2.4. + +.sp +Changed in version 2.6: Added support for the \fBPLAIN\fP and \fBMONGODB\-X509\fP authentication +mechanisms. + +.sp +Specifies the authentication mechanism the \fBmongodump\fP instance uses to +authenticate to the \fBmongod\fP or \fBmongos\fP\&. +.TS +center; +|l|l|. +_ +T{ +Value +T} T{ +Description +T} +_ +T{ +MONGODB\-CR +T} T{ +MongoDB challenge/response authentication. +T} +_ +T{ +MONGODB\-X509 +T} T{ +MongoDB SSL certificate authentication. +T} +_ +T{ +PLAIN +T} T{ +External authentication using LDAP. You can also use \fBPLAIN\fP +for authenticating in\-database users. \fBPLAIN\fP transmits +passwords in plain text. This mechanism is available only in +\fI\%MongoDB Enterprise\fP\&. +T} +_ +T{ +GSSAPI +T} T{ +External authentication using Kerberos. This mechanism is +available only in \fI\%MongoDB Enterprise\fP\&. +T} +_ +.TE +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiServiceName +New in version 2.6. + +.sp +Specify the name of the service using \fBGSSAPI/Kerberos\fP\&. Only required if the service does not use the +default name of \fBmongodb\fP\&. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiHostName +New in version 2.6. + +.sp +Specify the hostname of a service using \fBGSSAPI/Kerberos\fP\&. \fIOnly\fP required if the hostname of a machine does +not match the hostname resolved by DNS. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-db , \-d +Specifies a database to backup. If you do not specify a database, +\fBmongodump\fP copies all databases in this instance into the dump +files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-collection , \-c +Specifies a collection to backup. If you do not specify a collection, +this option copies all collections in the specified database or instance +to the dump files. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-query , \-q +Provides a \fIJSON document\fP as a query that optionally limits the +documents included in the output of \fBmongodump\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-forceTableScan +Forces \fBmongodump\fP to scan the data store directly: typically, +\fBmongodump\fP saves entries as they appear in the index of +the \fB_id\fP field. If you specify a query \fI\-\-query\fP, +\fBmongodump\fP will use the most appropriate index to support that query. +.sp +Use \fI\-\-forceTableScan\fP to skip the index and scan the data directly. Typically +there are two cases where this behavior is preferable to the +default: +.INDENT 7.0 +.IP 1. 3 +If you have key sizes over 800 bytes that would not be present in the +\fB_id\fP index. +.IP 2. 3 +Your database uses a custom \fB_id\fP field. +.UNINDENT +.sp +When you run with \fI\-\-forceTableScan\fP, \fBmongodump\fP does +not use \fB$snapshot\fP\&. As a result, the dump produced by +\fBmongodump\fP can reflect the state of the database at many +different points in time. +.sp +\fBIMPORTANT:\fP +.INDENT 7.0 +.INDENT 3.5 +Use \fI\-\-forceTableScan\fP with extreme caution and +consideration. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-out , \-o +Specifies the directory where \fBmongodump\fP will write +\fIBSON\fP files for the dumped databases. By default, +\fBmongodump\fP saves output files in a directory named +\fBdump\fP in the current working directory. +.sp +To send the database dump to standard output, specify "\fB\-\fP" instead of +a path. Write to standard output if you want process the output before +saving it, such as to use \fBgzip\fP to compress the dump. When writing +standard output, \fBmongodump\fP does not write the metadata that +writes in a \fB.metadata.json\fP file when writing to files +directly. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-repair +Runs a repair option in addition to dumping the +database. The repair option changes the behavior of \fBmongodump\fP to +only write valid data and exclude data that may be in +an invalid state as a result of an improper shutdown or +\fBmongod\fP crash. +.sp +The \fI\%\-\-repair\fP option uses aggressive data\-recovery algorithms +that may produce a large amount of duplication. +.sp +\fI\%\-\-repair\fP is only available for use with \fBmongod\fP +instances using the \fBmmapv1\fP storage engine. You cannot run +\fI\%\-\-repair\fP with \fBmongos\fP or with \fBmongod\fP instances +that use the \fBwiredTiger\fP storage engine. To repair data in a +\fBmongod\fP instance using \fBwiredTiger\fP use +\fImongod \-\-repair\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-oplog +Ensures that \fBmongodump\fP creates a dump of +the database that includes a partial \fIoplog\fP containing operations +from the duration of the \fBmongodump\fP operation. This oplog +produces an effective point\-in\-time snapshot of the state of a +\fBmongod\fP instance. To restore to a specific point\-in\-time +backup, use the output created with this option in conjunction with +\fImongorestore \-\-oplogReplay\fP\&. +.sp +Without \fI\%\-\-oplog\fP, 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. +.sp +\fI\%\-\-oplog\fP has no effect when running \fBmongodump\fP +against a \fBmongos\fP instance to dump the entire contents of a +sharded cluster. However, you can use \fI\%\-\-oplog\fP to dump +individual shards. +.sp +\fI\%\-\-oplog\fP only works against nodes that maintain an +\fIoplog\fP\&. This includes all members of a replica set, as well as +\fImaster\fP nodes in master/slave replication deployments. +.sp +\fI\%\-\-oplog\fP does not dump the oplog collection. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dumpDbUsersAndRoles +Includes user and role definitions when performing \fBmongodump\fP +on a specific database. This option applies only when you specify a +database in the \fI\-\-db\fP option. MongoDB always includes user and +role definitions when \fBmongodump\fP applies to an entire instance +and not just a specific database. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-excludeCollection array of strings +New in version 3.0.0. + +.sp +Specifies collections to exclude from the output of \fBmongodump\fP output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-excludeCollectionsWithPrefix array of strings +New in version 3.0.0. + +.sp +Excludes all collections from the output of \fBmongodump\fP with a specified prefix. +.UNINDENT +.SH USE +.sp +See the http://docs.mongodb.org/manual/tutorial/backup\-with\-mongodump +for a larger overview of \fBmongodump\fP usage. Also see the +\fBmongorestore\fP document for an overview of the +\fBmongorestore\fP, which provides the related inverse +functionality. +.sp +The following command creates a dump file that contains only the +collection named \fBcollection\fP in the database named \fBtest\fP\&. In +this case the database is running on the local interface on port +\fB27017\fP: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongodump \-\-db test \-\-collection collection +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +In the next example, \fBmongodump\fP creates a database dump +located at \fB/opt/backup/mongodump\-2011\-10\-24\fP, from a database +running on port \fB37017\fP on the host \fBmongodb1.example.net\fP and +authenticating using the username \fBuser\fP and the password +\fBpass\fP, as follows: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongodump \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password pass \-\-out /opt/backup/mongodump\-2011\-10\-24 +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB Documentation Project +.SH COPYRIGHT +2011-2015 +.\" Generated by docutils manpage writer. +. diff --git a/SOURCES/mongoexport.1 b/SOURCES/mongoexport.1 new file mode 100644 index 0000000..e74a512 --- /dev/null +++ b/SOURCES/mongoexport.1 @@ -0,0 +1,709 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOEXPORT" "1" "January 30, 2015" "3.0" "mongodb-manual" +.SH NAME +mongoexport \- MongoDB Export Utility +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.sp +\fBmongoexport\fP is a utility that produces a JSON or CSV export +of data stored in a MongoDB instance. See the +http://docs.mongodb.org/manual/core/import\-export document for a more in depth +usage overview, and the \fBmongoimport\fP document for more +information regarding the \fBmongoimport\fP utility, which +provides the inverse "importing" capability. +.SH CONSIDERATIONS +.sp +Do not use \fBmongoimport\fP and \fBmongoexport\fP for +full\-scale production backups because they may not reliably capture +data type information. Use \fBmongodump\fP and +\fBmongorestore\fP as described in http://docs.mongodb.org/manual/core/backups for this +kind of functionality. +.SH OPTIONS +.sp +Changed in version 3.0.0: \fBmongoexport\fP removed the \fB\-\-dbpath\fP as well as related +\fB\-\-directoryperdb\fP and \fB\-\-journal\fP options. You must use +\fBmongoexport\fP while connected to a \fBmongod\fP instance. + +.sp +Changed in version 3.0.0: \fBmongoexport\fP also removed support for writing data to +\fBtsv\fP files with the \fB\-\-tsv\fP option. + +.INDENT 0.0 +.TP +.B mongoexport +.UNINDENT +.INDENT 0.0 +.TP +.B mongoexport +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Returns information on the options and use of \fBmongoexport\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verbose, \-v +Increases the amount of internal reporting returned on standard output +or in log files. Increase the verbosity with the \fB\-v\fP form by +including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-quiet +Runs the \fBmongoexport\fP in a quiet mode that attempts to limit the amount +of output. +.sp +This option suppresses: +.INDENT 7.0 +.IP \(bu 2 +output from \fIdatabase commands\fP +.IP \(bu 2 +replication activity +.IP \(bu 2 +connection accepted events +.IP \(bu 2 +connection closed events +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Returns the \fBmongoexport\fP release number. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-host <:port>, \-h <:port> +\fIDefault\fP: localhost:27017 +.sp +Specifies a resolvable hostname for the \fBmongod\fP to which to +connect. By default, the \fBmongoexport\fP attempts to connect to a MongoDB +instance running on the localhost on port number \fB27017\fP\&. +.sp +To connect to a replica set, specify the +\fBreplSetName\fP and a seed list of set members, as in +the following: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +/<:port>,<:port>,<...> +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +You can always connect directly to a single MongoDB instance by +specifying the host and port number directly. +.sp +Changed in version 3.0.0: If you use IPv6 and use the \fB
:\fP format, you must +enclose the portion of an address and port combination in +brackets (e.g. \fB[
]\fP). + +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-port +\fIDefault\fP: 27017 +.sp +Specifies the TCP port on which the MongoDB instance listens for +client connections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ipv6 +Enables IPv6 support and allows the \fBmongoexport\fP to connect to the +MongoDB instance using an IPv6 network. All MongoDB programs and +processes disable IPv6 support by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ssl +New in version 2.6. + +.sp +Enables connection to a \fBmongod\fP or \fBmongos\fP that has +SSL support enabled. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCAFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the root certificate chain +from the Certificate Authority. Specify the file name of the +\fB\&.pem\fP file using relative or absolute paths. +.sp +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\&. +.sp +\fBWARNING:\fP +.INDENT 7.0 +.INDENT 3.5 +If the \fBmongo\fP shell or any other tool that connects to +\fBmongos\fP or \fBmongod\fP is run without +\fI\-\-sslCAFile\fP, it will not attempt to validate +server certificates. This results in vulnerability to expired +\fBmongod\fP and \fBmongos\fP certificates as well as to foreign +processes posing as valid \fBmongod\fP or \fBmongos\fP +instances. Ensure that you \fIalways\fP specify the CA file against which +server certificates should be validated in cases where intrusion is a +possibility. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains both the SSL certificate +and key. Specify the file name of the \fB\&.pem\fP file using relative +or absolute paths. +.sp +This option is required when using the \fI\-\-ssl\fP option to connect +to a \fBmongod\fP or \fBmongos\fP that has +\fBCAFile\fP enabled \fIwithout\fP +\fBallowConnectionsWithoutCertificates\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyPassword +New in version 2.6. + +.sp +Specifies the password to de\-crypt the certificate\-key file (i.e. +\fI\-\-sslPEMKeyFile\fP). Use the \fI\-\-sslPEMKeyPassword\fP option only if the +certificate\-key file is encrypted. In all cases, the \fBmongoexport\fP will +redact the password from all logging and reporting output. +.sp +If the private key in the PEM file is encrypted and you do not specify +the \fI\-\-sslPEMKeyPassword\fP option, the \fBmongoexport\fP will prompt for a passphrase. See +\fIssl\-certificate\-password\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCRLFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the Certificate Revocation +List. Specify the file name of the \fB\&.pem\fP file using relative or +absolute paths. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidCertificates +New in version 2.6. + +.sp +Bypasses the validation checks for server certificates and allows +the use of invalid certificates. When using the +\fBallowInvalidCertificates\fP setting, MongoDB logs as a +warning the use of the invalid certificate. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidHostnames +New in version 3.0. + +.sp +Disables the validation of the hostnames in SSL certificates. Allows +\fBmongoexport\fP to connect to MongoDB instances if the hostname their +certificates do not match the specified hostname. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslFIPSMode +New in version 2.6. + +.sp +Directs the \fBmongoexport\fP to use the FIPS mode of the installed OpenSSL +library. Your system must have a FIPS compliant OpenSSL library to use +the \fI\-\-sslFIPSMode\fP option. +.sp +\fBNOTE:\fP +.INDENT 7.0 +.INDENT 3.5 +FIPS Compatible SSL is +available only in \fI\%MongoDB Enterprise\fP\&. See +http://docs.mongodb.org/manual/tutorial/configure\-fips for more information. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-username , \-u +Specifies a username with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-password\fP and +\fB\-\-authenticationDatabase\fP options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-password , \-p +Specifies a password with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-username\fP and +\fB\-\-authenticationDatabase\fP options. +.sp +If you do not specify an argument for \fI\-\-password\fP, \fBmongoexport\fP will +prompt interactively for a password on the console. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationDatabase +If you do not specify an authentication database, \fBmongoexport\fP +assumes that the database specified to export holds the user\(aqs credentials. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationMechanism +\fIDefault\fP: MONGODB\-CR +.sp +New in version 2.4. + +.sp +Changed in version 2.6: Added support for the \fBPLAIN\fP and \fBMONGODB\-X509\fP authentication +mechanisms. + +.sp +Specifies the authentication mechanism the \fBmongoexport\fP instance uses to +authenticate to the \fBmongod\fP or \fBmongos\fP\&. +.TS +center; +|l|l|. +_ +T{ +Value +T} T{ +Description +T} +_ +T{ +MONGODB\-CR +T} T{ +MongoDB challenge/response authentication. +T} +_ +T{ +MONGODB\-X509 +T} T{ +MongoDB SSL certificate authentication. +T} +_ +T{ +PLAIN +T} T{ +External authentication using LDAP. You can also use \fBPLAIN\fP +for authenticating in\-database users. \fBPLAIN\fP transmits +passwords in plain text. This mechanism is available only in +\fI\%MongoDB Enterprise\fP\&. +T} +_ +T{ +GSSAPI +T} T{ +External authentication using Kerberos. This mechanism is +available only in \fI\%MongoDB Enterprise\fP\&. +T} +_ +.TE +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiServiceName +New in version 2.6. + +.sp +Specify the name of the service using \fBGSSAPI/Kerberos\fP\&. Only required if the service does not use the +default name of \fBmongodb\fP\&. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiHostName +New in version 2.6. + +.sp +Specify the hostname of a service using \fBGSSAPI/Kerberos\fP\&. \fIOnly\fP required if the hostname of a machine does +not match the hostname resolved by DNS. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-db , \-d +Specifies the name of the database on which to run the \fBmongoexport\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-collection , \-c +Specifies the collection to export. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-fields , \-f +Specifies a field or fields to \fIinclude\fP in the export. Use a comma +separated list of fields to specify multiple fields. +.sp +For \fIcsv\fP output formats, +\fBmongoexport\fP includes only the specified field(s), and the +specified field(s) can be a field within a sub\-document. +.sp +For \fIJSON\fP output formats, \fBmongoexport\fP includes +only the specified field(s) \fBand\fP the \fB_id\fP field, and if the +specified field(s) is a field within a sub\-document, the +\fBmongoexport\fP includes the sub\-document with all +its fields, not just the specified field within the document. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-fieldFile +An alternative to \fI\-\-fields\fP\&. The +\fI\-\-fieldFile\fP option allows you to +specify in a file the field or fields to \fIinclude\fP in the export and is +\fBonly valid\fP with the \fI\-\-type\fP option +with value \fBcsv\fP\&. The +file must have only one field per line, and the line(s) must end with +the LF character (\fB0x0A\fP). +.sp +\fBmongoexport\fP includes only the specified field(s). The +specified field(s) can be a field within a sub\-document. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-query , \-q +Provides a \fIJSON document\fP as a query that optionally limits +the documents returned in the export. Specify JSON in \fBstrict +format\fP\&. +.sp +For example, given a collection named \fBrecords\fP in the database +\fBtest\fP with the following documents: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "_id" : ObjectId("51f0188846a64a1ed98fde7c"), "a" : 1 } +{ "_id" : ObjectId("520e61b0c6646578e3661b59"), "a" : 1, "b" : 2 } +{ "_id" : ObjectId("520e642bb7fa4ea22d6b1871"), "a" : 2, "b" : 3, "c" : 5 } +{ "_id" : ObjectId("520e6431b7fa4ea22d6b1872"), "a" : 3, "b" : 3, "c" : 6 } +{ "_id" : ObjectId("520e6445b7fa4ea22d6b1873"), "a" : 5, "b" : 6, "c" : 8 } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The following \fBmongoexport\fP uses the \fI\%\-q\fP option to +export only the documents with the field \fBa\fP greater than or equal to +(\fB$gte\fP) to \fB3\fP: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoexport \-d test \-c records \-q "{ a: { \e$gte: 3 } }" \-\-out exportdir/myRecords.json +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The resulting file contains the following documents: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "_id" : { "$oid" : "520e6431b7fa4ea22d6b1872" }, "a" : 3, "b" : 3, "c" : 6 } +{ "_id" : { "$oid" : "520e6445b7fa4ea22d6b1873" }, "a" : 5, "b" : 6, "c" : 8 } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +You can sort the results with the \fI\%\-\-sort\fP option to +\fBmongoexport\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-type +\fIDefault\fP: json +.sp +New in version 3.0.0. + +.sp +Specifies the file type to export. The default format is \fIJSON\fP, +bit it is possible to export \fIcsv\fP files. +.sp +If you specify \fBcsv\fP, then you must also use either +the \fI\-\-fields\fP or the \fI\-\-fieldFile\fP option to +declare the fields to export from the collection. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-out , \-o +Specifies a file to write the export to. If you do not specify a file +name, the \fBmongoexport\fP writes data to standard output +(e.g. \fBstdout\fP). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-jsonArray +Modifies the output of \fBmongoexport\fP to write the +entire contents of the export as a single \fIJSON\fP array. By +default \fBmongoexport\fP writes data using one JSON document +for every MongoDB document. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-pretty +New in version 3.0.0. + +.sp +Outputs documents in a pretty\-printed format JSON. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-slaveOk, \-k +Allows \fBmongoexport\fP to read data from secondary or slave +nodes when using \fBmongoexport\fP with a replica set. This +option is only available if connected to a \fBmongod\fP or +\fBmongos\fP and is not available when used with the +"\fImongoexport \-\-dbpath\fP" option. +.sp +This is the default behavior. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-forceTableScan +New in version 2.2. + +.sp +Forces \fBmongoexport\fP to scan the data store directly: +typically, \fBmongoexport\fP saves entries as they appear in the +index of the \fB_id\fP field. Use \fI\%\-\-forceTableScan\fP to skip +the index and scan the data directly. Typically there are two cases +where this behavior is preferable to the default: +.INDENT 7.0 +.IP 1. 3 +If you have key sizes over 800 bytes that would not be present +in the \fB_id\fP index. +.IP 2. 3 +Your database uses a custom \fB_id\fP field. +.UNINDENT +.sp +When you run with \fI\%\-\-forceTableScan\fP, \fBmongoexport\fP +does not use \fB$snapshot\fP\&. As a result, the export produced +by \fBmongoexport\fP can reflect the state of the database at +many different points in time. +.sp +\fBWARNING:\fP +.INDENT 7.0 +.INDENT 3.5 +Use \fI\%\-\-forceTableScan\fP with extreme caution +and consideration. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-skip +Use \fI\%\-\-skip\fP to control where \fBmongoexport\fP begins +exporting documents. See \fBskip()\fP for information about +the underlying operation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-limit +Specifies a maximum number of documents to include in the +export. See \fBlimit()\fP for information about +the underlying operation. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sort +Specifies an ordering for exported results. If an index does +\fBnot\fP exist that can support the sort operation, the results must +be \fIless than\fP 32 megabytes. +.sp +Use \fI\%\-\-sort\fP conjunction with \fI\%\-\-skip\fP and +\fI\%\-\-limit\fP to limit number of exported documents. +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoexport \-d test \-c records \-\-sort \(aq{a: 1}\(aq \-\-limit 100 \-\-out export.0.json +mongoexport \-d test \-c records \-\-sort \(aq{a: 1}\(aq \-\-limit 100 \-\-skip 100 \-\-out export.1.json +mongoexport \-d test \-c records \-\-sort \(aq{a: 1}\(aq \-\-limit 100 \-\-skip 200 \-\-out export.2.json +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +See \fBsort()\fP for information about the underlying +operation. +.UNINDENT +.SH USE +.SS Export in CSV Format +.sp +In the following example, \fBmongoexport\fP exports the +collection \fBcontacts\fP from the \fBusers\fP database from the +\fBmongod\fP instance running on the localhost port number +\fB27017\fP\&. This command writes the export data in \fICSV\fP format +into a file located at \fB/opt/backups/contacts.csv\fP\&. The +\fBfields.txt\fP file contains a line\-separated list of fields to +export. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoexport \-\-db users \-\-collection contacts \-\-csv \-\-fieldFile fields.txt \-\-out /opt/backups/contacts.csv +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Export in JSON Format +.sp +The next example creates an export of the collection \fBcontacts\fP +from the MongoDB instance running on the localhost port number \fB27017\fP, +with journaling explicitly enabled. This writes the export to the +\fBcontacts.json\fP file in \fIJSON\fP format. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoexport \-\-db sales \-\-collection contacts \-\-out contacts.json \-\-journal +.ft P +.fi +.UNINDENT +.UNINDENT +.SS Export from Remote Host Running with Authentication +.sp +The following example exports the collection \fBcontacts\fP from the +database \fBmarketing\fP . This data resides on the MongoDB instance +located on the host \fBmongodb1.example.net\fP running on port \fB37017\fP, +which requires the username \fBuser\fP and the password \fBpass\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoexport \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password pass \-\-collection contacts \-\-db marketing \-\-out mdb1\-examplenet.json +.ft P +.fi +.UNINDENT +.UNINDENT +.SH TYPE FIDELITY +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBmongoimport\fP and \fBmongoexport\fP do not reliably +preserve all rich \fIBSON\fP data types because \fIJSON\fP can +only represent a subset of the types supported by BSON. As a result, +data exported or imported with these tools may lose some measure of +fidelity. See the \fBExtended JSON\fP +reference for more information. +.UNINDENT +.UNINDENT +.sp +JSON can only represent a subset of the types supported by BSON. To +preserve type information, \fBmongoexport\fP uses the \fBstrict +mode representation\fP for certain +types. +.sp +For example, the following insert operation in the \fBmongo\fP +shell uses the \fBmongoShell mode representation\fP for the BSON types +\fBdata_date\fP and \fBdata_numberlong\fP: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +use test +db.traffic.insert( { _id: 1, volume: NumberLong(2980000), date: new Date() } ) +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Use \fBmongoexport\fP to export the data: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoexport \-\-db test \-\-collection traffic \-\-out traffic.json +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The exported data is in \fBstrict mode representation\fP to preserve type information: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "_id" : 1, "volume" : { "$numberLong" : "2980000" }, "date" : { "$date" : "2014\-03\-13T13:47:42.483\-0400" } } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +See http://docs.mongodb.org/manual/reference/mongodb\-extended\-json for a complete list of +these types and the representations used. +.SH AUTHOR +MongoDB Documentation Project +.SH COPYRIGHT +2011-2015 +.\" Generated by docutils manpage writer. +. diff --git a/SOURCES/mongofiles.1 b/SOURCES/mongofiles.1 new file mode 100644 index 0000000..5ef1a35 --- /dev/null +++ b/SOURCES/mongofiles.1 @@ -0,0 +1,586 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOFILES" "1" "January 30, 2015" "3.0" "mongodb-manual" +.SH NAME +mongofiles \- MongoDB GridFS Utility +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.sp +The \fBmongofiles\fP utility makes it possible to manipulate files +stored in your MongoDB instance in \fIGridFS\fP objects from the +command line. It is particularly useful as it provides an interface +between objects stored in your file system and GridFS. +.sp +All \fBmongofiles\fP commands have the following form: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongofiles +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The components of the \fBmongofiles\fP command are: +.INDENT 0.0 +.IP 1. 3 +\fI\%Options\fP\&. You may use one or more of +these options to control the behavior of \fBmongofiles\fP\&. +.IP 2. 3 +\fI\%Commands\fP\&. Use one of these commands to +determine the action of \fBmongofiles\fP\&. +.IP 3. 3 +A filename which is either: the name of a file on your local\(aqs file +system, or a GridFS object. +.UNINDENT +.sp +\fBmongofiles\fP, like \fBmongodump\fP, \fBmongoexport\fP, +\fBmongoimport\fP, and \fBmongorestore\fP, can access data +stored in a MongoDB data directory without requiring a running +\fBmongod\fP instance, if no other \fBmongod\fP is running. +.sp +\fBIMPORTANT:\fP +.INDENT 0.0 +.INDENT 3.5 +For \fIreplica sets\fP, +\fBmongofiles\fP can only read from the set\(aqs +\(aq\fIprimary\fP\&. +.UNINDENT +.UNINDENT +.SH OPTIONS +.sp +Changed in version 3.0.0: \fBmongofiles\fP removed the \fB\-\-dbpath\fP as well as related +\fB\-\-directoryperdb\fP and \fB\-\-journal\fP options. You must use +\fBmongofiles\fP while connected to a \fBmongod\fP instance. + +.INDENT 0.0 +.TP +.B mongofiles +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Returns information on the options and use of \fBmongofiles\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verbose, \-v +Increases the amount of internal reporting returned on standard output +or in log files. Increase the verbosity with the \fB\-v\fP form by +including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-quiet +Runs the \fBmongofiles\fP in a quiet mode that attempts to limit the amount +of output. +.sp +This option suppresses: +.INDENT 7.0 +.IP \(bu 2 +output from \fIdatabase commands\fP +.IP \(bu 2 +replication activity +.IP \(bu 2 +connection accepted events +.IP \(bu 2 +connection closed events +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Returns the \fBmongofiles\fP release number. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-host <:port> +Specifies a resolvable hostname for the \fBmongod\fP that holds +your GridFS system. By default \fBmongofiles\fP attempts to connect +to a MongoDB process running on the localhost port number \fB27017\fP\&. +.sp +Optionally, specify a port number to connect a MongoDB instance running +on a port other than 27017. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-port +\fIDefault\fP: 27017 +.sp +Specifies the TCP port on which the MongoDB instance listens for +client connections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ipv6 +Enables IPv6 support and allows the \fBmongofiles\fP to connect to the +MongoDB instance using an IPv6 network. All MongoDB programs and +processes disable IPv6 support by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ssl +New in version 2.6. + +.sp +Enables connection to a \fBmongod\fP or \fBmongos\fP that has +SSL support enabled. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCAFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the root certificate chain +from the Certificate Authority. Specify the file name of the +\fB\&.pem\fP file using relative or absolute paths. +.sp +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\&. +.sp +\fBWARNING:\fP +.INDENT 7.0 +.INDENT 3.5 +If the \fBmongo\fP shell or any other tool that connects to +\fBmongos\fP or \fBmongod\fP is run without +\fI\-\-sslCAFile\fP, it will not attempt to validate +server certificates. This results in vulnerability to expired +\fBmongod\fP and \fBmongos\fP certificates as well as to foreign +processes posing as valid \fBmongod\fP or \fBmongos\fP +instances. Ensure that you \fIalways\fP specify the CA file against which +server certificates should be validated in cases where intrusion is a +possibility. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains both the SSL certificate +and key. Specify the file name of the \fB\&.pem\fP file using relative +or absolute paths. +.sp +This option is required when using the \fI\-\-ssl\fP option to connect +to a \fBmongod\fP or \fBmongos\fP that has +\fBCAFile\fP enabled \fIwithout\fP +\fBallowConnectionsWithoutCertificates\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyPassword +New in version 2.6. + +.sp +Specifies the password to de\-crypt the certificate\-key file (i.e. +\fI\-\-sslPEMKeyFile\fP). Use the \fI\-\-sslPEMKeyPassword\fP option only if the +certificate\-key file is encrypted. In all cases, the \fBmongofiles\fP will +redact the password from all logging and reporting output. +.sp +If the private key in the PEM file is encrypted and you do not specify +the \fI\-\-sslPEMKeyPassword\fP option, the \fBmongofiles\fP will prompt for a passphrase. See +\fIssl\-certificate\-password\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCRLFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the Certificate Revocation +List. Specify the file name of the \fB\&.pem\fP file using relative or +absolute paths. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidCertificates +New in version 2.6. + +.sp +Bypasses the validation checks for server certificates and allows +the use of invalid certificates. When using the +\fBallowInvalidCertificates\fP setting, MongoDB logs as a +warning the use of the invalid certificate. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidHostnames +New in version 3.0. + +.sp +Disables the validation of the hostnames in SSL certificates. Allows +\fBmongofiles\fP to connect to MongoDB instances if the hostname their +certificates do not match the specified hostname. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslFIPSMode +New in version 2.6. + +.sp +Directs the \fBmongofiles\fP to use the FIPS mode of the installed OpenSSL +library. Your system must have a FIPS compliant OpenSSL library to use +the \fI\-\-sslFIPSMode\fP option. +.sp +\fBNOTE:\fP +.INDENT 7.0 +.INDENT 3.5 +FIPS Compatible SSL is +available only in \fI\%MongoDB Enterprise\fP\&. See +http://docs.mongodb.org/manual/tutorial/configure\-fips for more information. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-username , \-u +Specifies a username with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-password\fP and +\fB\-\-authenticationDatabase\fP options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-password , \-p +Specifies a password with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-username\fP and +\fB\-\-authenticationDatabase\fP options. +.sp +If you do not specify an argument for \fI\-\-password\fP, \fBmongofiles\fP will +prompt interactively for a password on the console. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationDatabase +New in version 2.4. + +.sp +Specifies the database that holds the user\(aqs credentials. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationMechanism +\fIDefault\fP: MONGODB\-CR +.sp +New in version 2.4. + +.sp +Changed in version 2.6: Added support for the \fBPLAIN\fP and \fBMONGODB\-X509\fP authentication +mechanisms. + +.sp +Specifies the authentication mechanism the \fBmongofiles\fP instance uses to +authenticate to the \fBmongod\fP or \fBmongos\fP\&. +.TS +center; +|l|l|. +_ +T{ +Value +T} T{ +Description +T} +_ +T{ +MONGODB\-CR +T} T{ +MongoDB challenge/response authentication. +T} +_ +T{ +MONGODB\-X509 +T} T{ +MongoDB SSL certificate authentication. +T} +_ +T{ +PLAIN +T} T{ +External authentication using LDAP. You can also use \fBPLAIN\fP +for authenticating in\-database users. \fBPLAIN\fP transmits +passwords in plain text. This mechanism is available only in +\fI\%MongoDB Enterprise\fP\&. +T} +_ +T{ +GSSAPI +T} T{ +External authentication using Kerberos. This mechanism is +available only in \fI\%MongoDB Enterprise\fP\&. +T} +_ +.TE +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiServiceName +New in version 2.6. + +.sp +Specify the name of the service using \fBGSSAPI/Kerberos\fP\&. Only required if the service does not use the +default name of \fBmongodb\fP\&. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiHostName +New in version 2.6. + +.sp +Specify the hostname of a service using \fBGSSAPI/Kerberos\fP\&. \fIOnly\fP required if the hostname of a machine does +not match the hostname resolved by DNS. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-db , \-d +Specifies the name of the database on which to run the \fBmongofiles\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-collection , \-c +This option has no use in this context and a future release may +remove it. See \fI\%SERVER\-4931\fP for more information. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-local , \-l +Specifies the local filesystem name of a file for get and put +operations. +.sp +In the \fBmongofiles put\fP and \fBmongofiles get\fP commands, +the required \fB\fP modifier refers to the name the object will +have in GridFS. \fBmongofiles\fP assumes that this reflects the +file\(aqs name on the local file system. This setting overrides this +default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-type +Provides the ability to specify a \fIMIME\fP type to describe the file +inserted into GridFS storage. \fBmongofiles\fP omits this option in +the default operation. +.sp +Use only with \fBmongofiles put\fP operations. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-replace, \-r +Alters the behavior of \fBmongofiles put\fP to replace existing +GridFS objects with the specified local file, rather than adding an +additional object with the same name. +.sp +In the default operation, files will not be overwritten by a +\fBmongofiles put\fP option. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-prefix string +\fIDefault\fP: fs +.sp +GridFS prefix to use. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-writeConcern +\fIDefault\fP: majority +.sp +Specifies the \fIwrite concern\fP for each write operation that \fBmongofiles\fP +writes to the target database. +.sp +Specify the write concern as a document with \fIw options\fP\&. +.UNINDENT +.SH COMMANDS +.INDENT 0.0 +.TP +.B list +Lists the files in the GridFS store. The characters specified after +\fBlist\fP (e.g. \fB\fP) optionally limit the list of +returned items to files that begin with that string of characters. +.UNINDENT +.INDENT 0.0 +.TP +.B search +Lists the files in the GridFS store with names that match any +portion of \fB\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B put +Copy the specified file from the local file system into GridFS +storage. +.sp +Here, \fB\fP refers to the name the object will have in +GridFS, and \fBmongofiles\fP assumes that this reflects the name the +file has on the local file system. If the local filename is +different use the \fImongofiles \-\-local\fP option. +.UNINDENT +.INDENT 0.0 +.TP +.B get +Copy the specified file from GridFS storage to the local file +system. +.sp +Here, \fB\fP refers to the name the object will have in +GridFS, and \fBmongofiles\fP assumes that this reflects the name the +file has on the local file system. If the local filename is +different use the \fImongofiles \-\-local\fP option. +.UNINDENT +.INDENT 0.0 +.TP +.B delete +Delete the specified file from GridFS storage. +.UNINDENT +.SH EXAMPLES +.sp +To return a list of all files in a \fIGridFS\fP collection in the +\fBrecords\fP database, use the following invocation at the system shell: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongofiles \-d records list +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This \fBmongofiles\fP instance will connect to the +\fBmongod\fP instance running on the \fB27017\fP localhost +interface to specify the same operation on a different port or +hostname, and issue a command that resembles one of the following: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongofiles \-\-port 37017 \-d records list +mongofiles \-\-hostname db1.example.net \-d records list +mongofiles \-\-hostname db1.example.net \-\-port 37017 \-d records list +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Modify any of the following commands as needed if you\(aqre connecting +the \fBmongod\fP instances on different ports or hosts. +.sp +To upload a file named \fB32\-corinth.lp\fP to the GridFS collection in +the \fBrecords\fP database, you can use the following command: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongofiles \-d records put 32\-corinth.lp +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +To delete the \fB32\-corinth.lp\fP file from this GridFS collection in +the \fBrecords\fP database, you can use the following command: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongofiles \-d records delete 32\-corinth.lp +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +To search for files in the GridFS collection in the \fBrecords\fP +database that have the string \fBcorinth\fP in their names, you can use +following command: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongofiles \-d records search corinth +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +To list all files in the GridFS collection in the \fBrecords\fP database +that begin with the string \fB32\fP, you can use the following command: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongofiles \-d records list 32 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +To fetch the file from the GridFS collection in the \fBrecords\fP +database named \fB32\-corinth.lp\fP, you can use the following command: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongofiles \-d records get 32\-corinth.lp +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB Documentation Project +.SH COPYRIGHT +2011-2015 +.\" Generated by docutils manpage writer. +. diff --git a/SOURCES/mongoimport.1 b/SOURCES/mongoimport.1 new file mode 100644 index 0000000..3f2113d --- /dev/null +++ b/SOURCES/mongoimport.1 @@ -0,0 +1,658 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOIMPORT" "1" "January 30, 2015" "3.0" "mongodb-manual" +.SH NAME +mongoimport \- MongoDB Import Utility +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.sp +The \fBmongoimport\fP tool provides a route to import content from a +JSON, CSV, or TSV export created by \fBmongoexport\fP, or +potentially, another third\-party export tool. See the +http://docs.mongodb.org/manual/core/import\-export document for a more in depth +usage overview, and the \fBmongoexport\fP document for more +information regarding \fBmongoexport\fP, which +provides the inverse "exporting" capability. +.SH CONSIDERATIONS +.sp +Do not use \fBmongoimport\fP and \fBmongoexport\fP for +full instance, production backups because they will not reliably capture data type +information. Use \fBmongodump\fP and \fBmongorestore\fP as +described in http://docs.mongodb.org/manual/core/backups for this kind of +functionality. +.sp +\fBmongoimport\fP is single\-threaded and inserts one document at +a time into MongoDB. Custom import tools for data ingestion may have +better performance for specific workloads. +.SH OPTIONS +.sp +Changed in version 3.0.0: \fBmongoimport\fP removed the \fB\-\-dbpath\fP as well as related +\fB\-\-directoryperdb\fP and \fB\-\-journal\fP options. You must use +\fBmongoimport\fP while connected to a \fBmongod\fP instance. + +.INDENT 0.0 +.TP +.B mongoimport +.UNINDENT +.INDENT 0.0 +.TP +.B mongoimport +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Returns information on the options and use of \fBmongoimport\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verbose, \-v +Increases the amount of internal reporting returned on standard output +or in log files. Increase the verbosity with the \fB\-v\fP form by +including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-quiet +Runs the \fBmongoimport\fP in a quiet mode that attempts to limit the amount +of output. +.sp +This option suppresses: +.INDENT 7.0 +.IP \(bu 2 +output from \fIdatabase commands\fP +.IP \(bu 2 +replication activity +.IP \(bu 2 +connection accepted events +.IP \(bu 2 +connection closed events +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Returns the \fBmongoimport\fP release number. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-host <:port>, \-h <:port> +\fIDefault\fP: localhost:27017 +.sp +Specifies a resolvable hostname for the \fBmongod\fP to which to +connect. By default, the \fBmongoimport\fP attempts to connect to a MongoDB +instance running on the localhost on port number \fB27017\fP\&. +.sp +To connect to a replica set, specify the +\fBreplSetName\fP and a seed list of set members, as in +the following: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +/<:port>,<:port>,<...> +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +You can always connect directly to a single MongoDB instance by +specifying the host and port number directly. +.sp +Changed in version 3.0.0: If you use IPv6 and use the \fB
:\fP format, you must +enclose the portion of an address and port combination in +brackets (e.g. \fB[
]\fP). + +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-port +\fIDefault\fP: 27017 +.sp +Specifies the TCP port on which the MongoDB instance listens for +client connections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ipv6 +Enables IPv6 support and allows the \fBmongoimport\fP to connect to the +MongoDB instance using an IPv6 network. All MongoDB programs and +processes disable IPv6 support by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ssl +New in version 2.6. + +.sp +Enables connection to a \fBmongod\fP or \fBmongos\fP that has +SSL support enabled. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCAFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the root certificate chain +from the Certificate Authority. Specify the file name of the +\fB\&.pem\fP file using relative or absolute paths. +.sp +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\&. +.sp +\fBWARNING:\fP +.INDENT 7.0 +.INDENT 3.5 +If the \fBmongo\fP shell or any other tool that connects to +\fBmongos\fP or \fBmongod\fP is run without +\fI\-\-sslCAFile\fP, it will not attempt to validate +server certificates. This results in vulnerability to expired +\fBmongod\fP and \fBmongos\fP certificates as well as to foreign +processes posing as valid \fBmongod\fP or \fBmongos\fP +instances. Ensure that you \fIalways\fP specify the CA file against which +server certificates should be validated in cases where intrusion is a +possibility. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains both the SSL certificate +and key. Specify the file name of the \fB\&.pem\fP file using relative +or absolute paths. +.sp +This option is required when using the \fI\-\-ssl\fP option to connect +to a \fBmongod\fP or \fBmongos\fP that has +\fBCAFile\fP enabled \fIwithout\fP +\fBallowConnectionsWithoutCertificates\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyPassword +New in version 2.6. + +.sp +Specifies the password to de\-crypt the certificate\-key file (i.e. +\fI\-\-sslPEMKeyFile\fP). Use the \fI\-\-sslPEMKeyPassword\fP option only if the +certificate\-key file is encrypted. In all cases, the \fBmongoimport\fP will +redact the password from all logging and reporting output. +.sp +If the private key in the PEM file is encrypted and you do not specify +the \fI\-\-sslPEMKeyPassword\fP option, the \fBmongoimport\fP will prompt for a passphrase. See +\fIssl\-certificate\-password\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCRLFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the Certificate Revocation +List. Specify the file name of the \fB\&.pem\fP file using relative or +absolute paths. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidCertificates +New in version 2.6. + +.sp +Bypasses the validation checks for server certificates and allows +the use of invalid certificates. When using the +\fBallowInvalidCertificates\fP setting, MongoDB logs as a +warning the use of the invalid certificate. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidHostnames +New in version 3.0. + +.sp +Disables the validation of the hostnames in SSL certificates. Allows +\fBmongoimport\fP to connect to MongoDB instances if the hostname their +certificates do not match the specified hostname. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslFIPSMode +New in version 2.6. + +.sp +Directs the \fBmongoimport\fP to use the FIPS mode of the installed OpenSSL +library. Your system must have a FIPS compliant OpenSSL library to use +the \fI\-\-sslFIPSMode\fP option. +.sp +\fBNOTE:\fP +.INDENT 7.0 +.INDENT 3.5 +FIPS Compatible SSL is +available only in \fI\%MongoDB Enterprise\fP\&. See +http://docs.mongodb.org/manual/tutorial/configure\-fips for more information. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-username , \-u +Specifies a username with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-password\fP and +\fB\-\-authenticationDatabase\fP options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-password , \-p +Specifies a password with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-username\fP and +\fB\-\-authenticationDatabase\fP options. +.sp +If you do not specify an argument for \fI\-\-password\fP, \fBmongoimport\fP will +prompt interactively for a password on the console. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationDatabase +New in version 2.4. + +.sp +Specifies the database that holds the user\(aqs credentials. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationMechanism +\fIDefault\fP: MONGODB\-CR +.sp +New in version 2.4. + +.sp +Changed in version 2.6: Added support for the \fBPLAIN\fP and \fBMONGODB\-X509\fP authentication +mechanisms. + +.sp +Specifies the authentication mechanism the \fBmongoimport\fP instance uses to +authenticate to the \fBmongod\fP or \fBmongos\fP\&. +.TS +center; +|l|l|. +_ +T{ +Value +T} T{ +Description +T} +_ +T{ +MONGODB\-CR +T} T{ +MongoDB challenge/response authentication. +T} +_ +T{ +MONGODB\-X509 +T} T{ +MongoDB SSL certificate authentication. +T} +_ +T{ +PLAIN +T} T{ +External authentication using LDAP. You can also use \fBPLAIN\fP +for authenticating in\-database users. \fBPLAIN\fP transmits +passwords in plain text. This mechanism is available only in +\fI\%MongoDB Enterprise\fP\&. +T} +_ +T{ +GSSAPI +T} T{ +External authentication using Kerberos. This mechanism is +available only in \fI\%MongoDB Enterprise\fP\&. +T} +_ +.TE +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiServiceName +New in version 2.6. + +.sp +Specify the name of the service using \fBGSSAPI/Kerberos\fP\&. Only required if the service does not use the +default name of \fBmongodb\fP\&. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiHostName +New in version 2.6. + +.sp +Specify the hostname of a service using \fBGSSAPI/Kerberos\fP\&. \fIOnly\fP required if the hostname of a machine does +not match the hostname resolved by DNS. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-db , \-d +Specifies the name of the database on which to run the \fBmongoimport\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-collection , \-c +Specifies the collection to import. +.sp +New in version 2.6: If you do not specify \fI\-\-collection\fP, +\fBmongoimport\fP takes the collection name from the input +filename. MongoDB omits the extension of the file from the +collection name, if the input file has an extension. + +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-fields , \-f +Specify a comma separated list of field names when importing \fIcsv\fP +or \fItsv\fP files that do not have field names in the first (i.e. +header) line of the file. +.sp +If you attempt to include \fI\%\-\-fields\fP when importing JSON data, +\fBmongoimport\fP will return an error. \fI\%\-\-fields\fP is only for \fIcsv\fP +or \fItsv\fP imports. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-fieldFile +As an alternative to \fI\%\-\-fields\fP, the \fI\%\-\-fieldFile\fP +option allows you to specify a file that holds a list of field names if +your \fIcsv\fP or \fItsv\fP file does not include field names in the +first line of the file (i.e. header). Place one field per line. +.sp +If you attempt to include \fI\%\-\-fieldFile\fP when importing JSON data, +\fBmongoimport\fP will return an error. \fI\%\-\-fieldFile\fP is only for \fIcsv\fP +or \fItsv\fP imports. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ignoreBlanks +Ignores empty fields in \fIcsv\fP and \fItsv\fP exports. If not +specified, \fBmongoimport\fP creates fields without values in +imported documents. +.sp +If you attempt to include \fI\%\-\-ignoreBlanks\fP when importing JSON data, +\fBmongoimport\fP will return an error. \fI\%\-\-ignoreBlanks\fP is only for \fIcsv\fP +or \fItsv\fP imports. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-type +Specifies the file type to import. The default format is \fIJSON\fP, +but it\(aqs possible to import \fIcsv\fP and \fItsv\fP files. +.sp +The \fBcsv\fP parser accepts that data that complies with RFC +\fI\%RFC 4180\fP\&. As a result, backslashes are \fInot\fP a valid escape +character. If you use double\-quotes to enclose fields in the CSV +data, you must escape internal double\-quote marks by prepending +another double\-quote. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-file +Specifies the location and name of a file containing the data to import. +If you do not specify a file, \fBmongoimport\fP reads data from +standard input (e.g. "stdin"). +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-drop +Modifies the import process so that the target instance drops +the collection before importing the data from the input. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-headerline +If using \fI\-\-type csv\fP or \fI\-\-type +tsv\fP, uses the first line as field names. +Otherwise, \fBmongoimport\fP will import the first line as a +distinct document. +.sp +If you attempt to include \fI\%\-\-headerline\fP when importing JSON data, +\fBmongoimport\fP will return an error. \fI\%\-\-headerline\fP is only for \fIcsv\fP +or \fItsv\fP imports. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-upsert +Modifies the import process to update existing objects in the +database if they match an imported object, while inserting all +other objects. +.sp +If you do not specify a field or fields using the +\fI\%\-\-upsertFields\fP \fBmongoimport\fP will upsert on the +basis of the \fB_id\fP field. +.INDENT 7.0 +.TP +.B \&..versionchanged:: 3.0.0 +\fI\%\-\-upsert\fP is no longer needed when specifying upserts. Use +\fI\%\-\-upsertFields\fP, which produces the same behavior. +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-upsertFields +Specifies a list of fields for the query portion of the +\fIupsert\fP\&. Use this option if the \fB_id\fP fields in the +existing documents don\(aqt match the field in the document, but +another field or field combination can uniquely identify +documents as a basis for performing upsert operations. +.INDENT 7.0 +.TP +.B \&..versionchanged:: 3.0.0 +Modifies the import process to update existing objects in the +database if they match based on the specified fields, while +inserting all other objects. +.sp +If you do not specify a field, \fI\%\-\-upsertFields\fP will upsert on the basis of +the \fB_id\fP field. +.UNINDENT +.sp +To ensure adequate performance, indexes should exist for this +field or fields. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-stopOnError +New in version 2.2. + +.sp +Forces \fBmongoimport\fP to halt the import operation at the +first error rather than continuing the operation despite errors. +.sp +Changed in version 3.0.0: \fI\%\-\-stopOnError\fP interrupts the import operation when \fBmongoimport\fP encounters +an insert or upsert error. Other error types will not stop +the import. + +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-jsonArray +Accepts the import of data expressed with multiple MongoDB documents +within a single \fIJSON\fP array. Limited to +imports of 16 MB or smaller. +.sp +Use \fI\%\-\-jsonArray\fP in conjunction with \fImongoexport \-\-jsonArray\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-maintainInsertionOrder +\fIDefault\fP: False +.sp +If specified, \fBmongoimport\fP inserts the documents in the order of +their appearance in the input source, otherwise \fBmongoimport\fP may +perform the insertions in an arbitrary order. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-writeConcern +\fIDefault\fP: majority +.sp +Specifies the \fIwrite concern\fP for each write operation that \fBmongoimport\fP +writes to the target database. +.sp +Specify the write concern as a document with \fIw options\fP\&. +.UNINDENT +.SH USE +.sp +In this example, \fBmongoimport\fP imports the \fIcsv\fP +formatted data in the \fB/opt/backups/contacts.csv\fP into the +collection \fBcontacts\fP in the \fBusers\fP database on the MongoDB +instance running on the localhost port numbered +\fB27017\fP\&. \fBmongoimport\fP determines the name of files using +the first line in the CSV file, because of the \fI\-\-headerline\fP: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoimport \-\-db users \-\-collection contacts \-\-type csv \-\-headerline \-\-file /opt/backups/contacts.csv +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Since \fBmongoimport\fP uses the input file name, without the +extension, as the collection name if \fB\-c\fP or \fB\-\-collection\fP is +unspecified. The following example is equivalent: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoimport \-\-db users \-\-type csv \-\-headerline \-\-file /opt/backups/contacts.csv +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +In the following example, \fBmongoimport\fP imports the data in +the \fIJSON\fP formatted file \fBcontacts.json\fP into the collection +\fBcontacts\fP on the MongoDB instance running on the localhost port +number 27017. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoimport \-\-db users \-\-collection contacts \-\-file contacts.json +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +In the next example, \fBmongoimport\fP imports data from the +file \fB/opt/backups/mdb1\-examplenet.json\fP into the collection +\fBcontacts\fP within the database \fBmarketing\fP on a remote MongoDB +database. This \fBmongoimport\fP accesses the \fBmongod\fP +instance running on the host \fBmongodb1.example.net\fP over port +\fB37017\fP, which requires the username \fBuser\fP and the password +\fBpass\fP\&. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongoimport \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password pass \-\-collection contacts \-\-db marketing \-\-file /opt/backups/mdb1\-examplenet.json +.ft P +.fi +.UNINDENT +.UNINDENT +.SH TYPE FIDELITY +.sp +\fBWARNING:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBmongoimport\fP and \fBmongoexport\fP do not reliably +preserve all rich \fIBSON\fP data types because \fIJSON\fP can +only represent a subset of the types supported by BSON. As a result, +data exported or imported with these tools may lose some measure of +fidelity. See the \fBExtended JSON\fP +reference for more information. +.UNINDENT +.UNINDENT +.sp +JSON can only represent a subset of the types supported by BSON. To +preserve type information, \fBmongoimport\fP accepts \fBstrict +mode representation\fP for certain +types. +.sp +For example, to preserve type information for BSON types +\fBdata_date\fP and \fBdata_numberlong\fP during +\fBmongoimport\fP, the data should be in strict mode +representation, as in the following: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +{ "_id" : 1, "volume" : { "$numberLong" : "2980000" }, "date" : { "$date" : "2014\-03\-13T13:47:42.483\-0400" } } +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +For the \fBdata_numberlong\fP type, \fBmongoimport\fP +converts into a float during the import. +.sp +See http://docs.mongodb.org/manual/reference/mongodb\-extended\-json for a complete list of +these types and the representations used. +.SH AUTHOR +MongoDB Documentation Project +.SH COPYRIGHT +2011-2015 +.\" Generated by docutils manpage writer. +. diff --git a/SOURCES/mongooplog.1 b/SOURCES/mongooplog.1 new file mode 100644 index 0000000..92077a2 --- /dev/null +++ b/SOURCES/mongooplog.1 @@ -0,0 +1,488 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOOPLOG" "1" "January 30, 2015" "3.0" "mongodb-manual" +.SH NAME +mongooplog \- MongoDB Oplog Utility +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.sp +New in version 2.2. + +.SH SYNOPSIS +.sp +\fBmongooplog\fP is a simple tool that polls operations from +the \fIreplication\fP \fIoplog\fP 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. +.sp +Typically this command will take the following form: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongooplog \-\-from mongodb0.example.net \-\-host mongodb1.example.net +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This command copies oplog entries from the \fBmongod\fP instance +running on the host \fBmongodb0.example.net\fP and duplicates +operations to the host \fBmongodb1.example.net\fP\&. If you do not need +to keep the \fI\-\-from\fP host running during +the migration, consider using \fBmongodump\fP and +\fBmongorestore\fP or another \fBbackup\fP operation, which may be better suited to +your operation. +.sp +\fBNOTE:\fP +.INDENT 0.0 +.INDENT 3.5 +If the \fBmongod\fP instance specified by the \fI\-\-from\fP +argument is running with \fBauthentication\fP, then +\fBmongooplog\fP will not be able to copy oplog entries. +.UNINDENT +.UNINDENT +.sp +\fBSEE ALSO:\fP +.INDENT 0.0 +.INDENT 3.5 +\fBmongodump\fP, \fBmongorestore\fP, +http://docs.mongodb.org/manual/core/backups, http://docs.mongodb.org/manual/core/replica\-set\-oplog\&. +.UNINDENT +.UNINDENT +.SH OPTIONS +.sp +Changed in version 3.0.0: \fBmongooplog\fP removed the \fB\-\-dbpath\fP as well as related +\fB\-\-directoryperdb\fP and \fB\-\-journal\fP options. You must use +\fBmongooplog\fP while connected to a \fBmongod\fP instance. + +.INDENT 0.0 +.TP +.B mongooplog +.UNINDENT +.INDENT 0.0 +.TP +.B mongooplog +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Returns information on the options and use of \fBmongooplog\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verbose, \-v +Increases the amount of internal reporting returned on standard output +or in log files. Increase the verbosity with the \fB\-v\fP form by +including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-quiet +Runs the \fBmongooplog\fP in a quiet mode that attempts to limit the amount +of output. +.sp +This option suppresses: +.INDENT 7.0 +.IP \(bu 2 +connection accepted events +.IP \(bu 2 +connection closed events +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Returns the \fBmongooplog\fP release number. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-host <:port>, \-h <:port> +Specifies a resolvable hostname for the \fBmongod\fP instance to +which \fBmongooplog\fP will apply \fIoplog\fP operations +retrieved from the server specified by the \fI\-\-from\fP option. +.sp +By default \fBmongooplog\fP attempts to connect to a MongoDB instance running +on the localhost on port number \fB27017\fP\&. +.sp +To connect to a replica set, specify the \fBreplica set name\fP and a seed list of set members. Use the +following form: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +/<:port>,<:port>,<...> +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +You can always connect directly to a single MongoDB instance by +specifying the host and port number directly. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-port +Specifies the port number of the \fBmongod\fP instance where +\fBmongooplog\fP will apply \fIoplog\fP entries. Specify +this option only if the MongoDB instance to connect to is not +running on the standard port of \fB27017\fP\&. You may also specify a +port number using the \fI\-\-host\fP command. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ipv6 +Enables IPv6 support and allows the \fBmongooplog\fP to connect to the +MongoDB instance using an IPv6 network. All MongoDB programs and +processes disable IPv6 support by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ssl +New in version 2.6. + +.sp +Enables connection to a \fBmongod\fP or \fBmongos\fP that has +SSL support enabled. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCAFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the root certificate chain +from the Certificate Authority. Specify the file name of the +\fB\&.pem\fP file using relative or absolute paths. +.sp +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\&. +.sp +\fBWARNING:\fP +.INDENT 7.0 +.INDENT 3.5 +If the \fBmongo\fP shell or any other tool that connects to +\fBmongos\fP or \fBmongod\fP is run without +\fI\-\-sslCAFile\fP, it will not attempt to validate +server certificates. This results in vulnerability to expired +\fBmongod\fP and \fBmongos\fP certificates as well as to foreign +processes posing as valid \fBmongod\fP or \fBmongos\fP +instances. Ensure that you \fIalways\fP specify the CA file against which +server certificates should be validated in cases where intrusion is a +possibility. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains both the SSL certificate +and key. Specify the file name of the \fB\&.pem\fP file using relative +or absolute paths. +.sp +This option is required when using the \fI\-\-ssl\fP option to connect +to a \fBmongod\fP or \fBmongos\fP that has +\fBCAFile\fP enabled \fIwithout\fP +\fBallowConnectionsWithoutCertificates\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyPassword +New in version 2.6. + +.sp +Specifies the password to de\-crypt the certificate\-key file (i.e. +\fI\-\-sslPEMKeyFile\fP). Use the \fI\-\-sslPEMKeyPassword\fP option only if the +certificate\-key file is encrypted. In all cases, the \fBmongooplog\fP will +redact the password from all logging and reporting output. +.sp +If the private key in the PEM file is encrypted and you do not specify +the \fI\-\-sslPEMKeyPassword\fP option, the \fBmongooplog\fP will prompt for a passphrase. See +\fIssl\-certificate\-password\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCRLFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the Certificate Revocation +List. Specify the file name of the \fB\&.pem\fP file using relative or +absolute paths. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidCertificates +New in version 2.6. + +.sp +Bypasses the validation checks for server certificates and allows +the use of invalid certificates. When using the +\fBallowInvalidCertificates\fP setting, MongoDB logs as a +warning the use of the invalid certificate. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidHostnames +New in version 3.0. + +.sp +Disables the validation of the hostnames in SSL certificates. Allows +\fBmongooplog\fP to connect to MongoDB instances if the hostname their +certificates do not match the specified hostname. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslFIPSMode +New in version 2.6. + +.sp +Directs the \fBmongooplog\fP to use the FIPS mode of the installed OpenSSL +library. Your system must have a FIPS compliant OpenSSL library to use +the \fI\-\-sslFIPSMode\fP option. +.sp +\fBNOTE:\fP +.INDENT 7.0 +.INDENT 3.5 +FIPS Compatible SSL is +available only in \fI\%MongoDB Enterprise\fP\&. See +http://docs.mongodb.org/manual/tutorial/configure\-fips for more information. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-username , \-u +Specifies a username with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-password\fP and +\fB\-\-authenticationDatabase\fP options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-password , \-p +Specifies a password with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-username\fP and +\fB\-\-authenticationDatabase\fP options. +.sp +If you do not specify an argument for \fI\-\-password\fP, \fBmongooplog\fP will +prompt interactively for a password on the console. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationDatabase +New in version 2.4. + +.sp +Specifies the database that holds the user\(aqs credentials. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationMechanism +\fIDefault\fP: MONGODB\-CR +.sp +New in version 2.4. + +.sp +Changed in version 2.6: Added support for the \fBPLAIN\fP and \fBMONGODB\-X509\fP authentication +mechanisms. + +.sp +Specifies the authentication mechanism the \fBmongooplog\fP instance uses to +authenticate to the \fBmongod\fP or \fBmongos\fP\&. +.TS +center; +|l|l|. +_ +T{ +Value +T} T{ +Description +T} +_ +T{ +MONGODB\-CR +T} T{ +MongoDB challenge/response authentication. +T} +_ +T{ +MONGODB\-X509 +T} T{ +MongoDB SSL certificate authentication. +T} +_ +T{ +PLAIN +T} T{ +External authentication using LDAP. You can also use \fBPLAIN\fP +for authenticating in\-database users. \fBPLAIN\fP transmits +passwords in plain text. This mechanism is available only in +\fI\%MongoDB Enterprise\fP\&. +T} +_ +T{ +GSSAPI +T} T{ +External authentication using Kerberos. This mechanism is +available only in \fI\%MongoDB Enterprise\fP\&. +T} +_ +.TE +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiServiceName +New in version 2.6. + +.sp +Specify the name of the service using \fBGSSAPI/Kerberos\fP\&. Only required if the service does not use the +default name of \fBmongodb\fP\&. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiHostName +New in version 2.6. + +.sp +Specify the hostname of a service using \fBGSSAPI/Kerberos\fP\&. \fIOnly\fP required if the hostname of a machine does +not match the hostname resolved by DNS. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-db , \-d +Specifies the name of the database on which to run the \fBmongooplog\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-collection , \-c +Specifies the collection to export. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-seconds , \-s +Specify a number of seconds of operations for \fBmongooplog\fP to +pull from the \fIremote host\fP\&. Unless +specified the default value is \fB86400\fP seconds, or 24 hours. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-from +Specify the host for \fBmongooplog\fP to retrieve \fIoplog\fP +operations from. \fBmongooplog\fP \fIrequires\fP this option. +.sp +Unless you specify the \fI\-\-host\fP option, +\fBmongooplog\fP will apply the operations collected with this +option to the oplog of the \fBmongod\fP instance running on the +localhost interface connected to port \fB27017\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-oplogns +Specify a namespace in the \fI\-\-from\fP host +where the oplog resides. The default value is \fBlocal.oplog.rs\fP, which +is the where \fIreplica set\fP members store their operation log. +However, if you\(aqve copied \fIoplog\fP entries into another +database or collection or are pulling oplog entries from a +\fBmaster\-slave\fP deployment, use \fI\%\-\-oplogns\fP to +apply oplog entries stored in another location. Namespaces take the +form of \fB[database].[collection]\fP\&. +.UNINDENT +.SH USE +.sp +Consider the following prototype \fBmongooplog\fP command: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongooplog \-\-from mongodb0.example.net \-\-host mongodb1.example.net +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Here, entries from the \fIoplog\fP of the \fBmongod\fP running +on port \fB27017\fP\&. This only pull entries from the last 24 hours. +.sp +Use the \fI\-\-seconds\fP argument to capture +a greater or smaller amount of time. Consider the following example: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongooplog \-\-from mongodb0.example.net \-\-seconds 172800 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +In this operation, \fBmongooplog\fP captures 2 full days of +operations. To migrate 12 hours of \fIoplog\fP entries, use the +following form: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongooplog \-\-from mongodb0.example.net \-\-seconds 43200 +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB Documentation Project +.SH COPYRIGHT +2011-2015 +.\" Generated by docutils manpage writer. +. diff --git a/SOURCES/mongorestore.1 b/SOURCES/mongorestore.1 new file mode 100644 index 0000000..7d891f1 --- /dev/null +++ b/SOURCES/mongorestore.1 @@ -0,0 +1,644 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGORESTORE" "1" "January 30, 2015" "3.0" "mongodb-manual" +.SH NAME +mongorestore \- MongoDB Data Restoration Tool +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.sp +The \fBmongorestore\fP program writes data from a binary database +dump created by \fBmongodump\fP to a MongoDB +instance. \fBmongorestore\fP can create a new database or add +data to an existing database. +.sp +\fBmongorestore\fP can write data to either \fImongod\fP or \fBmongos\fP +instances, in addition to writing directly to MongoDB data files +without an active \fBmongod\fP\&. +.SH BEHAVIOR +.sp +If you restore to an existing database, \fBmongorestore\fP will +only insert into the existing database, and does not perform updates +of any kind. If existing documents have the same value \fB_id\fP field +in the target database and collection, +\fBmongorestore\fP will \fInot\fP overwrite those documents. +.sp +Remember the following properties of \fBmongorestore\fP behavior: +.INDENT 0.0 +.IP \(bu 2 +\fBmongorestore\fP recreates indexes recorded by +\fBmongodump\fP\&. +.IP \(bu 2 +all operations are inserts, not updates. +.IP \(bu 2 +\fBmongorestore\fP does not wait for a response from a +\fBmongod\fP to ensure that the MongoDB process has received or +recorded the operation. +.sp +The \fBmongod\fP will record any errors to its log that occur +during a restore operation, but \fBmongorestore\fP will not +receive errors. +.UNINDENT +.sp +The data format used by \fBmongodump\fP from version 2.2 or +later is \fIincompatible\fP with earlier versions of \fBmongod\fP\&. +Do not use recent versions of \fBmongodump\fP to back up older +data stores. +.sp +New in version 3.0.0: \fBmongorestore\fP also accepts input via standard input. + +.SH REQUIRED ACCESS TO RESTORE USER DATA +.sp +Changed in version 2.6. + +.sp +To restore users and \fIuser\-defined roles\fP on a +given database, you must have access to the \fBadmin\fP database. MongoDB +stores the user data and role definitions for all databases in the +\fBadmin\fP database. +.sp +Specifically, to restore users to a given database, you must have the +\fBinsert\fP \fIaction\fP on the \fBadmin\fP +database\(aqs \fBadmin.system.users\fP collection. The \fBrestore\fP +role provides this privilege. +.sp +To restore user\-defined roles to a database, you must have the +\fBinsert\fP action on the \fBadmin\fP database\(aqs +\fBadmin.system.roles\fP collection. The \fBrestore\fP role +provides this privilege. +.SH OPTIONS +.INDENT 0.0 +.TP +.B mongorestore +.UNINDENT +.INDENT 0.0 +.TP +.B mongorestore +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Returns information on the options and use of \fBmongorestore\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verbose, \-v +Increases the amount of internal reporting returned on standard output +or in log files. Increase the verbosity with the \fB\-v\fP form by +including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-quiet +Runs the \fBmongorestore\fP in a quiet mode that attempts to limit the amount +of output. +.sp +This option suppresses: +.INDENT 7.0 +.IP \(bu 2 +output from \fIdatabase commands\fP +.IP \(bu 2 +replication activity +.IP \(bu 2 +connection accepted events +.IP \(bu 2 +connection closed events +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Returns the \fBmongorestore\fP release number. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-host <:port>, \-h <:port> +\fIDefault\fP: localhost:27017 +.sp +Specifies a resolvable hostname for the \fBmongod\fP to which to +connect. By default, the \fBmongorestore\fP attempts to connect to a MongoDB +instance running on the localhost on port number \fB27017\fP\&. +.sp +To connect to a replica set, specify the +\fBreplSetName\fP and a seed list of set members, as in +the following: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +/<:port>,<:port>,<...> +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +You can always connect directly to a single MongoDB instance by +specifying the host and port number directly. +.sp +Changed in version 3.0.0: If you use IPv6 and use the \fB
:\fP format, you must +enclose the portion of an address and port combination in +brackets (e.g. \fB[
]\fP). + +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-port +\fIDefault\fP: 27017 +.sp +Specifies the TCP port on which the MongoDB instance listens for +client connections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ipv6 +Enables IPv6 support and allows the \fBmongorestore\fP to connect to the +MongoDB instance using an IPv6 network. All MongoDB programs and +processes disable IPv6 support by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ssl +New in version 2.6. + +.sp +Enables connection to a \fBmongod\fP or \fBmongos\fP that has +SSL support enabled. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCAFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the root certificate chain +from the Certificate Authority. Specify the file name of the +\fB\&.pem\fP file using relative or absolute paths. +.sp +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\&. +.sp +\fBWARNING:\fP +.INDENT 7.0 +.INDENT 3.5 +If the \fBmongo\fP shell or any other tool that connects to +\fBmongos\fP or \fBmongod\fP is run without +\fI\-\-sslCAFile\fP, it will not attempt to validate +server certificates. This results in vulnerability to expired +\fBmongod\fP and \fBmongos\fP certificates as well as to foreign +processes posing as valid \fBmongod\fP or \fBmongos\fP +instances. Ensure that you \fIalways\fP specify the CA file against which +server certificates should be validated in cases where intrusion is a +possibility. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains both the SSL certificate +and key. Specify the file name of the \fB\&.pem\fP file using relative +or absolute paths. +.sp +This option is required when using the \fI\-\-ssl\fP option to connect +to a \fBmongod\fP or \fBmongos\fP that has +\fBCAFile\fP enabled \fIwithout\fP +\fBallowConnectionsWithoutCertificates\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyPassword +New in version 2.6. + +.sp +Specifies the password to de\-crypt the certificate\-key file (i.e. +\fI\-\-sslPEMKeyFile\fP). Use the \fI\-\-sslPEMKeyPassword\fP option only if the +certificate\-key file is encrypted. In all cases, the \fBmongorestore\fP will +redact the password from all logging and reporting output. +.sp +If the private key in the PEM file is encrypted and you do not specify +the \fI\-\-sslPEMKeyPassword\fP option, the \fBmongorestore\fP will prompt for a passphrase. See +\fIssl\-certificate\-password\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCRLFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the Certificate Revocation +List. Specify the file name of the \fB\&.pem\fP file using relative or +absolute paths. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidCertificates +New in version 2.6. + +.sp +Bypasses the validation checks for server certificates and allows +the use of invalid certificates. When using the +\fBallowInvalidCertificates\fP setting, MongoDB logs as a +warning the use of the invalid certificate. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidHostnames +New in version 3.0. + +.sp +Disables the validation of the hostnames in SSL certificates. Allows +\fBmongorestore\fP to connect to MongoDB instances if the hostname their +certificates do not match the specified hostname. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslFIPSMode +New in version 2.6. + +.sp +Directs the \fBmongorestore\fP to use the FIPS mode of the installed OpenSSL +library. Your system must have a FIPS compliant OpenSSL library to use +the \fI\-\-sslFIPSMode\fP option. +.sp +\fBNOTE:\fP +.INDENT 7.0 +.INDENT 3.5 +FIPS Compatible SSL is +available only in \fI\%MongoDB Enterprise\fP\&. See +http://docs.mongodb.org/manual/tutorial/configure\-fips for more information. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-username , \-u +Specifies a username with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-password\fP and +\fB\-\-authenticationDatabase\fP options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-password , \-p +Specifies a password with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-username\fP and +\fB\-\-authenticationDatabase\fP options. +.sp +If you do not specify an argument for \fI\-\-password\fP, \fBmongorestore\fP will +prompt interactively for a password on the console. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationDatabase +New in version 2.4. + +.sp +Specifies the database that holds the user\(aqs credentials. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationMechanism +\fIDefault\fP: MONGODB\-CR +.sp +New in version 2.4. + +.sp +Changed in version 2.6: Added support for the \fBPLAIN\fP and \fBMONGODB\-X509\fP authentication +mechanisms. + +.sp +Specifies the authentication mechanism the \fBmongorestore\fP instance uses to +authenticate to the \fBmongod\fP or \fBmongos\fP\&. +.TS +center; +|l|l|. +_ +T{ +Value +T} T{ +Description +T} +_ +T{ +MONGODB\-CR +T} T{ +MongoDB challenge/response authentication. +T} +_ +T{ +MONGODB\-X509 +T} T{ +MongoDB SSL certificate authentication. +T} +_ +T{ +PLAIN +T} T{ +External authentication using LDAP. You can also use \fBPLAIN\fP +for authenticating in\-database users. \fBPLAIN\fP transmits +passwords in plain text. This mechanism is available only in +\fI\%MongoDB Enterprise\fP\&. +T} +_ +T{ +GSSAPI +T} T{ +External authentication using Kerberos. This mechanism is +available only in \fI\%MongoDB Enterprise\fP\&. +T} +_ +.TE +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiServiceName +New in version 2.6. + +.sp +Specify the name of the service using \fBGSSAPI/Kerberos\fP\&. Only required if the service does not use the +default name of \fBmongodb\fP\&. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiHostName +New in version 2.6. + +.sp +Specify the hostname of a service using \fBGSSAPI/Kerberos\fP\&. \fIOnly\fP required if the hostname of a machine does +not match the hostname resolved by DNS. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-db , \-d +Specifies a database for \fBmongorestore\fP to restore data \fIinto\fP\&. +If the database does not exist, \fBmongorestore\fP creates the +database. If you do not specify a \fB\fP, \fBmongorestore\fP +creates new databases that correspond to the databases where data +originated and data may be overwritten. Use this option to restore data +into a MongoDB instance that already has data. +.sp +\fI\%\-\-db\fP does \fInot\fP control which \fIBSON\fP files +\fBmongorestore\fP restores. You must use the +\fBmongorestore\fP \fI\%path option\fP to +limit that restored data. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-collection , \-c +Specifies a single collection for \fBmongorestore\fP to restore. If +you do not specify \fI\%\-\-collection\fP, \fBmongorestore\fP takes +the collection name from the input filename. If the input file has an +extension, MongoDB omits the extension of the file from the collection +name. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-objcheck +Forces \fBmongorestore\fP to validate all requests from clients +upon receipt to ensure that clients never insert invalid documents into +the database. For objects with a high degree of sub\-document nesting, +\fI\-\-objcheck\fP can have a small impact on performance. You can set +\fI\%\-\-noobjcheck\fP to disable object checking at run\-time. +.sp +Changed in version 2.4: MongoDB enables \fI\-\-objcheck\fP by default, to prevent any +client from inserting malformed or invalid BSON into a MongoDB +database. + +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-noobjcheck +New in version 2.4. + +.sp +Disables the default document validation that MongoDB performs on all +incoming BSON documents. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-drop +Modifies the restoration procedure to drop every collection from the +target database before restoring the collection from the dumped backup. +.sp +With \fI\%\-\-drop\fP specified, \fBmongorestore\fP removes all user +credentials and replaces them with users defined in the dump +file. Therefore, in systems with \fBauthorization\fP +enabled, \fBmongorestore\fP must be able to authenticate to an existing +user \fIand\fP to a user defined in the dump file. If \fBmongorestore\fP can\(aqt +authenticate to a user defined in the dump file, the restoration +process will fail, leaving an empty database. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-oplogReplay +Replays the \fIoplog\fP after restoring the dump to ensure that the +current state of the database reflects the point\-in\-time backup captured +with the "\fImongodump \-\-oplog\fP" command. For an example of +\fI\%\-\-oplogReplay\fP, see \fIbackup\-restore\-oplogreplay\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-oplogLimit +New in version 2.2. + +.sp +Prevents \fBmongorestore\fP from applying \fIoplog\fP entries +with timestamp newer than or equal to \fB\fP\&. Specify +\fB\fP values in the form of \fB:\fP, where +\fB\fP is the seconds since the UNIX epoch, and \fB\fP +represents a counter of operations in the oplog that occurred in the +specified second. +.sp +You must use \fI\%\-\-oplogLimit\fP in conjunction with the +\fI\%\-\-oplogReplay\fP option. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-keepIndexVersion +Prevents \fBmongorestore\fP from upgrading the index to the latest +version during the restoration process. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-noIndexRestore +New in version 2.2. + +.sp +Prevents \fBmongorestore\fP from restoring and building indexes as +specified in the corresponding \fBmongodump\fP output. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-noOptionsRestore +New in version 2.2. + +.sp +Prevents \fBmongorestore\fP from setting the collection options, +such as those specified by the \fBcollMod\fP \fIdatabase +command\fP, on restored collections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-restoreDbUsersAndRoles +Restore user and role definitions for the given database. See +http://docs.mongodb.org/manual/reference/system\-roles\-collection and +http://docs.mongodb.org/manual/reference/system\-users\-collection for more information. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-w +New in version 2.2. + +.sp +Specifies the \fIwrite concern\fP for each write operation that +\fBmongorestore\fP writes to the target database. By default, +\fBmongorestore\fP does not wait for a response for \fIwrite +acknowledgment\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-writeConcern +\fIDefault\fP: majority +.sp +Specifies the \fIwrite concern\fP for each write operation that \fBmongorestore\fP +writes to the target database. +.sp +Specify the write concern as a document with \fIw options\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-maintainInsertionOrder +\fIDefault\fP: False +.sp +If specified, \fBmongorestore\fP inserts the documents in the order of +their appearance in the input source, otherwise \fBmongorestore\fP may +perform the insertions in an arbitrary order. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-numParallelCollections int, \-j int +\fIDefault\fP: 4 +.sp +Number of collections \fBmongorestore\fP should restore +in parallel. +.UNINDENT +.INDENT 0.0 +.TP +.B +The final argument of the \fBmongorestore\fP command is a +directory path. This argument specifies the location of the +database dump from which to restore. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-dir string +Specifies the dump directory. +.UNINDENT +.SH USE +.sp +See http://docs.mongodb.org/manual/tutorial/backup\-with\-mongodump +for a larger overview of \fBmongorestore\fP +usage. Also see the \fBmongodump\fP document for an overview of the +\fBmongodump\fP, which provides the related inverse +functionality. +.sp +Consider the following example: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongorestore \-\-collection people \-\-db accounts dump/accounts/people.bson +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Here, \fBmongorestore\fP reads the database dump in the \fBdump/\fP +sub\-directory of the current directory, and restores \fIonly\fP the +documents in the collection named \fBpeople\fP from the database named +\fBaccounts\fP\&. \fBmongorestore\fP restores data to the instance +running on the localhost interface on port \fB27017\fP\&. +.sp +In the final example, \fBmongorestore\fP restores a database +dump located at \fB/opt/backup/mongodump\-2011\-10\-24\fP, to a database +running on port \fB37017\fP on the host +\fBmongodb1.example.net\fP\&. The \fBmongorestore\fP command authenticates to +the MongoDB instance using the username \fBuser\fP and the +password \fBpass\fP, as follows: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongorestore \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password pass /opt/backup/mongodump\-2011\-10\-24 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +You can also \fIpipe\fP data directly into to \fBmongorestore\fP +through standard input, as in the following example: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +zcat /opt/backup/mongodump\-2014\-12\-03/accounts.people.bson.gz | mongorestore \-\-collection people \-\-db accounts +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB Documentation Project +.SH COPYRIGHT +2011-2015 +.\" Generated by docutils manpage writer. +. diff --git a/SOURCES/mongostat.1 b/SOURCES/mongostat.1 new file mode 100644 index 0000000..8a8a362 --- /dev/null +++ b/SOURCES/mongostat.1 @@ -0,0 +1,736 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOSTAT" "1" "January 30, 2015" "3.0" "mongodb-manual" +.SH NAME +mongostat \- MongoDB Use Statistics +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.sp +The \fBmongostat\fP utility provides a quick overview of the +status of a currently running \fBmongod\fP +or \fBmongos\fP +instance. \fBmongostat\fP is functionally similar to the +UNIX/Linux file system utility \fBvmstat\fP, but provides data regarding +\fBmongod\fP and \fBmongos\fP instances. +.sp +\fBSEE ALSO:\fP +.INDENT 0.0 +.INDENT 3.5 +For more information about monitoring MongoDB, see +http://docs.mongodb.org/manual/administration/monitoring\&. +.sp +For more background on various other MongoDB status outputs see: +.INDENT 0.0 +.IP \(bu 2 +http://docs.mongodb.org/manual/reference/command/serverStatus +.IP \(bu 2 +http://docs.mongodb.org/manual/reference/command/replSetGetStatus +.IP \(bu 2 +http://docs.mongodb.org/manual/reference/command/dbStats +.IP \(bu 2 +http://docs.mongodb.org/manual/reference/command/collStats +.UNINDENT +.sp +For an additional utility that provides MongoDB metrics see +\fBmongotop\fP\&. +.UNINDENT +.UNINDENT +.SH ACCESS CONTROL REQUIREMENTS +.sp +In order to connect to a \fBmongod\fP that enforces authorization +with the \fI\-\-auth\fP option, specify the +\fI\-\-username\fP and \fI\-\-password\fP options, and the user specified must have the +\fBserverStatus\fP privilege action on the cluster resources. +.sp +The built\-in role \fBclusterMonitor\fP provides this privilege as +well as other privileges. To create a role with just the privilege to +run \fBmongostat\fP, see \fIcreate\-role\-for\-mongostat\fP\&. +.SH OPTIONS +.INDENT 0.0 +.TP +.B mongostat +.UNINDENT +.INDENT 0.0 +.TP +.B mongostat +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Returns information on the options and use of \fBmongostat\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verbose, \-v +Increases the amount of internal reporting returned on standard output +or in log files. Increase the verbosity with the \fB\-v\fP form by +including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Returns the \fBmongostat\fP release number. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-host <:port>, \-h <:port> +\fIDefault\fP: localhost:27017 +.sp +Specifies a resolvable hostname for the \fBmongod\fP to which to +connect. By default, the \fBmongostat\fP attempts to connect to a MongoDB +instance running on the localhost on port number \fB27017\fP\&. +.sp +To connect to a replica set, specify the +\fBreplSetName\fP and a seed list of set members, as in +the following: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +/<:port>,<:port>,<...> +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +You can always connect directly to a single MongoDB instance by +specifying the host and port number directly. +.sp +Changed in version 3.0.0: If you use IPv6 and use the \fB
:\fP format, you must +enclose the portion of an address and port combination in +brackets (e.g. \fB[
]\fP). + +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-port +\fIDefault\fP: 27017 +.sp +Specifies the TCP port on which the MongoDB instance listens for +client connections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ipv6 +Enables IPv6 support and allows the \fBmongostat\fP to connect to the +MongoDB instance using an IPv6 network. All MongoDB programs and +processes disable IPv6 support by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ssl +New in version 2.6. + +.sp +Enables connection to a \fBmongod\fP or \fBmongos\fP that has +SSL support enabled. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCAFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the root certificate chain +from the Certificate Authority. Specify the file name of the +\fB\&.pem\fP file using relative or absolute paths. +.sp +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\&. +.sp +\fBWARNING:\fP +.INDENT 7.0 +.INDENT 3.5 +If the \fBmongo\fP shell or any other tool that connects to +\fBmongos\fP or \fBmongod\fP is run without +\fI\-\-sslCAFile\fP, it will not attempt to validate +server certificates. This results in vulnerability to expired +\fBmongod\fP and \fBmongos\fP certificates as well as to foreign +processes posing as valid \fBmongod\fP or \fBmongos\fP +instances. Ensure that you \fIalways\fP specify the CA file against which +server certificates should be validated in cases where intrusion is a +possibility. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains both the SSL certificate +and key. Specify the file name of the \fB\&.pem\fP file using relative +or absolute paths. +.sp +This option is required when using the \fI\-\-ssl\fP option to connect +to a \fBmongod\fP or \fBmongos\fP that has +\fBCAFile\fP enabled \fIwithout\fP +\fBallowConnectionsWithoutCertificates\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyPassword +New in version 2.6. + +.sp +Specifies the password to de\-crypt the certificate\-key file (i.e. +\fI\-\-sslPEMKeyFile\fP). Use the \fI\-\-sslPEMKeyPassword\fP option only if the +certificate\-key file is encrypted. In all cases, the \fBmongostat\fP will +redact the password from all logging and reporting output. +.sp +If the private key in the PEM file is encrypted and you do not specify +the \fI\-\-sslPEMKeyPassword\fP option, the \fBmongostat\fP will prompt for a passphrase. See +\fIssl\-certificate\-password\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCRLFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the Certificate Revocation +List. Specify the file name of the \fB\&.pem\fP file using relative or +absolute paths. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidCertificates +New in version 2.6. + +.sp +Bypasses the validation checks for server certificates and allows +the use of invalid certificates. When using the +\fBallowInvalidCertificates\fP setting, MongoDB logs as a +warning the use of the invalid certificate. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidHostnames +New in version 3.0. + +.sp +Disables the validation of the hostnames in SSL certificates. Allows +\fBmongostat\fP to connect to MongoDB instances if the hostname their +certificates do not match the specified hostname. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslFIPSMode +New in version 2.6. + +.sp +Directs the \fBmongostat\fP to use the FIPS mode of the installed OpenSSL +library. Your system must have a FIPS compliant OpenSSL library to use +the \fI\-\-sslFIPSMode\fP option. +.sp +\fBNOTE:\fP +.INDENT 7.0 +.INDENT 3.5 +FIPS Compatible SSL is +available only in \fI\%MongoDB Enterprise\fP\&. See +http://docs.mongodb.org/manual/tutorial/configure\-fips for more information. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-username , \-u +Specifies a username with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-password\fP and +\fB\-\-authenticationDatabase\fP options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-password , \-p +Specifies a password with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-username\fP and +\fB\-\-authenticationDatabase\fP options. +.sp +If you do not specify an argument for \fI\-\-password\fP, \fBmongostat\fP will +prompt interactively for a password on the console. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationDatabase +New in version 2.4. + +.sp +Specifies the database that holds the user\(aqs credentials. +.sp +\fI\-\-authenticationDatabase\fP is required for \fBmongod\fP +and \fBmongos\fP instances that use \fIauthentication\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationMechanism +\fIDefault\fP: MONGODB\-CR +.sp +New in version 2.4. + +.sp +Changed in version 2.6: Added support for the \fBPLAIN\fP and \fBMONGODB\-X509\fP authentication +mechanisms. + +.sp +Specifies the authentication mechanism the \fBmongostat\fP instance uses to +authenticate to the \fBmongod\fP or \fBmongos\fP\&. +.TS +center; +|l|l|. +_ +T{ +Value +T} T{ +Description +T} +_ +T{ +MONGODB\-CR +T} T{ +MongoDB challenge/response authentication. +T} +_ +T{ +MONGODB\-X509 +T} T{ +MongoDB SSL certificate authentication. +T} +_ +T{ +PLAIN +T} T{ +External authentication using LDAP. You can also use \fBPLAIN\fP +for authenticating in\-database users. \fBPLAIN\fP transmits +passwords in plain text. This mechanism is available only in +\fI\%MongoDB Enterprise\fP\&. +T} +_ +T{ +GSSAPI +T} T{ +External authentication using Kerberos. This mechanism is +available only in \fI\%MongoDB Enterprise\fP\&. +T} +_ +.TE +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiServiceName +New in version 2.6. + +.sp +Specify the name of the service using \fBGSSAPI/Kerberos\fP\&. Only required if the service does not use the +default name of \fBmongodb\fP\&. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiHostName +New in version 2.6. + +.sp +Specify the hostname of a service using \fBGSSAPI/Kerberos\fP\&. \fIOnly\fP required if the hostname of a machine does +not match the hostname resolved by DNS. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-noheaders +Disables the output of column or field names. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-rowcount , \-n +Controls the number of rows to output. Use in conjunction with +the \fBsleeptime\fP argument to control the duration of a +\fBmongostat\fP operation. +.sp +Unless \fI\-\-rowcount\fP is specified, \fBmongostat\fP +will return an infinite number of rows (e.g. value of \fB0\fP\&.) +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-http +Configures \fBmongostat\fP to collect data using the HTTP interface +rather than a raw database connection. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-discover +Discovers and reports on statistics from all members of a \fIreplica +set\fP or \fIsharded cluster\fP\&. When connected to any member of a +replica set, \fI\%\-\-discover\fP all non\-\fIhidden members\fP of the replica set. When connected to a \fBmongos\fP, +\fBmongostat\fP will return data from all \fIshards\fP in +the cluster. If a replica set provides a shard in the sharded cluster, +\fBmongostat\fP will report on non\-hidden members of that replica +set. +.sp +The \fImongostat \-\-host\fP option is not required but +potentially useful in this case. +.sp +Changed in version 2.6: When running with \fI\%\-\-discover\fP, \fBmongostat\fP now +respects :option:\-\-rowcount\(ga. + +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-all +Configures \fBmongostat\fP to return all optional \fI\%fields\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-json +New in version 3.0.0. + +.sp +Returns output for \fBmongostat\fP in \fIJSON\fP format. +.UNINDENT +.INDENT 0.0 +.TP +.B +The final argument is the length of time, in seconds, that +\fBmongostat\fP waits in between calls. By default \fBmongostat\fP +returns one call every second. +.sp +\fBmongostat\fP returns values that reflect the operations +over a 1 second period. For values of \fB\fP greater +than 1, \fBmongostat\fP averages data to reflect average +operations per second. +.UNINDENT +.SH FIELDS +.sp +\fBmongostat\fP returns values that reflect the operations over a +1 second period. When \fBmongostat \fP has a value +greater than 1, \fBmongostat\fP averages the statistics to reflect +average operations per second. +.sp +\fBmongostat\fP outputs the following fields: +.INDENT 0.0 +.TP +.B inserts +The number of objects inserted into the database per second. If +followed by an asterisk (e.g. \fB*\fP), the datum refers to a +replicated operation. +.UNINDENT +.INDENT 0.0 +.TP +.B query +The number of query operations per second. +.UNINDENT +.INDENT 0.0 +.TP +.B update +The number of update operations per second. +.UNINDENT +.INDENT 0.0 +.TP +.B delete +The number of delete operations per second. +.UNINDENT +.INDENT 0.0 +.TP +.B getmore +The number of get more (i.e. cursor batch) operations per second. +.UNINDENT +.INDENT 0.0 +.TP +.B command +The number of commands per second. On \fIslave\fP and +\fIsecondary\fP systems, \fBmongostat\fP presents two values +separated by a pipe character (e.g. \fB|\fP), in the form of +\fBlocal|replicated\fP commands. +.UNINDENT +.INDENT 0.0 +.TP +.B flushes +The number of \fIfsync\fP operations per second. +.UNINDENT +.INDENT 0.0 +.TP +.B mapped +The total amount of data mapped in megabytes. This is the total +data size at the time of the last \fBmongostat\fP call. +.UNINDENT +.INDENT 0.0 +.TP +.B size +The amount of virtual memory in megabytes used by the process at +the time of the last \fBmongostat\fP call. +.UNINDENT +.INDENT 0.0 +.TP +.B non\-mapped +The total amount of virtual memory excluding all mapped memory at +the time of the last \fBmongostat\fP call. +.UNINDENT +.INDENT 0.0 +.TP +.B res +The amount of resident memory in megabytes used by the process at +the time of the last \fBmongostat\fP call. +.UNINDENT +.INDENT 0.0 +.TP +.B faults +Changed in version 2.1. + +.sp +The number of page faults per second. +.sp +Before version 2.1 this value was only provided for MongoDB +instances running on Linux hosts. +.UNINDENT +.INDENT 0.0 +.TP +.B locked +The percent of time in a global write lock. +.sp +Changed in version 2.2: The \fBlocked db\fP field replaces the \fBlocked %\fP field to +more appropriate data regarding the database specific locks in +version 2.2. + +.UNINDENT +.INDENT 0.0 +.TP +.B locked db +New in version 2.2. + +.sp +The percent of time in the per\-database context\-specific +lock. \fBmongostat\fP will report the database that has spent +the most time since the last \fBmongostat\fP call with a write +lock. +.sp +This value represents the amount of time that the listed database +spent in a locked state \fIcombined\fP with the time that the +\fBmongod\fP spent in the global lock. Because of this, and +the sampling method, you may see some values greater than 100%. +.UNINDENT +.INDENT 0.0 +.TP +.B idx miss +The percent of index access attempts that required a page fault +to load a btree node. This is a sampled value. +.UNINDENT +.INDENT 0.0 +.TP +.B qr +The length of the queue of clients waiting to read data from the +MongoDB instance. +.UNINDENT +.INDENT 0.0 +.TP +.B qw +The length of the queue of clients waiting to write data from the +MongoDB instance. +.UNINDENT +.INDENT 0.0 +.TP +.B ar +The number of active clients performing read operations. +.UNINDENT +.INDENT 0.0 +.TP +.B aw +The number of active clients performing write operations. +.UNINDENT +.INDENT 0.0 +.TP +.B netIn +The amount of network traffic, in \fIbytes\fP, received by the MongoDB instance. +.sp +This includes traffic from \fBmongostat\fP itself. +.UNINDENT +.INDENT 0.0 +.TP +.B netOut +The amount of network traffic, in \fIbytes\fP, sent by the MongoDB instance. +.sp +This includes traffic from \fBmongostat\fP itself. +.UNINDENT +.INDENT 0.0 +.TP +.B conn +The total number of open connections. +.UNINDENT +.INDENT 0.0 +.TP +.B set +The name, if applicable, of the replica set. +.UNINDENT +.INDENT 0.0 +.TP +.B repl +The replication status of the member. +.TS +center; +|l|l|. +_ +T{ +\fBValue\fP +T} T{ +\fBReplication Type\fP +T} +_ +T{ +M +T} T{ +\fImaster\fP +T} +_ +T{ +SEC +T} T{ +\fIsecondary\fP +T} +_ +T{ +REC +T} T{ +recovering +T} +_ +T{ +UNK +T} T{ +unknown +T} +_ +T{ +SLV +T} T{ +\fIslave\fP +T} +_ +T{ +RTR +T} T{ +mongos process ("router") +T} +_ +.TE +.UNINDENT +.SH USAGE +.sp +In the first example, \fBmongostat\fP will return data every +second for 20 seconds. \fBmongostat\fP collects data from the +\fBmongod\fP instance running on the localhost interface on +port 27017. All of the following invocations produce identical +behavior: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongostat \-\-rowcount 20 1 +mongostat \-\-rowcount 20 +mongostat \-n 20 1 +mongostat \-n 20 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +In the next example, \fBmongostat\fP returns data every 5 minutes +(or 300 seconds) for as long as the program runs. \fBmongostat\fP +collects data from the \fBmongod\fP instance running on the +localhost interface on port \fB27017\fP\&. Both of the following +invocations produce identical behavior. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongostat \-\-rowcount 0 300 +mongostat \-n 0 300 +mongostat 300 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +In the following example, \fBmongostat\fP returns data every 5 +minutes for an hour (12 times.) \fBmongostat\fP collects data +from the \fBmongod\fP instance running on the localhost interface +on port 27017. Both of the following invocations produce identical +behavior. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongostat \-\-rowcount 12 300 +mongostat \-n 12 300 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +In many cases, using the \fI\-\-discover\fP +will help provide a more complete snapshot of the state of an entire +group of machines. If a \fBmongos\fP process connected to a +\fIsharded cluster\fP is running on port \fB27017\fP of the local +machine, you can use the following form to return statistics from all +members of the cluster: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongostat \-\-discover +.ft P +.fi +.UNINDENT +.UNINDENT +.SH AUTHOR +MongoDB Documentation Project +.SH COPYRIGHT +2011-2015 +.\" Generated by docutils manpage writer. +. diff --git a/SOURCES/mongotop.1 b/SOURCES/mongotop.1 new file mode 100644 index 0000000..ec86809 --- /dev/null +++ b/SOURCES/mongotop.1 @@ -0,0 +1,593 @@ +.\" Man page generated from reStructuredText. +. +.TH "MONGOTOP" "1" "January 30, 2015" "3.0" "mongodb-manual" +.SH NAME +mongotop \- MongoDB Activity Monitor +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.sp +\fBmongotop\fP provides a method to track the amount of time a +MongoDB instance spends reading and writing data. \fBmongotop\fP +provides statistics on a per\-collection level. By default, +\fBmongotop\fP returns values every second. +.sp +\fBIMPORTANT:\fP +.INDENT 0.0 +.INDENT 3.5 +In order to connect to a \fBmongod\fP that enforces +authorization with the \fI\-\-auth\fP option, the +\fI\-\-username\fP and +\fI\-\-password\fP options must be used, and the +user specified must have the \fBserverStatus\fP and +\fBtop\fP privileges. +.sp +The most appropriate built\-in role that has these privileges is +\fBclusterMonitor\fP\&. +.UNINDENT +.UNINDENT +.sp +\fBSEE ALSO:\fP +.INDENT 0.0 +.INDENT 3.5 +For more information about monitoring MongoDB, see +http://docs.mongodb.org/manual/administration/monitoring\&. +.sp +For additional background on various other MongoDB status outputs +see: +.INDENT 0.0 +.IP \(bu 2 +http://docs.mongodb.org/manual/reference/command/serverStatus +.IP \(bu 2 +http://docs.mongodb.org/manual/reference/command/replSetGetStatus +.IP \(bu 2 +http://docs.mongodb.org/manual/reference/command/dbStats +.IP \(bu 2 +http://docs.mongodb.org/manual/reference/command/collStats +.UNINDENT +.sp +For an additional utility that provides MongoDB metrics +see \fBmongostat\fP\&. +.UNINDENT +.UNINDENT +.SH OPTIONS +.INDENT 0.0 +.TP +.B mongotop +.UNINDENT +.INDENT 0.0 +.TP +.B mongotop +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help +Returns information on the options and use of \fBmongotop\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-verbose, \-v +Increases the amount of internal reporting returned on standard output +or in log files. Increase the verbosity with the \fB\-v\fP form by +including the option multiple times, (e.g. \fB\-vvvvv\fP\&.) +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-quiet +Runs the \fBmongotop\fP in a quiet mode that attempts to limit the amount +of output. +.sp +This option suppresses: +.INDENT 7.0 +.IP \(bu 2 +output from \fIdatabase commands\fP +.IP \(bu 2 +replication activity +.IP \(bu 2 +connection accepted events +.IP \(bu 2 +connection closed events +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Returns the \fBmongotop\fP release number. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-host <:port>, \-h <:port> +\fIDefault\fP: localhost:27017 +.sp +Specifies a resolvable hostname for the \fBmongod\fP to which to +connect. By default, the \fBmongotop\fP attempts to connect to a MongoDB +instance running on the localhost on port number \fB27017\fP\&. +.sp +To connect to a replica set, specify the +\fBreplSetName\fP and a seed list of set members, as in +the following: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +/<:port>,<:port>,<...> +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +You can always connect directly to a single MongoDB instance by +specifying the host and port number directly. +.sp +Changed in version 3.0.0: If you use IPv6 and use the \fB
:\fP format, you must +enclose the portion of an address and port combination in +brackets (e.g. \fB[
]\fP). + +.sp +If connected to a replica set where the \fIprimary\fP is not +reachable, \fBmongotop\fP returns an error message. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-port +\fIDefault\fP: 27017 +.sp +Specifies the TCP port on which the MongoDB instance listens for +client connections. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ipv6 +Enables IPv6 support and allows the \fBmongotop\fP to connect to the +MongoDB instance using an IPv6 network. All MongoDB programs and +processes disable IPv6 support by default. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-ssl +New in version 2.6. + +.sp +Enables connection to a \fBmongod\fP or \fBmongos\fP that has +SSL support enabled. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCAFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the root certificate chain +from the Certificate Authority. Specify the file name of the +\fB\&.pem\fP file using relative or absolute paths. +.sp +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\&. +.sp +\fBWARNING:\fP +.INDENT 7.0 +.INDENT 3.5 +If the \fBmongo\fP shell or any other tool that connects to +\fBmongos\fP or \fBmongod\fP is run without +\fI\-\-sslCAFile\fP, it will not attempt to validate +server certificates. This results in vulnerability to expired +\fBmongod\fP and \fBmongos\fP certificates as well as to foreign +processes posing as valid \fBmongod\fP or \fBmongos\fP +instances. Ensure that you \fIalways\fP specify the CA file against which +server certificates should be validated in cases where intrusion is a +possibility. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains both the SSL certificate +and key. Specify the file name of the \fB\&.pem\fP file using relative +or absolute paths. +.sp +This option is required when using the \fI\%\-\-ssl\fP option to connect +to a \fBmongod\fP or \fBmongos\fP that has +\fBCAFile\fP enabled \fIwithout\fP +\fBallowConnectionsWithoutCertificates\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslPEMKeyPassword +New in version 2.6. + +.sp +Specifies the password to de\-crypt the certificate\-key file (i.e. +\fI\%\-\-sslPEMKeyFile\fP). Use the \fI\%\-\-sslPEMKeyPassword\fP option only if the +certificate\-key file is encrypted. In all cases, the \fBmongotop\fP will +redact the password from all logging and reporting output. +.sp +If the private key in the PEM file is encrypted and you do not specify +the \fI\%\-\-sslPEMKeyPassword\fP option, the \fBmongotop\fP will prompt for a passphrase. See +\fIssl\-certificate\-password\fP\&. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslCRLFile +New in version 2.6. + +.sp +Specifies the \fB\&.pem\fP file that contains the Certificate Revocation +List. Specify the file name of the \fB\&.pem\fP file using relative or +absolute paths. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidCertificates +New in version 2.6. + +.sp +Bypasses the validation checks for server certificates and allows +the use of invalid certificates. When using the +\fBallowInvalidCertificates\fP setting, MongoDB logs as a +warning the use of the invalid certificate. +.sp +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\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslAllowInvalidHostnames +New in version 3.0. + +.sp +Disables the validation of the hostnames in SSL certificates. Allows +\fBmongotop\fP to connect to MongoDB instances if the hostname their +certificates do not match the specified hostname. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-sslFIPSMode +New in version 2.6. + +.sp +Directs the \fBmongotop\fP to use the FIPS mode of the installed OpenSSL +library. Your system must have a FIPS compliant OpenSSL library to use +the \fI\%\-\-sslFIPSMode\fP option. +.sp +\fBNOTE:\fP +.INDENT 7.0 +.INDENT 3.5 +FIPS Compatible SSL is +available only in \fI\%MongoDB Enterprise\fP\&. See +http://docs.mongodb.org/manual/tutorial/configure\-fips for more information. +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-username , \-u +Specifies a username with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-password\fP and +\fB\-\-authenticationDatabase\fP options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-password , \-p +Specifies a password with which to authenticate to a MongoDB database +that uses authentication. Use in conjunction with the \fB\-\-username\fP and +\fB\-\-authenticationDatabase\fP options. +.sp +If you do not specify an argument for \fI\%\-\-password\fP, \fBmongotop\fP will +prompt interactively for a password on the console. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationDatabase +New in version 2.4. + +.sp +Specifies the database that holds the user\(aqs credentials. +.sp +Changed in version 3.0.0: \fI\%\-\-authenticationDatabase\fP is required for \fBmongod\fP +and \fBmongos\fP instances that use \fIauthentication\fP\&. + +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-authenticationMechanism +\fIDefault\fP: MONGODB\-CR +.sp +New in version 2.4. + +.sp +Changed in version 2.6: Added support for the \fBPLAIN\fP and \fBMONGODB\-X509\fP authentication +mechanisms. + +.sp +Specifies the authentication mechanism the \fBmongotop\fP instance uses to +authenticate to the \fBmongod\fP or \fBmongos\fP\&. +.TS +center; +|l|l|. +_ +T{ +Value +T} T{ +Description +T} +_ +T{ +MONGODB\-CR +T} T{ +MongoDB challenge/response authentication. +T} +_ +T{ +MONGODB\-X509 +T} T{ +MongoDB SSL certificate authentication. +T} +_ +T{ +PLAIN +T} T{ +External authentication using LDAP. You can also use \fBPLAIN\fP +for authenticating in\-database users. \fBPLAIN\fP transmits +passwords in plain text. This mechanism is available only in +\fI\%MongoDB Enterprise\fP\&. +T} +_ +T{ +GSSAPI +T} T{ +External authentication using Kerberos. This mechanism is +available only in \fI\%MongoDB Enterprise\fP\&. +T} +_ +.TE +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiServiceName +New in version 2.6. + +.sp +Specify the name of the service using \fBGSSAPI/Kerberos\fP\&. Only required if the service does not use the +default name of \fBmongodb\fP\&. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-gssapiHostName +New in version 2.6. + +.sp +Specify the hostname of a service using \fBGSSAPI/Kerberos\fP\&. \fIOnly\fP required if the hostname of a machine does +not match the hostname resolved by DNS. +.sp +This option is available only in MongoDB Enterprise. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-locks +Toggles the mode of \fBmongotop\fP to report on use of per\-database +\fIlocks\fP\&. These data are useful for measuring concurrent +operations and lock percentage. +.sp +\fI\%\-\-locks\fP returns an error when called against a \fBmongod\fP instance +that does not report lock usage. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-rowcount int, \-n int +Number of lines of data that \fBmongotop\fP should print. "0 for indefinite" +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-json +New in version 3.0.0. + +.sp +Returns output for \fBmongotop\fP in \fIJSON\fP format. +.UNINDENT +.INDENT 0.0 +.TP +.B +The final argument is the length of time, in seconds, that +\fBmongotop\fP waits in between calls. By default \fBmongotop\fP returns +data every second. +.UNINDENT +.SH FIELDS +.sp +\fBmongotop\fP returns time values specified in milliseconds +(ms.) +.sp +\fBmongotop\fP only reports active namespaces or databases, +depending on the \fI\%\-\-locks\fP option. If you don\(aqt see a database +or collection, it has received no recent activity. You can issue a +simple operation in the \fBmongo\fP shell to generate activity to +affect the output of \fBmongotop\fP\&. +.INDENT 0.0 +.TP +.B mongotop.ns +Contains the database namespace, which combines the database name +and collection. +.sp +Changed in version 2.2: If you use the \fImongotop \-\-locks\fP, the \fBns\fP field does not +appear in the \fBmongotop\fP output. + +.UNINDENT +.INDENT 0.0 +.TP +.B mongotop.db +New in version 2.2. + +.sp +Contains the name of the database. The database named \fB\&.\fP refers +to the global lock, rather than a specific database. +.sp +This field does not appear unless you have invoked +\fBmongotop\fP with the \fI\%\-\-locks\fP option. +.UNINDENT +.INDENT 0.0 +.TP +.B mongotop.total +Provides the total amount of time that this \fBmongod\fP spent +operating on this namespace. +.UNINDENT +.INDENT 0.0 +.TP +.B mongotop.read +Provides the amount of time that this \fBmongod\fP spent +performing read operations on this namespace. +.UNINDENT +.INDENT 0.0 +.TP +.B mongotop.write +Provides the amount of time that this \fBmongod\fP spent +performing write operations on this namespace. +.UNINDENT +.INDENT 0.0 +.TP +.B mongotop. +Provides a time stamp for the returned data. +.UNINDENT +.SH USE +.sp +By default \fBmongotop\fP connects to the MongoDB instance +running on the localhost port \fB27017\fP\&. However, \fBmongotop\fP can optionally +connect to remote \fBmongod\fP +instances. See the \fI\%mongotop options\fP for more +information. +.sp +To force \fBmongotop\fP to return less frequently specify a number, in +seconds at the end of the command. In this example, \fBmongotop\fP will +return every 15 seconds. +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongotop 15 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +This command produces the following output: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C + ns total read write 2014\-12\-19T15:32:01\-05:00 + admin.system.roles 0ms 0ms 0ms + admin.system.version 0ms 0ms 0ms + local.me 0ms 0ms 0ms + local.oplog.rs 0ms 0ms 0ms + local.replset.minvalid 0ms 0ms 0ms + local.startup_log 0ms 0ms 0ms + local.system.indexes 0ms 0ms 0ms +local.system.namespaces 0ms 0ms 0ms + local.system.replset 0ms 0ms 0ms + + ns total read write 2014\-12\-19T15:47:01\-05:00 + admin.system.roles 0ms 0ms 0ms + admin.system.version 0ms 0ms 0ms + local.me 0ms 0ms 0ms + local.oplog.rs 0ms 0ms 0ms + local.replset.minvalid 0ms 0ms 0ms + local.startup_log 0ms 0ms 0ms + local.system.indexes 0ms 0ms 0ms +local.system.namespaces 0ms 0ms 0ms + local.system.replset 0ms 0ms 0ms +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +The output varies depending on your MongoDB setup. For example, +\fBlocal.system.indexes\fP and \fBlocal.system.namespaces\fP only appear +for \fBmongod\fP instances using the \fIMMAPv1\fP +storage engine. +.sp +To return a \fBmongotop\fP report every 5 minutes, use the +following command: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +mongotop 300 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +To report the use of per\-database locks, use \fI\%\-\-locks\fP, +which produces the following output: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ mongotop \-\-locks +connected to: 127.0.0.1 + + db total read write 2012\-08\-13T16:33:34 + local 0ms 0ms 0ms + admin 0ms 0ms 0ms + . 0ms 0ms 0ms +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Changed in version 3.0.0: When called against a \fBmongod\fP that does not report lock +usage, \fI\%\-\-locks\fP will return a \fBFailed: Server does not +support reporting locking information\fP error. + +.SH AUTHOR +MongoDB Documentation Project +.SH COPYRIGHT +2011-2015 +.\" Generated by docutils manpage writer. +. diff --git a/SPECS/mongo-tools.spec b/SPECS/mongo-tools.spec new file mode 100644 index 0000000..7bef05a --- /dev/null +++ b/SPECS/mongo-tools.spec @@ -0,0 +1,326 @@ +%{?scl:%scl_package %{name}} + +%if 0%{?fedora} || 0%{?rhel} == 6|| 0%{?rhel} == 7 +%global with_devel 1 +%global with_bundled 0 +%global with_debug 1 +%global with_check 1 +%global with_unit_test 1 +%else +%global with_devel 0 +%global with_bundled 1 +%global with_debug 0 +%global with_check 0 +%global with_unit_test 0 +%endif + +%if 0%{?with_debug} +# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12 +%global _dwz_low_mem_die_limit 0 +%else +%global debug_package %{nil} +%endif + +%global provider github +%global provider_tld com +%global project mongodb +%global repo mongo-tools +# https://github.com/mongodb/mongo-tools +%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} +%global import_path %{provider_prefix} +%global commit 17a5573551a0c3e33603f98375f144f1dd20b745 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +# Git hash in https://github.com/mongodb/mongo which corresponds to Version +%global mongohash a14d55980c2cdc565d4704a7e3ad37e4e535c1b2 + +Name: %{?scl_prefix}%{repo} +Version: 3.2.1 +Release: 0.3.git%{shortcommit}%{?dist} +Summary: MongoDB Tools +License: ASL 2.0 +URL: https://%{provider_prefix} +Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz +# Mongo-tools does not contain man files yet +# - see https://groups.google.com/forum/#!topic/mongodb-dev/t6Sd2Bki12I +Source1: https://github.com/mongodb/mongo/raw/%{mongohash}/debian/bsondump.1 +Source2: https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongodump.1 +Source3: https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongoexport.1 +Source4: https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongofiles.1 +Source5: https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongoimport.1 +Source6: https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongooplog.1 +Source7: https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongorestore.1 +Source8: https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongostat.1 +Source9: https://github.com/mongodb/mongo/raw/%{mongohash}/debian/mongotop.1 +Source10: https://github.com/mongodb/mongo/raw/%{mongohash}/APACHE-2.0.txt + +Patch0: change-import-path.patch + +# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required +ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}} +# If go_compiler is not set to 1, there is no virtual provide. Use golang instead. +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} + +%if ! 0%{?with_bundled} +BuildRequires: %{?scl_prefix}golang(github.com/howeyc/gopass) +BuildRequires: %{?scl_prefix}golang(github.com/jessevdk/go-flags) +BuildRequires: %{?scl_prefix}golang(github.com/smartystreets/goconvey/convey) +BuildRequires: %{?scl_prefix}golang(github.com/10gen/openssl) +BuildRequires: %{?scl_prefix}golang(golang.org/x/crypto/ssh/terminal) +BuildRequires: %{?scl_prefix}golang(gopkg.in/mgo.v2) +BuildRequires: %{?scl_prefix}golang(gopkg.in/mgo.v2/bson) +BuildRequires: %{?scl_prefix}golang(gopkg.in/tomb.v2) +%endif + +#Conflicts: mongodb < 3.0.0 + +%description +The MongoDB tools provides import, export, and diagnostic capabilities. + +%if 0%{?with_devel} +%package devel +Summary: %{summary} +BuildArch: noarch + +%if 0%{?with_check} +BuildRequires: %{?scl_prefix}golang(github.com/howeyc/gopass) +BuildRequires: %{?scl_prefix}golang(github.com/jessevdk/go-flags) +BuildRequires: %{?scl_prefix}golang(github.com/smartystreets/goconvey/convey) +BuildRequires: %{?scl_prefix}golang(github.com/10gen/openssl) +BuildRequires: %{?scl_prefix}golang(golang.org/x/crypto/ssh/terminal) +BuildRequires: %{?scl_prefix}golang(gopkg.in/mgo.v2) +BuildRequires: %{?scl_prefix}golang(gopkg.in/mgo.v2/bson) +BuildRequires: %{?scl_prefix}golang(gopkg.in/tomb.v2) +%endif + +Requires: %{?scl_prefix}golang(github.com/howeyc/gopass) +Requires: %{?scl_prefix}golang(github.com/jessevdk/go-flags) +Requires: %{?scl_prefix}golang(github.com/smartystreets/goconvey/convey) +Requires: %{?scl_prefix}golang(github.com/10gen/openssl) +Requires: %{?scl_prefix}golang(golang.org/x/crypto/ssh/terminal) +Requires: %{?scl_prefix}golang(gopkg.in/mgo.v2) +Requires: %{?scl_prefix}golang(gopkg.in/mgo.v2/bson) +Requires: %{?scl_prefix}golang(gopkg.in/tomb.v2) + +Provides: %{?scl_prefix}golang(%{import_path}/bsondump) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/archive) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/auth) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/bsonutil) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/db) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/db/kerberos) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/db/openssl) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/intents) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/json) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/log) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/options) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/password) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/progress) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/signals) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/testutil) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/text) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/common/util) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/mongodump) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/mongoexport) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/mongofiles) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/mongoimport) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/mongoimport/csv) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/mongooplog) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/mongorestore) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/mongostat) = %{version}-%{release} +Provides: %{?scl_prefix}golang(%{import_path}/mongotop) = %{version}-%{release} + +%description devel +This package contains library source intended for +building other packages which use %{project}/%{repo}. +%endif + +%if 0%{?with_unit_test} && 0%{?with_devel} +%package unit-test +Summary: Unit tests for %{name} package +# If go_compiler is not set to 1, there is no virtual provide. Use golang instead. +BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} + +%if 0%{?with_check} +#Here comes all BuildRequires: PACKAGE the unit tests +#in %%check section need for running +%endif + +# test subpackage tests code from devel subpackage +Requires: %{name}-devel = %{version}-%{release} + +%description unit-test +%{summary} + +This package contains unit tests for project +providing packages with %{import_path} prefix. +%endif + +%prep +%setup -q -n %{repo}-%{commit} +%if ! 0%{?with_bundled} +%patch0 -p1 +%endif + +%build +%{?scl:scl enable %{scl} - << "EOF"} +# Make link for etcd itself +mkdir -p src/github.com/mongodb +ln -s ../../../ src/github.com/mongodb/mongo-tools + +%if 0%{?with_bundled} +export GOPATH=$(pwd):$(pwd)/vendor:%{gopath} +%else +export GOPATH=$(pwd):%{gopath} +%endif + +%if ! 0%{?gobuild:1} +%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**}; +%endif + +mkdir bin +binaries=(bsondump mongostat mongofiles mongoexport mongoimport mongorestore mongodump mongotop mongooplog) +for bin in "${binaries[@]}"; do + %gobuild -o bin/${bin} \-tags ssl ${bin}/main/${bin}.go +done + +# Copy Apache license +cp %{SOURCE10} $(basename %{SOURCE10}) + +%{?scl:EOF} +%install +%{?scl:scl enable %{scl} - << "EOF"} +# main package binary +install -d -p %{buildroot}%{_bindir} +install -p -m 0755 bin/* %{buildroot}%{_bindir} + +install -d -m 755 %{buildroot}%{_mandir}/man1 +install -p -m 644 %{SOURCE1} %{buildroot}%{_mandir}/man1/ +install -p -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/ +install -p -m 644 %{SOURCE3} %{buildroot}%{_mandir}/man1/ +install -p -m 644 %{SOURCE4} %{buildroot}%{_mandir}/man1/ +install -p -m 644 %{SOURCE5} %{buildroot}%{_mandir}/man1/ +install -p -m 644 %{SOURCE6} %{buildroot}%{_mandir}/man1/ +install -p -m 644 %{SOURCE7} %{buildroot}%{_mandir}/man1/ +install -p -m 644 %{SOURCE8} %{buildroot}%{_mandir}/man1/ +install -p -m 644 %{SOURCE9} %{buildroot}%{_mandir}/man1/ + +%if 0%{?with_devel} +install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ +echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list +# find all *.go but no *_test.go files and generate devel.file-list +for file in $(find . -iname "*.go" \! -iname "*_test.go") ; do + install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) + cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file + echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list +done +%endif + +# testing files for this project +%if 0%{?with_unit_test} && 0%{?with_devel} +install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ +# find all *_test.go files and generate unit-test.file-list +for file in $(find . -iname "*_test.go"); do + install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file) + cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file + echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list +done +cp -r mongorestore/testdata %{buildroot}/%{gopath}/src/%{import_path}/mongorestore/testdata +echo "%%{gopath}/src/%%{import_path}/mongorestore/testdata" >> unit-test.file-list +%endif + +%if 0%{?with_devel} +olddir=$(pwd) +pushd %{buildroot}/%{gopath}/src/%{import_path} +for file in $(find . -type d) ; do + echo "%%dir %%{gopath}/src/%%{import_path}/$file" >> ${olddir}/devel.file-list +done +popd +echo "%%dir %%{gopath}/src/%{provider}.%{provider_tld}/%{project}" >> devel.file-list +echo "%%dir %%{gopath}/src/%{provider}.%{provider_tld}" >> devel.file-list + +sort -u -o devel.file-list devel.file-list +%endif + +%{?scl:EOF} +%check +%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel} +%if ! 0%{?with_bundled} +export GOPATH=%{buildroot}/%{gopath}:%{gopath} +%else +export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} +%endif + +%if ! 0%{?gotest:1} +%global gotest go test +%endif + +%gotest %{import_path}/common/bsonutil +%gotest %{import_path}/common/db +# upstream bug, removed field from Intents struct +#%%gotest %{import_path}/common/intents +# redeclaration of C +#gotest {import_path}/common/json +# import cycle not allowed in test +#gotest {import_path}/common/log +%gotest %{import_path}/common/progress +%gotest %{import_path}/common/text +%gotest %{import_path}/common/util +%gotest %{import_path}/mongodump +%gotest %{import_path}/mongoexport +%gotest %{import_path}/mongofiles +#gotest {import_path}/mongoimport +%gotest %{import_path}/mongooplog +%gotest %{import_path}/mongorestore +%gotest %{import_path}/mongostat +%endif + +#define license tag if not already defined +%{!?_licensedir:%global license %doc} + +%files +%license LICENSE.md APACHE-2.0.txt +%doc Godeps README.md CONTRIBUTING.md THIRD-PARTY-NOTICES +%{_bindir}/* +%{_mandir}/man1/* + +%if 0%{?with_devel} +%files devel -f devel.file-list +%license LICENSE.md +%doc Godeps README.md CONTRIBUTING.md THIRD-PARTY-NOTICES +%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project} +%endif + +%if 0%{?with_unit_test} && 0%{?with_devel} +%files unit-test -f unit-test.file-list +%license LICENSE.md +%doc Godeps README.md CONTRIBUTING.md THIRD-PARTY-NOTICES +%endif + +%changelog +* Fri Feb 12 2016 Marek Skalicky - 3.1.1-0.3.git17a5573 +- Removed conflict with old versions of mongodb + +* Wed Feb 3 2016 Marek Skalicky - 3.1.1-0.2.git17a5573 +- Fixed directory ownership + +* Wed Jan 27 2016 jchaloup - 3.1.1-0.1.git17a5573 +- Update to 3.2.1 + resolves: #1282650 + +* Mon Nov 09 2015 jchaloup - 3.0.4-0.2.gitefe71bf +- Update to spec-2.1 + resolves: #1279140 + +* Mon Jun 22 2015 Marek Skalicky - 3.0.4-1 +- Repacked by using gofed tool (thanks to jchaloup@redhat.com) + +* Wed Jun 17 2015 Fedora Release Engineering - 3.0.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon May 11 2015 Marek Skalicky - 3.0.3-1 +- Upgrade to version 3.0.3 +- Add Apache license + +* Mon May 4 2015 Marek Skalicky - 3.0.2-1 +- Initial packaging