Database Reference
In-Depth Information
Now that you have the snapshot bookmark inserted, you can use the utilities associated with your volume
manager to copy the contents of the snapshot to a suitable place so you can store your backup. Don't forget to release
the snapshot once your backup is complete.
You can visit the following links for more information about snapshots:
http://docs.mongodb.org/manual/tutorial/backup-databases-with-filesystem-snapshots/
http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html
http://docs.huihoo.com/opensolaris/solaris-zfs-administration-guide/html/ch06.html
http://support.rightscale.com/09-Clouds/AWS/02-Amazon_EC2/EBS/Create_an_EBS_Snapshot
Disk Layout to Use with Volume Managers
Some volume managers can take a snapshot of subdirectories on a partition, but most can't, so it is a good idea
to mount the volume you are planning to store your MongoDB data on in a suitable place on your filesystem (for
example, /mnt/mongodb ) and use the server configuration options to place the data directories, the configuration file,
and any other MongoDB-related files (for example, journal) solely on that mount.
This means that when you take a snapshot of the volume, you capture the complete state of the server, including
its configuration. It may even be a good idea to place the binaries of the server distribution directly on that volume, so
that your backup contains a completely coordinated set of components.
Importing Data into MongoDB
Sometimes, you need to load lots of bulk data into MongoDB for use as reference data. Such data might include Zip
code tables, IP geolocation tables, parts catalogs, and so on.
MongoDB includes a bulk “loader,” mongoimport , designed to import data directly into a particular collection on
the server; this differs from mongorestore , which is designed to restore MongoDB binary from backups.
The mongoimport utility can load data from any of three file formats:
1.
CSV : In this file format, each line represents a document, and fields are separated by
commas.
2.
TSV : This file format is similar to CSV; however, it uses a tab character as the delimiter.
This format is popular because it does not require the escaping of any text characters other
than those for new lines.
3.
JSON : This format contains one block of JSON per line that represents a document. Unlike
the other formats, JSON can support documents with variable schemas.
The use of this utility is fairly intuitive. For input, it takes a file in one of the three formats, a string or a file with a set of
column header names (these form the element names in a MongoDB document), and several options that are used to
control how the data is interpreted. Figure 9-3 shows how to use the mongoimport utility.
 
Search WWH ::




Custom Search