Last active
January 29, 2018 16:58
-
-
Save alanorth/e91daa44ebe4e60bf3dd to your computer and use it in GitHub Desktop.
Parallel rsync script for copying failed GlusterFS bricks (self-heal daemon is too slow!)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
# borrowed / adapted from: https://wiki.ncsa.illinois.edu/display/~wglick/Parallel+Rsync | |
# RSYNC SETUP | |
RSYNC_PROG=/usr/bin/rsync | |
# note the important use of --relative to use relative paths so we don't have to specify the exact path on dest | |
RSYNC_OPTS="-aAXv --numeric-ids --progress --human-readable --delete --exclude=.glusterfs --relative" | |
export RSYNC_RSH="ssh -T -c arcfour -o Compression=no -x" | |
# ENV SETUP | |
SRCDIR=/path/to/good/brick | |
DESTDIR=/path/to/bad/brick | |
# Try to match number of CPUs on machine! | |
THREADS=4 | |
BAD_NODE=server1 | |
cd $SRCDIR | |
# COPY | |
# note the combination of -print0 and -0! | |
find {a..z}* {A..Z}* {0..1}* -mindepth 1 -maxdepth 1 -print0 | \ | |
xargs -0 -n1 -P$THREADS -I% \ | |
$RSYNC_PROG $RSYNC_OPTS "%" $BAD_NODE:$DESTDIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment