Commit 41483e0e authored by Vitaly Lipatov's avatar Vitaly Lipatov

update gluster scripts

parent d954d09f
#!/bin/sh
# 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
echo
echo "Connect to $i..."
......
......@@ -49,16 +49,25 @@ mount_g()
# 1 - cmd, 2 - file
opbrick()
{
#ssh $host $1 $path$2
echo "Local execute: $1 $MOUNTDIR//$host/$path/$2" >>$0.log
$1 "$MOUNTDIR//$host/$path/$2"
}
sshopbrick()
{
echo "remove execute: ssh $host $1 $path/$2" >>$0.log
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
remove="$1"
......@@ -78,6 +87,8 @@ fi
WORKDIR=~/grf
mkdir -p $WORKDIR
>$0.log
# TODO: rewrite in multiple file manner (or dir support?)
sfile="$1"
sdir=
......@@ -168,7 +179,7 @@ tr_gfid_to_rpath()
# hack: translate to a path on volume
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)
rpath=$path
rfile=$(opbrick "realpath" "$rfile") && break
......@@ -295,12 +306,13 @@ if [ "$restore" = "--restore" ] ; then
set_host_path "$i"
# Надо отличать, есть файл или ошибка с ним. Если файла вообще нет, надо удалять всё на томах
FD=$(opbrick 'stat -c %z' "$file" 2>/dev/null)
echo $FD
echo "FD: $FD"
if [ -n "$FD" ] ; then
FILNUM=$(($FILNUM+1))
touch -d "$FD" "$WORKDIR/$host-$COUNT"
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"
SELFILE="$file"
SELHOST=$host
......
......@@ -7,6 +7,8 @@ get_bricks()
gluster volume info $GVOLUME | grep Brick"[0-9]" | sed -e "s|Brick[0-9]: ||g"
}
f()
{
for GVOLUME in $LISTVOLUME ; 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
......@@ -14,6 +16,7 @@ for GVOLUME in $LISTVOLUME ; do
./grflog $GVOLUME grfall.log
./grf --restore --list grflog.task
done
}
for GVOLUME in $LISTVOLUME ; do
./grflog $GVOLUME
......
......@@ -4,6 +4,6 @@ RES=pub
VOLUME=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