diff options
author | Ashish Pandey <aspandey@redhat.com> | 2018-05-22 15:48:16 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-05-30 03:24:49 +0000 |
commit | 95e735b71b077d1ad7fd8c5a7152176968cc6588 (patch) | |
tree | 2f3b66e0df83dc72e1d337bae5b92f86f12c1e58 /extras/thin-arbiter/setup-thin-arbiter.sh | |
parent | 052fce3f31d856fce10e07eda5f5c49ad3390d3a (diff) |
thin-arbiter : Provide scripts and service file to start thin-arbiter process
1 - setup-thin-arbiter.sh
To setup directory path for thin-arbiter. This is the path where replica id
file will be placed and used by TA process.
By default it will be /mnt/thin-arbiter. It is better to use default path
and once set it should not be changed.
2 - gluster-ta-volume.service
This is the Unit file used by systemd to start and keep the thin-arbiter
process running.
3 - thin-arbiter.vol
This is the default volume file for thin-arbiter. It will be used to start
thin-arbiter process. This should not be modified by user except the
directory path which can be modified using [1].
Change-Id: I68f2164f24adfa326c1d1a7a98c6ac4ff04ed553
fixes: bz#1579786
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
Diffstat (limited to 'extras/thin-arbiter/setup-thin-arbiter.sh')
-rwxr-xr-x | extras/thin-arbiter/setup-thin-arbiter.sh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/extras/thin-arbiter/setup-thin-arbiter.sh b/extras/thin-arbiter/setup-thin-arbiter.sh new file mode 100755 index 00000000000..32fe7fc0cdd --- /dev/null +++ b/extras/thin-arbiter/setup-thin-arbiter.sh @@ -0,0 +1,68 @@ +#! /bin/bash + +volloc="/var/lib/glusterd/thin-arbiter" +mkdir -p $volloc + +cp -f extras/thin-arbiter/thin-arbiter.vol $volloc/thin-arbiter.vol +tafile="$volloc/thin-arbiter.vol" + +volfile_set_brick_path () { + while read -r line + do + dir=`echo "$line" | cut -d' ' -f 2` + if [ "$dir" = "directory" ] + then + bpath=`echo "$line" | cut -d' ' -f 3` + sed -i -- 's?'$bpath'?'$1'?g' $tafile + return + fi + done < $tafile +} + +tapath="/mnt/thin-arbiter" +echo "Volume file to be used to start thin-arbiter process is :" +echo "$tafile" +echo " " +echo "Default thin-arbiter path is : $tapath" +echo -n "Do you want to change path for thin arbiter volumes. (y/N): " +echo " " +read moveon + +if [ "${moveon}" = 'N' ] || [ "${moveon}" = 'n' ]; then + echo "Default brick path, $tapath, has been set" + echo "for all thin arbiter volumes using this node" + echo " " +else + echo -n "Enter brick path for thin arbiter volumes: " + read tapath + echo "Entered brick path : $tapath " + echo "Please note that this brick path will be used for ALL" + echo "VOLUMES using this node to host thin-arbiter brick" + echo " " +fi + +mkdir -p $tapath/.glusterfs/indices +volfile_set_brick_path "$tapath" + +echo "Directory path to be used for thin-arbiter volume is: $tapath" +echo " " + +echo "========================================================" + +echo "Installing and starting service for thin-arbiter process" + +cp extras/thin-arbiter/gluster-ta-volume.service /etc/systemd/system/ + +chmod 0777 /etc/systemd/system/gluster-ta-volume.service + +systemctl daemon-reload +systemctl enable gluster-ta-volume +systemctl stop gluster-ta-volume +systemctl start gluster-ta-volume + +if [ $? == 0 ] +then + echo "thin-arbiter process is setup and running" +else + echo "Failed to setup thin arbiter" +fi |