-1

I am trying to create snapshot for mongodb on centos 6.6.

root@ ~]# lvscan
File descriptor 12 (pipe:[23409]) leaked on lvscan invocation. Parent   
PID 3579: /bin/bash
File descriptor 13 (pipe:[23409]) leaked on lvscan invocation. Parent   
PID 3579: /bin/bash
ACTIVE            '/dev/vg_test/lv_root' [50.00 GiB] inherit
ACTIVE            '/dev/vg_test/lv_home' [411.49 GiB] inherit
ACTIVE            '/dev/vg_test/lv_swap' [3.78 GiB] inherit

my mongodb data is in folder /home/db/mongodata. Command I need to run is

lvcreate -s -n mysnapshot -L450G /dev/mapper/vg_test-lv_home.

But this will take snapshot of whole volume.

  1. I want snapshot of only /home/db/mongodata. Is it possible?
  2. Also how to create this snapshot on another server directly rather than creating the snapshot on same machine and copying it to another server.

This query is related to https://stackoverflow.com/questions/29345965/creating-snapshot-for-mongodb/29346888?noredirect=1#comment46880237_29346888

1
  • -1: Please don't post the same question on multiple SO sites. If a question is inappropriate for one the moderators can move it to another SO Q&A site. - Second a volume manager almost by definition does not have insight into higher level file-system structures created on top of a logical volume, directory level snapshots are impossible because LVM works on the "raw" block level.
    – HBruijn
    Mar 30, 2015 at 15:08

1 Answer 1

0

Regarding your first question: No, you take a snapshot of complete logical volumes. Please see Taking a Backup Using Snapshots in the LVM HowTo for details. Hint: reading the HowTo completely surely wouldn't cause harm. ;)

As of your second question: think of it? How should the data be copied over without being copied over? At one point in time, the data has to get to the second server one way or the other.

What usually is done in rather large deployments is that one server with very large disks, but lower overall performance is used as a hidden replica set member, dedicated mainly for backup purposes. This has several advantages:

  • The backup process can never interfere with the application, since a hidden member never can become primary and will never be queried by any driver, even when secondaries are allowed or preferred.
  • Sending the created backup to an off-site location has no impact on the bandwidth available to the application (if done correctly).
  • You don't have to sync data out of the production environment manually.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .