diff options
| author | Andrew Tridgell <tridge@samba.org> | 2008-10-07 09:51:52 +1100 |
|---|---|---|
| committer | Andrew Tridgell <tridge@samba.org> | 2008-10-07 09:51:52 +1100 |
| commit | 62b59d8a7c46ed9a7bdca15e4336e1ccd0322533 (patch) | |
| tree | 840b1cc5a2d200d53ae8e1545596738965f69ce2 /base/root/scripts | |
| parent | d8337534f1ffd4597721c1519c8ab2b1320a5e20 (diff) | |
| parent | bc86c0a1d5c9f1daeffa7b96a40fe35d357b0017 (diff) | |
| download | autocluster-62b59d8a7c46ed9a7bdca15e4336e1ccd0322533.tar.gz autocluster-62b59d8a7c46ed9a7bdca15e4336e1ccd0322533.tar.xz autocluster-62b59d8a7c46ed9a7bdca15e4336e1ccd0322533.zip | |
Merge commit 'svart/master'
Diffstat (limited to 'base/root/scripts')
| -rw-r--r-- | base/root/scripts/conf.base | 13 | ||||
| -rw-r--r-- | base/root/scripts/functions | 33 | ||||
| -rwxr-xr-x | base/root/scripts/postinstall.sh | 51 | ||||
| -rwxr-xr-x | base/root/scripts/setup_samba.sh | 44 |
4 files changed, 120 insertions, 21 deletions
diff --git a/base/root/scripts/conf.base b/base/root/scripts/conf.base index 1a7942f..3bc9d34 100644 --- a/base/root/scripts/conf.base +++ b/base/root/scripts/conf.base @@ -45,9 +45,9 @@ data=/gpfs/data [httpexports] - ScriptAlias "/gpfs/data" "/var/www/cgi-bin/browse.cgi" - RewriteRule ^/data(.*)$ "/gpfs/data$1" [R] - + ScriptAliasMatch "^/gpfs/data" "/var/www/cgi-bin/browse.cgi" + RewriteRule "^/data(.*)$" "/gpfs/data$1" [PT] + [nfsexports] "/gpfs/data" *(rw,no_root_squash,fsid=834258092) @@ -72,6 +72,7 @@ gpfs:leases = yes passdb backend = tdbsam idmap backend = tdb2 + idmap:cache = no security = ADS preferred master = no idmap gid = 10000000-11000000 @@ -83,6 +84,7 @@ vfs objects = shadow_copy2 syncops gpfs fileid shadow:snapdir = .snapshots shadow:fixinodes = yes + wide links = no auth methods = guest sam winbind smbd:backgroundqueue = False read only = no @@ -222,10 +224,13 @@ # should ctdb manage starting/stopping the winbind service for you? # default is autodetect CTDB_MANAGES_WINBIND=yes + # should ctdb monitor GPFS filesystems and disks + CTDB_MANAGES_GPFS=yes # you may wish to raise the file descriptor limit for ctdb # use a ulimit command here. ctdb needs one file descriptor per # connected client (ie. one per connected client in Samba) ulimit -n 10000 + DAEMON_COREFILE_LIMIT="unlimited" # the NODES file must be specified or ctdb won't start # it should contain a list of IPs that ctdb will use # it must be exactly the same on all cluster nodes @@ -462,8 +467,8 @@ logfacility=LOG_USER [/etc/httpd/conf.d/shares.config] - RewriteRule "^/data(.*)$" "/gpfs/data$1" [PT] ScriptAliasMatch "^/gpfs/data" "/var/www/cgi-bin/browse.cgi" + RewriteRule "^/data(.*)$" "/gpfs/data$1" [PT] [/etc/vsftpd/vsftpd.conf] # no anon access diff --git a/base/root/scripts/functions b/base/root/scripts/functions new file mode 100644 index 0000000..be320fe --- /dev/null +++ b/base/root/scripts/functions @@ -0,0 +1,33 @@ +# Hey Emacs, this is a -*- shell-script -*- In fact, it is bash! :-) + +cluster_is_healthy () +{( + set -o pipefail + { ctdb -Y status || return 1 ; } | + { + read x + count=0 + while read line ; do + count=$(($count + 1)) + [ "${line#:*:*:}" != "0:0:0:0:" ] && cat >/dev/null && return 1 + done + [ $count -gt 0 ] && return $? + } +)} + +wait_until_healthy () +{ + local timeout="${1:-120}" + + while [ $timeout -gt 0 ] ; do + if cluster_is_healthy ; then + echo . + return 0 + fi + echo -n . + timeout=$(($timeout - 1)) + sleep 1 + done + + return 1 +} diff --git a/base/root/scripts/postinstall.sh b/base/root/scripts/postinstall.sh new file mode 100755 index 0000000..8335155 --- /dev/null +++ b/base/root/scripts/postinstall.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +echo "setting up SoFS repos" + +cat << EOF > /etc/yum.repos.d/SOFS.repo +@@YUM_REPOS@@ +EOF + +echo "Updating from SoFS repositories" +yum -y update + +echo "Trying install of scsi-target-utils" +yum -y install scsi-target-utils + +# we have to force the base GPFS package first, due to the way gpfs updates work +echo "Installing GPFS base" +yum -y install gpfs.base-3.2.0-0.x86_64 + +# then update it + +echo "Updating GPFS base" +yum -y update + +echo "Installing SoFS packages" +yum -y install sofs-toolset +if [ "@@WITH_SOFS_GUI@@" = 1 ] ; then + yum -y install sofs-base sofs-gpfs-gui sofs-stats-gui sofs-wizards sofs-space-gui sofs-common +else + echo "Skipping installation of SoFS GUI packages" +fi + +echo "Installing ctdb packages" +yum -y install ctdb ctdb-debuginfo + +echo "Installing samba packages" +yum -y install samba samba-debuginfo samba-client samba-doc samba-winbind-32bit + +echo "Installing remaining GPFS packages" +yum -y install gpfs.src gpfs.msg gpfs.docs gpfs.gpl gpfs.msg.en_US + +echo "Installing SMutil" +yum -y install SMutil + +echo "Installing ipvsadm" +yum -y install ipvsadm + +echo "Rebuilding the GPFS modules" +(cd /usr/lpp/mmfs/src && make Autoconfig World InstallImages) + +# the TSM packages cause trouble with auto-install +# yum -y install TIVsm-API TIVsm-HSM TIVsm-BA diff --git a/base/root/scripts/setup_samba.sh b/base/root/scripts/setup_samba.sh index 44e97e5..eb3eaff 100755 --- a/base/root/scripts/setup_samba.sh +++ b/base/root/scripts/setup_samba.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # this sets up Samba without using the GUI. It is meant as a quick way to get setup # with an autocluster system @@ -12,6 +12,8 @@ trap 'es=$?; domain_auth="administrator" conf_file="/root/scripts/conf.base" +. /root/scripts/functions + ###################################### # run an onnode - using -p if possible run_onnode() { @@ -54,6 +56,10 @@ while true ; do esac done +echo "Enabling NTP and ensuring it is started" +run_onnode all chkconfig ntpd on +run_onnode all service ntpd restart + mmgetstate | grep active > /dev/null || { echo "GPFS must be running to setup Samba" exit 1 @@ -67,12 +73,12 @@ cat <<EOF > /etc/samba/smb.conf clustering = yes EOF -echo "Restarting ctdb" +echo "Enabling and restarting ctdb" +run_onnode all chkconfig ctdb on run_onnode all "service ctdb restart > /dev/null" -echo "Waiting for ctdb to enter normal mode" -while ! ctdb status | grep NORMAL > /dev/null; do echo -n "."; sleep 1; done -echo +echo "Waiting for cluster to become healthy" +wait_until_healthy echo "Starting smbd to initialise registry" /usr/sbin/smbd -D @@ -85,28 +91,32 @@ sofs conf restore "$conf_file" echo "Forcing config reload" sofs conf reload -echo "Fixing scp and ftp jails" -onnode -p all /opt/IBM/sofs/scripts/cnjailgen /var/opt/IBM/sofs/scproot -onnode -p all /opt/IBM/sofs/scripts/cnjailgen /var/opt/IBM/sofs/ftproot -ln -f /lib64/libnss_winbind* /var/opt/IBM/sofs/scproot/lib64/ -ln -f /lib64/libnss_winbind* /var/opt/IBM/sofs/ftproot/lib64/ - echo "Joining domain" net ads join -U"$domain_auth" echo "Restarting ctdb" run_onnode all "service ctdb restart > /dev/null" -echo "Waiting for ctdb to enter normal mode" -while ! ctdb status | grep NORMAL > /dev/null; do echo -n "."; sleep 1; done -echo +echo "Waiting for a few seconds..." +sleep 20 # why is this needed? Samba doesn't come up the first time?? echo "Restarting ctdb again" run_onnode all "service ctdb restart > /dev/null" -echo "Waiting for ctdb to enter normal mode" -while ! ctdb status | grep NORMAL > /dev/null; do echo -n "."; sleep 1; done -echo +# let's hit this with a big hammer... +for i in $(seq 1 5) ; do + echo "Waiting until healthy" + wait_until_healthy 60 && break + echo "Nope, restart ctdb again..." + run_onnode all "service ctdb restart > /dev/null" +done + +echo "Waiting for cluster to become healthy" +wait_until_healthy + +echo "Ensuring scp and ftp jails are setup" +onnode -p all /opt/IBM/sofs/scripts/cnjailgen /var/opt/IBM/sofs/scproot +onnode -p all /opt/IBM/sofs/scripts/cnjailgen /var/opt/IBM/sofs/ftproot echo "Setup done" |
