Configuration of MySQL server in separated file (savannah task #20340).
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Fri, 27 Jan 2012 14:43:13 +0000 (14:43 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Fri, 27 Jan 2012 14:43:13 +0000 (14:43 +0000)
org.glite.lb.server/Makefile
org.glite.lb.server/config/my.cnf [new file with mode: 0644]
org.glite.lb.yaim/config/functions/config_glite_lb.in

index 7a1c00f..ad52f92 100644 (file)
@@ -353,6 +353,7 @@ install:
        -mkdir -p ${DESTDIR}${PREFIX}${prefix}/include/${globalprefix}/${lbprefix}
        -mkdir -p ${DESTDIR}${PREFIX}${sysconfdir}/logrotate.d
        -mkdir -p ${DESTDIR}${PREFIX}${sysconfdir}/cron.d
+       -mkdir -p ${DESTDIR}${PREFIX}${sysconfdir}/mysql/conf.d
        ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${DESTDIR}${PREFIX}${prefix}/share/doc/${package}-${version}
        ( cd ${top_srcdir}/project && ${INSTALL} -m 644 ChangeLog package.description package.summary ${DESTDIR}${PREFIX}${prefix}/share/doc/${package}-${version} )
        ${INSTALL} -m 644 ${MAN_GZ} ${DESTDIR}${PREFIX}${prefix}/share/man/man1
@@ -377,6 +378,7 @@ install:
        ${INSTALL} -m 644 glite-lb-notif-keeper.cron ${DESTDIR}${PREFIX}${sysconfdir}/cron.d/glite-lb-notif-keeper
        ${INSTALL} -m 644 ${top_srcdir}/config/glite-lb-purge.logrotate ${DESTDIR}${PREFIX}${sysconfdir}/logrotate.d/glite-lb-purge
        ${INSTALL} -m 644 ${top_srcdir}/config/glite-lb-lcas.logrotate ${DESTDIR}${PREFIX}${sysconfdir}/logrotate.d/glite-lb-lcas
+       ${INSTALL} -m 644 ${top_srcdir}/config/my.cnf ${DESTDIR}${PREFIX}${sysconfdir}/etc/mysql/conf.d/glite-lb-server.cnf
 
        mkdir -p ${DESTDIR}${PREFIX}${prefix}/include/${globalprefix}/${lbprefix}
        (cd ${top_srcdir}/interface && install -m 644 ${HDRS} ${DESTDIR}${PREFIX}${prefix}/include/${globalprefix}/${lbprefix})
diff --git a/org.glite.lb.server/config/my.cnf b/org.glite.lb.server/config/my.cnf
new file mode 100644 (file)
index 0000000..dcd0c1e
--- /dev/null
@@ -0,0 +1,23 @@
+#
+# MySQL options for Logging and Bookkeeping.
+#
+# For performance tuning, see L&B Administration Guide, section
+# "2.3.17 Tuning Database Engine".
+#
+
+[mysqld]
+skip-networking
+max_allowed_packet = 17M
+
+#innodb_data_home_dir = /var/lib/mysql
+#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
+#innodb_log_group_home_dir = /var/lib/mysql
+# You can set .._buffer_pool_size up to 50 - 80 %
+# of RAM but beware of setting memory usage too high
+#innodb_buffer_pool_size = 384M
+#innodb_additional_mem_pool_size = 20M
+# Set .._log_file_size to 25 % of buffer pool size
+#innodb_log_file_size = 100M
+#innodb_log_buffer_size = 8M
+#innodb_flush_log_at_trx_commit = 1
+#innodb_lock_wait_timeout = 50
index 6701b12..cb65dca 100644 (file)
@@ -198,36 +198,22 @@ function config_glite_lb() {
   chmod og+rx /var/lib/mysql/ 
   chown mysql:mysql /var/run/mysqld/
 
-  # 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
+  # include MySQL options for L&B server
+  my_cnf=/etc/mysql/my.cnf
+  if [ ! -f "$my_cnf" ]; then
+    my_cnf=/etc/my.cnf
   fi
-
-  # disable network, restart mysql, if needd
-  grep "skip-networking" /etc/my.cnf > /dev/null
-  if [ ! $? = 0 ]; then
-    mv /etc/my.cnf /etc/my.cnf.orig
-    sed 's/\[mysqld\]/[mysqld]\nskip-networking/' /etc/my.cnf.orig > /etc/my.cnf
-    rm -f /etc/my.cnf.orig
-    ps ax | grep -v grep |grep mysqld_safe > /dev/null 2>&1
-    if [ $? = 0 ] ; then
-      /etc/init.d/mysqld stop
-    fi
+  grep '^!includedir\s\+/etc/mysql/conf.d/?' "$my_cnf" >/dev/null 2>&1
+  if [ $? != 0 ]; then
+    echo '!includedir /etc/mysql/conf.d/' >> "$my_cnf"
   fi
 
-  /sbin/chkconfig mysqld on
-  ps ax | grep -v grep |grep mysqld_safe > /dev/null 2>&1
-  if [ ! $? = 0 ] ; then
-    /etc/init.d/mysqld start
-    sleep 1
-  fi 
+  if [ -x /sbin/service ]; then
+    /sbin/chkconfig mysqld on
+    /sbin/service mysqld restart
+  else
+    /etc/init.d/mysql restart
+  fi
 
   ls /tmp/mysql.sock > /dev/null 2>&1
   if [ ! $? = 0 ]; then