Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
41483e0e
You need to sign in or sign up before continuing.
Commit
41483e0e
authored
Jun 23, 2015
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update gluster scripts
parent
d954d09f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
7 deletions
+22
-7
glruncmd
gluster/glruncmd
+1
-1
grf
gluster/grf
+17
-5
grfall
gluster/grfall
+3
-0
healrep
gluster/healrep
+1
-1
No files found.
gluster/glruncmd
View file @
41483e0e
#!/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
..."
...
...
gluster/grf
View file @
41483e0e
...
@@ -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
...
...
gluster/grfall
View file @
41483e0e
...
@@ -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
...
...
gluster/healrep
View file @
41483e0e
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment