diff options
author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2011-09-26 13:58:32 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2011-09-26 13:58:32 +0530 |
commit | 733df5316f61591ab39265270a1ae1564afd7f67 (patch) | |
tree | 26c9bdbe6249ca24092aa80e0e8c28c8ca2d2d2c | |
parent | ec0a69e378a90fc8ccc09e2234ab3e0f2ce69182 (diff) |
helper_scripts/install_parallel_glusterfs: script to install the glusterfs simultaneously on multiple machines
This scripts looks into a file to know the IP address of the machines
where glusterfs has to be installed. Then executes the download_and_install.sh
script on all the machines. It is assumed that download_and_install.sh
script is available on all the machines. glusterfs version is given
as the argument.
-rw-r--r-- | helper_scrips/INFO | 4 | ||||
-rwxr-xr-x | helper_scrips/install_parallel_glusterfs.sh | 64 |
2 files changed, 67 insertions, 1 deletions
diff --git a/helper_scrips/INFO b/helper_scrips/INFO index 1f09a1b..c349fba 100644 --- a/helper_scrips/INFO +++ b/helper_scrips/INFO @@ -6,10 +6,12 @@ helper_scrips/rpm_qa_download_install.sh -----> downloads the rpms for the speci ============================================================================================================================================= -herper_scripts/clean_glusterd.sh +helper_scripts/clean_glusterd.sh helper_scripts/clean_logs.sh helper_scripts/start_glusterd.sh helper_scripts/probe.sh The above scripts are usable with the passwordless ssh connection setup between the glusterfs servers, which helps in cleaning the logs, probing, cleaning glusterd, starting glusterd etc. +============================================================================================================================================= +helper_scripts/install_parallel_glusterfs.sh --------> executes the download_and_install.sh scripts prallely on multiple machines, such that glusterfs gets installed on multiple machines simultaneously. diff --git a/helper_scrips/install_parallel_glusterfs.sh b/helper_scrips/install_parallel_glusterfs.sh new file mode 100755 index 0000000..15455fb --- /dev/null +++ b/helper_scrips/install_parallel_glusterfs.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +function _init () +{ + set -u; + VERSION=$1; +} + +function install_glusterfs () +{ + local remote_server=; + + if [ $# -eq 1 ]; then + remote_server=$1; + fi + + if [ $remote_server ]; then + ssh $remote_server cp -f /root/scripts/download_and_install.sh /root/; + ssh $remote_server /root/download_and_install.sh $VERSION; + return 0; + fi + + j=0; + for i in $(cat /root/machines) + do + j=$(($j+1)); + (install_glusterfs $i)& + done + +} + +function install_my_glusterfs () +{ + old_PWD=$PWD; + + cd /root; + cp /root/scripts/download_and_install.sh /root/; + /root/download_and_install.sh $VERSION; + + cd $old_PWD; + return 0; +} + +function main () +{ + stat --printf=%i /root/machines 2>/dev/null 1>/dev/null; + if [ $? -ne 0 ]; then + echo "servers file is not present /root. Cannot execute further."; + + exit 1; + fi + + install_glusterfs; + for i in $(1 $j) + do + wait %$j; + done + + install_my_glusterfs; + + return 0; +} + +_init "$@" && main "$@" |