From 3af06b8d6a13061c420c19f6d3772ae5d4774a01 Mon Sep 17 00:00:00 2001 From: Di Qing Date: Mon, 3 Dec 2007 16:33:53 +0000 Subject: [PATCH] Create config_glite_lb_30 and change mysql to mysqld for 3.1 --- org.glite.yaim.lb/config/functions/config_glite_lb | 4 +- .../config/functions/config_glite_lb_30 | 141 +++++++++++++++++++++ org.glite.yaim.lb/config/node-info.d/glite-lb_30 | 2 +- 3 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 org.glite.yaim.lb/config/functions/config_glite_lb_30 diff --git a/org.glite.yaim.lb/config/functions/config_glite_lb b/org.glite.yaim.lb/config/functions/config_glite_lb index 52a3262..e726710 100644 --- a/org.glite.yaim.lb/config/functions/config_glite_lb +++ b/org.glite.yaim.lb/config/functions/config_glite_lb @@ -40,10 +40,10 @@ function config_glite_lb() { fi fi - /sbin/chkconfig mysql on + /sbin/chkconfig mysqld on ps ax | grep -v grep |grep mysqld_safe > /dev/null 2>&1 if [ ! $? = 0 ] ; then - /etc/init.d/mysql start + /etc/init.d/mysqld start sleep 1 fi diff --git a/org.glite.yaim.lb/config/functions/config_glite_lb_30 b/org.glite.yaim.lb/config/functions/config_glite_lb_30 new file mode 100644 index 0000000..52a3262 --- /dev/null +++ b/org.glite.yaim.lb/config/functions/config_glite_lb_30 @@ -0,0 +1,141 @@ +function config_glite_lb_check(){ + requires MYSQL_PASSWORD +} + +function config_glite_lb_setenv(){ + + yaimgridenv_set GLITE_LOCATION ${INSTALL_ROOT:-opt}/glite + yaimgridenv_set GLITE_LOCATION_VAR /var/glite + yaimgridenv_set GLITE_USER ${GLITE_USER:-glite} + yaimgridenv_set GLITE_WMS_QUERY_TIMEOUT 300 + yaimgridenv_set GLITE_HOST_CERT ${GLITE_USER_HOME:-/home/glite}/.certs/hostcert.pem + yaimgridenv_set GLITE_HOST_KEY ${GLITE_USER_HOME:-/home/glite}/.certs/hostkey.pem + yaimgridenv_set X509_CERT_DIR /etc/grid-security/certificates + yaimgridenv_set X509_VOMS_DIR /etc/grid-security/vomsdir + + yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/glite/lib + yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/globus/lib + yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/c-ares/lib +} + +function config_glite_lb() { + + ############################################# + # Logging and Bookkeeping configuration # + ############################################# + + HOSTNAME=`hostname -f` + + chmod og+rx /var/lib/mysql/ + + # add option --max_allowed_packet=17M + if [ ! -f /etc/my.cnf ]; then + echo "[mysqld]" >> /etc/my.cnf + echo "max_allowed_packet=17M" >> /etc/my.cnf + else + grep "^[mysqld]" /etc/my.cnf > /dev/null + if [ ! $? = 0 ]; then + echo "[mysqld]" >> /etc/my.cnf + echo "max_allowed_packet=17M" >> /etc/my.cnf + fi + fi + + /sbin/chkconfig mysql on + ps ax | grep -v grep |grep mysqld_safe > /dev/null 2>&1 + if [ ! $? = 0 ] ; then + /etc/init.d/mysql start + sleep 1 + fi + + ls /tmp/mysql.sock > /dev/null 2>&1 + if [ ! $? = 0 ]; then + ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock + fi + + # set mysql password + set_mysql_passwd || return 1 # the function uses $MYSQL_PASSWORD + + # Check if database exist + mysqlshow --password="$MYSQL_PASSWORD" | grep "lbserver20" > /dev/null 2>&1 + + if [ ! $? = 0 ]; then + mysql -u root --password="$MYSQL_PASSWORD" -e "CREATE DATABASE lbserver20" + mysql --password="$MYSQL_PASSWORD" lbserver20 < ${INSTALL_ROOT}/glite/etc/glite-lb-dbsetup.sql + mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on lbserver20.* to lbserver IDENTIFIED BY '' WITH GRANT OPTION;" + mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on lbserver20.* to lbserver@'$HOSTNAME' IDENTIFIED BY '' WITH GRANT OPTION;" + mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on lbserver20.* to lbserver@localhost IDENTIFIED BY '' WITH GRANT OPTION;" + mysql -u root --password="$MYSQL_PASSWORD" -e "ALTER TABLE short_fields MAX_ROWS=1000000000;" lbserver20 + mysql -u root --password="$MYSQL_PASSWORD" -e "ALTER TABLE long_fields MAX_ROWS=55000000;" lbserver20 + mysql -u root --password="$MYSQL_PASSWORD" -e "ALTER TABLE states MAX_ROWS=9500000;" lbserver20 + mysql -u root --password="$MYSQL_PASSWORD" -e "ALTER TABLE events MAX_ROWS=175000000;" lbserver20 + else + yaimlog "Database lbserver20 already exists" + fi + + # do we need bkindex? + + GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/var/glite} + mkdir -p $GLITE_LOCATION_VAR # Needed to store PID of LB server + + chown $GLITE_USER:$GLITE_USER $GLITE_LOCATION_VAR + chmod 0755 $GLITE_LOCATION_VAR + + mkdir -p $GLITE_USER_HOME/.certs + chown $GLITE_USER:$GLITE_USER $GLITE_USER_HOME/.certs + chmod 0755 $GLITE_USER_HOME/.certs + cp -f /etc/grid-security/hostcert.pem /etc/grid-security/hostkey.pem $GLITE_USER_HOME/.certs/ + if [ ! $? = 0 ] ; then + echo "Please copy host certificate and key into /etc/grid-security and" + echo " $GLITE_USER_HOME/.certs/, change the owner of the ones in" + echo " $GLITE_USER_HOME/.certs/ to $GLITE_USER" + fi + chown $GLITE_USER:$GLITE_USER $GLITE_USER_HOME/.certs/hostcert.pem $GLITE_USER_HOME/.certs/hostkey.pem + chmod 0644 $GLITE_USER_HOME/.certs/hostcert.pem + chmod 0400 $GLITE_USER_HOME/.certs/hostkey.pem + + # Create cron for purging + mkdir -p /var/log/glite + logfile=/var/log/glite/glite-lb-purger.log + cat << EOF > /etc/cron.d/glite-lb-purge.cron +HOME=/ +MAILTO=$SITE_EMAIL + +1 1 * * * $GLITE_USER . /opt/glite/etc/profile.d/grid-env.sh ; export GLITE_LB_EXPORT_BKSERVER=$HOSTNAME; export GLITE_LB_EXPORT_ENABLED=false; export GLITE_LB_EXPORT_PURGE_ARGS="--cleared 2d --aborted 15d --cancelled 15d --other 60d"; /opt/glite/sbin/glite-lb-export.sh >> $logfile 2>&1 +EOF + + touch $logfile + chown $GLITE_USER:$GLITE_USER $logfile + + cat > /etc/logrotate.d/lb-purger < /dev/null + if [ ! $? = 0 ] ; then + echo "${GLITE_LOCATION}/etc/init.d/glite-lb-bkserverd" >> ${GLITE_LOCATION}/etc/gLiteservices + fi + + touch ${GLITE_LOCATION}/etc/LB-super-users + + . /opt/glite/etc/profile.d/grid-env.sh + ${GLITE_LOCATION}/etc/init.d/glite-lb-bkserverd restart + + if [ ! $? = 0 ] ; then + yaimlog ABORT "Service glite-lb-bkserverd failed to start!" + return 1 + fi + + return 0 + +} diff --git a/org.glite.yaim.lb/config/node-info.d/glite-lb_30 b/org.glite.yaim.lb/config/node-info.d/glite-lb_30 index e5ee8b9..66f1087 100644 --- a/org.glite.yaim.lb/config/node-info.d/glite-lb_30 +++ b/org.glite.yaim.lb/config/node-info.d/glite-lb_30 @@ -8,7 +8,7 @@ config_rgma_client config_gip_only config_gip_lb config_globus_clients -config_glite_lb +config_glite_lb_30 config_glite_locallogger config_bdii config_glite_initd" -- 1.8.2.3