You need to sign in or sign up before continuing.
Commit 41483e0e authored by Vitaly Lipatov's avatar Vitaly Lipatov

update gluster scripts

parent d954d09f
#!/bin/sh #!/bin/sh
# TODO: use brick hosts # TODO: use brick hosts
for i in snail multi cellar lav lin-test ; do for i in multi cellar space1 lav lin-test ; do
#for i in virtualbox asu nun ; do #for i in virtualbox asu nun ; do
echo echo
echo "Connect to $i..." echo "Connect to $i..."
......
...@@ -49,16 +49,25 @@ mount_g() ...@@ -49,16 +49,25 @@ mount_g()
# 1 - cmd, 2 - file # 1 - cmd, 2 - file
opbrick() opbrick()
{ {
#ssh $host $1 $path$2 echo "Local execute: $1 $MOUNTDIR//$host/$path/$2" >>$0.log
$1 "$MOUNTDIR//$host/$path/$2" $1 "$MOUNTDIR//$host/$path/$2"
} }
sshopbrick() sshopbrick()
{ {
echo "remove execute: ssh $host $1 $path/$2" >>$0.log
ssh $host $1 $path/$2 ssh $host $1 $path/$2
#$1 "$MOUNTDIR//$host/$path/$2"
} }
# TODO: проблемы со snail2
get_pair()
{
case "$1" in
cellar)
echo snail
;;
esac
}
if [ "$1" = "--allremove" ] || [ "$1" = "--removeNO" ] ; then if [ "$1" = "--allremove" ] || [ "$1" = "--removeNO" ] ; then
remove="$1" remove="$1"
...@@ -78,6 +87,8 @@ fi ...@@ -78,6 +87,8 @@ fi
WORKDIR=~/grf WORKDIR=~/grf
mkdir -p $WORKDIR mkdir -p $WORKDIR
>$0.log
# TODO: rewrite in multiple file manner (or dir support?) # TODO: rewrite in multiple file manner (or dir support?)
sfile="$1" sfile="$1"
sdir= sdir=
...@@ -168,7 +179,7 @@ tr_gfid_to_rpath() ...@@ -168,7 +179,7 @@ tr_gfid_to_rpath()
# hack: translate to a path on volume # hack: translate to a path on volume
file="$(echo "$sfile" | sed -e "s|$FTPROOT/||g")" file="$(echo "$sfile" | sed -e "s|$FTPROOT/||g")"
rfile=$(echo $file | sed -e "s|[<>]||g") rfile=$(echo $file | sed -e "s|<gfid:||g" | sed -e "s|[<>]||g")
rfile=$(get_pgf_name $rfile) rfile=$(get_pgf_name $rfile)
rpath=$path rpath=$path
rfile=$(opbrick "realpath" "$rfile") && break rfile=$(opbrick "realpath" "$rfile") && break
...@@ -295,12 +306,13 @@ if [ "$restore" = "--restore" ] ; then ...@@ -295,12 +306,13 @@ if [ "$restore" = "--restore" ] ; then
set_host_path "$i" set_host_path "$i"
# Надо отличать, есть файл или ошибка с ним. Если файла вообще нет, надо удалять всё на томах # Надо отличать, есть файл или ошибка с ним. Если файла вообще нет, надо удалять всё на томах
FD=$(opbrick 'stat -c %z' "$file" 2>/dev/null) FD=$(opbrick 'stat -c %z' "$file" 2>/dev/null)
echo $FD echo "FD: $FD"
if [ -n "$FD" ] ; then if [ -n "$FD" ] ; then
FILNUM=$(($FILNUM+1)) FILNUM=$(($FILNUM+1))
touch -d "$FD" "$WORKDIR/$host-$COUNT" touch -d "$FD" "$WORKDIR/$host-$COUNT"
if [ -z "$OLDFILE" ] || [ "$OLDFILE" -nt "$WORKDIR/$host-$COUNT" ] ; then if [ -z "$OLDFILE" ] || [ "$OLDFILE" -nt "$WORKDIR/$host-$COUNT" ] ; then
if opbrick "test -L" "$file" || opbrick "test -s" "$file" ; then if opbrick "test -L" "$file" || opbrick "test -r" "$file" ; then
# Если ссылка или файл
OLDFILE="$WORKDIR/$host-$COUNT" OLDFILE="$WORKDIR/$host-$COUNT"
SELFILE="$file" SELFILE="$file"
SELHOST=$host SELHOST=$host
......
...@@ -7,6 +7,8 @@ get_bricks() ...@@ -7,6 +7,8 @@ get_bricks()
gluster volume info $GVOLUME | grep Brick"[0-9]" | sed -e "s|Brick[0-9]: ||g" gluster volume info $GVOLUME | grep Brick"[0-9]" | sed -e "s|Brick[0-9]: ||g"
} }
f()
{
for GVOLUME in $LISTVOLUME ; do for GVOLUME in $LISTVOLUME ; do
for host in $(get_bricks | sed -e "s|:.*||g" | sort -u) ; do for host in $(get_bricks | sed -e "s|:.*||g" | sort -u) ; do
ssh $host cat /var/log/glusterfs/glustershd.log && ssh $host truncate -c -s0 /var/log/glusterfs/glustershd.log ssh $host cat /var/log/glusterfs/glustershd.log && ssh $host truncate -c -s0 /var/log/glusterfs/glustershd.log
...@@ -14,6 +16,7 @@ for GVOLUME in $LISTVOLUME ; do ...@@ -14,6 +16,7 @@ for GVOLUME in $LISTVOLUME ; do
./grflog $GVOLUME grfall.log ./grflog $GVOLUME grfall.log
./grf --restore --list grflog.task ./grf --restore --list grflog.task
done done
}
for GVOLUME in $LISTVOLUME ; do for GVOLUME in $LISTVOLUME ; do
./grflog $GVOLUME ./grflog $GVOLUME
......
...@@ -4,6 +4,6 @@ RES=pub ...@@ -4,6 +4,6 @@ RES=pub
VOLUME=ftp-$RES VOLUME=ftp-$RES
LOCALPATH=/var/ftp/$RES LOCALPATH=/var/ftp/$RES
gluster volume heal ftp-pub info split-brain | grep "^2.*/" | sed -e "s|.* /\(.*\)$|$LOCALPATH/\1|g" | sort -u >$0.log gluster volume heal ftp-pub info split-brain | grep "^[</]" | sed -e "s|^|$LOCALPATH/|g" | sort -u >$0.log
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment