Skip to content
This repository has been archived by the owner on Nov 14, 2018. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: payperks/mongolvmbackup
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: Tundaware/mongolvmbackup
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Jun 22, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fcbd1bf View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c3b9d50 View commit details
Showing with 7 additions and 7 deletions.
  1. +7 −7 mongolvmbackup.sh
14 changes: 7 additions & 7 deletions mongolvmbackup.sh
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ date=`date +%F_%H%M`
targetfile="${volume}-${date}-snap.${COMPRESS_SUFFIX}"

# Get the MDB version
MDBVERSION=`mongo --eval "db.version()" | awk 'NR==3' | tr -d "."`
MDBVERSION=`mongo --eval "db.version()" | grep "MongoDB server version: " | tr -d "MongoDB server version: " | tr -d "."`
# Get the MDB engine
MDBENGINE=`mongo $OPTION --eval "printjson(db.serverStatus().storageEngine)" | grep -oP wiredTiger`

@@ -189,25 +189,25 @@ else
echo "$MDBVERLIMIT < $MDBVERSION and the engine is $MDBENGINE so fsyncLock is required!"
echo "Freezing MongoDB before LVM snapshot"
mongo $OPTION -eval "printjson(db.fsyncLock())"
IsFSYNCLOCKON=`mongo $OPTION -eval "printjson(db.currentOp())" | grep -oP fsyncLock`
if [ ! $IsFSYNCLOCKON ];
IsFSYNCLOCKON=`mongo $OPTION -eval "printjson(db.currentOp())" | grep -oP '"fsyncLock" : true' | tr -d '"fsyncLock" : '`
if [ ! $IsFSYNCLOCKON ];
then
echo "fsyncLock is OFF yet! "
exit 1
fi

# CREATE THE SNAPSHOT
create_lvsnap

echo "Snapshot OK; unfreezing DB"
mongo $OPTION -eval "db.fsyncUnlock()"
echo
echo
echo
fi


# fix bug: lvcreate snapshot mount by uuid as shown on url: http://www.zero-effort.net/tip-of-the-day-mounting-an-xfs-lvm-snapshot/
xfs_repair -L "/dev/${vgroup}/${snapvol}" >/dev/null 2>&1
xfs_repair -L "/dev/${vgroup}/${snapvol}" >/dev/null 2>&1

# Mount the snapshot
mountpoint=`mktemp -t -d mount.mongolvmbackup_XXX`