-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Tutorial copy db #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tutorial copy db #79
Changes from 4 commits
2e8f15d
c2638f3
515cdb9
c67ffd4
66721b0
fda47bb
8450a69
6f2ee44
414738f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| ================================================= | ||
| Copy or Clone Database without Intermediate Files | ||
| ================================================= | ||
|
|
||
| .. default-domain:: mongodb | ||
|
|
||
| Sypnosis | ||
| -------- | ||
|
|
||
| One may need to copy a :term:`database` from one server to another, | ||
| rename a :term:`database`, or move a :term:`database` within the same | ||
| server, seed a development server from a production server, or create | ||
| a test environment with production data. The :program:`copyDatabase` | ||
| and :program:`cloneDatabase` function in MongoDB can help one in these | ||
| situations. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No where else in the documentation do we use the second person formal "i.e. One." because it sounds stilted, and isn't necessary. It's particularly awkard in this case because you use the informal later in the document. In some situations you may want to copy a database from one MongoDB instance to another. For example, you may use these commands to support migrations and data warehousing, seeding test environments, or to help perform backups. |
||
|
|
||
| This document oulines the procedure to copy MongoDB :term:`databases` | ||
| using the :program:`copyDatabase` and :program:`cloneDatabase` | ||
| command. | ||
|
|
||
| While :program:`mongodump` and :program:`mongorestore` tools are | ||
| available, the copy database commands are faster as there are no | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this sentence isn't grammatically correct. something more along the lines of: mongodump and mongorestore provide similar functionality; however...
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. they're not just available, but they preform related functionality.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. faster because the commands do not require intermediate files. |
||
| intermediate files to be created. | ||
|
|
||
| .. warning:: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is really a note. |
||
|
|
||
| Copy procedures with :program:`copyDatabase` and | ||
| :program:`cloneDatabase` do not lock the database, so writes may | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use :dbcommand: rather than :program: for database commands. :func: annotates shell helpers. so:
|
||
| still occur during the copy process at the source. This will | ||
| produce a destination database that is inconsistent with the source | ||
| database. | ||
|
|
||
| If your needs are for consistent database copies, consider using | ||
| :program:`mongodump` and :program:`mongorestore` instead. More | ||
| details on these programs can be found in :ref:`database dump | ||
| <database-dump>` and :ref:`database restore <database-restore`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need to be careful about using the word "inconsistent," which I think most people read as "corrupt," in the case of databases. :dbcommand: Also unless you use the --oplog and --oplog replay operations, mongodump and mongorestore have the same behavior. |
||
|
|
||
| Considerations | ||
| -------------- | ||
|
|
||
| - These commands must be run on the destination server. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which commands? consider the possibility that people might start reading this document at the "considerations" header. |
||
|
|
||
| - These commands do not work with the total data set of a :term:`shard | ||
| cluster`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "total data set" is not a specific term that we've used in any context. It's not entirely accurate. The actual compatibility issue, would be good to cover: is this operation totally blocked in shard clusters. does it work for databases that don't have sharded collections? that don't have sharding enabled? |
||
|
|
||
| - There must be enough free disk storage on the destination server for the | ||
| database from the source server. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The destination server must have sufficient free space for the database you are copying. (I would put this lower on the list becasue while it's true, and must be said, but it's sort of obvious and I fear people might not read the next point, which is not obvious.) |
||
|
|
||
| - The :program:`copyDatabase` commands may be run on a :term:`secondary` | ||
| member. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
|
|
||
| Process | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Procedures. |
||
| ------- | ||
|
|
||
| Copy a Database from Another Server | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| To copy database named ``test`` on server ``db0.example.net`` to | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the database |
||
| another server ``db1.example.net`` naming it to ``records``. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/naming it to/renaming it/ |
||
|
|
||
| - Verify name of database, ``test``, you want to copy on the source | ||
| server, ``db0.example.net``. | ||
|
|
||
| - Log onto the destination server, ``db1.example.net``. | ||
|
|
||
| - Run the following command from :program:`mongo shell` on the | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/command/operation/ s/:program: |
||
| destination server, ``db1.example.net``. | ||
|
|
||
| .. code-block:: javascript | ||
|
|
||
| db.copyDatabase( test, records, db0.example.net ) | ||
|
|
||
| Copy a Database within a Server | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this title should be "rename a database" to reflect actual useage. |
||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| To rename a database from ``test`` to ``records`` within the | ||
| same server, ``db1.example.net``. | ||
|
|
||
| - Log onto the destination server, ``db1.example.net``. | ||
|
|
||
| - Run the following command from :program:`mongo shell` on the | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not |
||
| destination server, ``db1.example.net``. | ||
|
|
||
| .. code-block:: javascript | ||
|
|
||
| db.copyDatabase( test, records ) | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for all of these examples I think it's important to provide links to the database command names (in case people want to use the drivers.) also to note might be good to what the output is in the shell. |
||
| Copy a Database with Authentication | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| If the source server requires ``username`` and ``password`` | ||
| authentication, you can include these parameters in the | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is no other form of authentication |
||
| :program:`copyDatabase` command. | ||
|
|
||
| To copy ``test`` to ``records`` from the source server | ||
| ``db0.example.net``, which requires ``username`` and ``password`` | ||
| authentication, to ``db1.example.net`` use the following procedure. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs a colon. |
||
|
|
||
| - Log onto the destination server, ``db1.example.net``. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you'll see the change in my diff, but "Log onto" isn't what you mean.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I remember this now. I think I wrote this before we talked about the difference between Logon and Login... |
||
|
|
||
| - Run the following command from :program:`mongo shell` on the | ||
| destination server, ``db1.example.net``. | ||
|
|
||
| .. code-block:: javascript | ||
|
|
||
| db.copyDatabase( test, records, db0.example.net, username, password) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation isn't correct given the context. probably need to correct throughout. |
||
|
|
||
| Copy a Database Using CloneDatabase Command | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| :program:`cloneDatabase` is similar to :program:`copyDatabase` but is | ||
| limited to only copying a database from another server while | ||
| preserving the database name. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :dbcommand: (or something along these lines.) |
||
|
|
||
| To copy a database from ``db0.example.net`` to ``db1.example.net``, on | ||
| ``db1.example.net`` follow these procedures. | ||
|
|
||
| - Log onto the destination server, ``db1.example.net``. | ||
|
|
||
| - Run the following command from :program:`mongo shell` on the | ||
| destination server, ``db1.example.net``. | ||
|
|
||
| .. code-block:: javascript | ||
|
|
||
| db.cloneDatabase( db0.example.net ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you only need to use :term: for the first occurrence of a term in a section.