From 90c571f8f9458bebf42ded9a58e98665724087e1 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Fri, 4 Jul 2014 11:46:13 +0200 Subject: [PATCH 1/3] Ubuntu maxscale init script Ubuntu maxscale init script --- etc/ubuntu/init.d/maxscale | 145 +++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100755 etc/ubuntu/init.d/maxscale diff --git a/etc/ubuntu/init.d/maxscale b/etc/ubuntu/init.d/maxscale new file mode 100755 index 000000000..c81ffb475 --- /dev/null +++ b/etc/ubuntu/init.d/maxscale @@ -0,0 +1,145 @@ +#!/bin/sh +# +# maxscale: The SkySQL MaxScale database proxy +# +# description: MaxScale provides database specific proxy functionality +# +# processname: maxscale +# +### BEGIN INIT INFO +# Provides: maxscale +# Required-Start: $syslog $local_fs +# Required-Stop: $syslog $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: The maxscale database proxy +# Description: MaxScale is a database proxy server that can be used to front end +# database clusters offering different routing, filtering and protocol choices +### END INIT INFO + +############################################# +# MaxScale HOME, PIDFILE, LIB +############################################# + +export MAXSCALE_HOME=/usr/local/skysql/maxscale +export MAXSCALE_PIDFILE=$MAXSCALE_HOME/log/maxscale.pid +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MAXSCALE_HOME/lib + +############################### +# LSB Exit codes (non-Status) +############################### +_RETVAL_GENERIC=1 +_RETVAL_NOT_INSTALLED=5 +_RETVAL_NOT_RUNNING=7 + +############################### +# LSB Status action Exit codes +############################### +_RETVAL_STATUS_OK=0 +_RETVAL_STATUS_NOT_RUNNING=3 + +# Sanity checks. +[ -x $MAXSCALE_HOME/bin/maxscale ] || exit $_RETVAL_NOT_INSTALLED + +################################# +# stop/start/status related vars +################################# +NAME=maxscale +DAEMON=$MAXSCALE_HOME/bin/maxscale + +# Source function library. +. /lib/lsb/init-functions + +# we can rearrange this easily +processname=maxscale +servicename=maxscale + +RETVAL=0 + +start() { + log_daemon_msg "Starting MaxScale" + start_daemon -p $MAXSCALE_PIDFILE $DAEMON 2> /dev/null + + sleep 2 + + status_of_proc -p $MAXSCALE_PIDFILE $DAEMON $NAME + + log_end_msg $? +} + +stop() { + log_daemon_msg "Stopping MaxScale" + killproc -p $PIDFILE $DAEMON 2>&1 /dev/null + + maxscale_wait_stop + + log_end_msg $? +} + +reload() { + log_daemon_msg "Reloading MaxScale" + + killproc -p $MAXSCALE_PIDFILE $DAEMON 1 + + log_end_msg $? +} + +maxscale_wait_stop() { + PIDTMP=$(pidofproc -p $MAXSCALE_PIDFILE $MAXSCALE_HOME/bin/maxscale) + kill -TERM "${PIDTMP:-}" 2> /dev/null; + if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then + local i=0 + while kill -0 "${PIDTMP:-}" 2> /dev/null; do + if [ $i = '60' ]; then + break + STATUS=2 + fi + [ "$VERBOSE" != no ] && log_progress_msg "." + sleep 1 + i=$(($i+1)) + done + return $STATUS + else + return $STATUS + fi +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + # return 0 on success + # return 3 on any error + + log_daemon_msg "Checking MaxScale" + status_of_proc -p $MAXSCALE_PIDFILE $DAEMON $NAME + RETVAL=$? + + if [ $RETVAL -ne 0 ]; then + [ $RETVAL -eq 1 ] + + RETVAL=$_RETVAL_STATUS_NOT_RUNNING + else + RETVAL=$_RETVAL_STATUS_OK + fi + + log_end_msg $RETVAL + ;; + restart) + stop + start + ;; + reload) + reload + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload}" + ;; +esac +exit $RETVAL From 3052f6c3087f31007934f6b71536f5b98dac891c Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Fri, 4 Jul 2014 11:47:41 +0200 Subject: [PATCH 2/3] Directory deleted Directory deleted --- etc/ubuntu/init.d/maxscale | 145 ------------------------------------- 1 file changed, 145 deletions(-) delete mode 100755 etc/ubuntu/init.d/maxscale diff --git a/etc/ubuntu/init.d/maxscale b/etc/ubuntu/init.d/maxscale deleted file mode 100755 index c81ffb475..000000000 --- a/etc/ubuntu/init.d/maxscale +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/sh -# -# maxscale: The SkySQL MaxScale database proxy -# -# description: MaxScale provides database specific proxy functionality -# -# processname: maxscale -# -### BEGIN INIT INFO -# Provides: maxscale -# Required-Start: $syslog $local_fs -# Required-Stop: $syslog $local_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: The maxscale database proxy -# Description: MaxScale is a database proxy server that can be used to front end -# database clusters offering different routing, filtering and protocol choices -### END INIT INFO - -############################################# -# MaxScale HOME, PIDFILE, LIB -############################################# - -export MAXSCALE_HOME=/usr/local/skysql/maxscale -export MAXSCALE_PIDFILE=$MAXSCALE_HOME/log/maxscale.pid -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MAXSCALE_HOME/lib - -############################### -# LSB Exit codes (non-Status) -############################### -_RETVAL_GENERIC=1 -_RETVAL_NOT_INSTALLED=5 -_RETVAL_NOT_RUNNING=7 - -############################### -# LSB Status action Exit codes -############################### -_RETVAL_STATUS_OK=0 -_RETVAL_STATUS_NOT_RUNNING=3 - -# Sanity checks. -[ -x $MAXSCALE_HOME/bin/maxscale ] || exit $_RETVAL_NOT_INSTALLED - -################################# -# stop/start/status related vars -################################# -NAME=maxscale -DAEMON=$MAXSCALE_HOME/bin/maxscale - -# Source function library. -. /lib/lsb/init-functions - -# we can rearrange this easily -processname=maxscale -servicename=maxscale - -RETVAL=0 - -start() { - log_daemon_msg "Starting MaxScale" - start_daemon -p $MAXSCALE_PIDFILE $DAEMON 2> /dev/null - - sleep 2 - - status_of_proc -p $MAXSCALE_PIDFILE $DAEMON $NAME - - log_end_msg $? -} - -stop() { - log_daemon_msg "Stopping MaxScale" - killproc -p $PIDFILE $DAEMON 2>&1 /dev/null - - maxscale_wait_stop - - log_end_msg $? -} - -reload() { - log_daemon_msg "Reloading MaxScale" - - killproc -p $MAXSCALE_PIDFILE $DAEMON 1 - - log_end_msg $? -} - -maxscale_wait_stop() { - PIDTMP=$(pidofproc -p $MAXSCALE_PIDFILE $MAXSCALE_HOME/bin/maxscale) - kill -TERM "${PIDTMP:-}" 2> /dev/null; - if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then - local i=0 - while kill -0 "${PIDTMP:-}" 2> /dev/null; do - if [ $i = '60' ]; then - break - STATUS=2 - fi - [ "$VERBOSE" != no ] && log_progress_msg "." - sleep 1 - i=$(($i+1)) - done - return $STATUS - else - return $STATUS - fi -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - # return 0 on success - # return 3 on any error - - log_daemon_msg "Checking MaxScale" - status_of_proc -p $MAXSCALE_PIDFILE $DAEMON $NAME - RETVAL=$? - - if [ $RETVAL -ne 0 ]; then - [ $RETVAL -eq 1 ] - - RETVAL=$_RETVAL_STATUS_NOT_RUNNING - else - RETVAL=$_RETVAL_STATUS_OK - fi - - log_end_msg $RETVAL - ;; - restart) - stop - start - ;; - reload) - reload - RETVAL=$? - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|reload}" - ;; -esac -exit $RETVAL From 3f4e67ccca7c67b5cf212503e3397d6da4f28249 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Tue, 29 Jul 2014 16:46:39 +0200 Subject: [PATCH 3/3] Changed value for SERVER_SLAVE_OF_EXTERNAL_MASTER Changed SERVER_SLAVE_OF_EXTERNAL_MASTER value to 0x0080 (128) --- server/include/server.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/include/server.h b/server/include/server.h index fdcc32e80..e747c298d 100644 --- a/server/include/server.h +++ b/server/include/server.h @@ -100,7 +100,7 @@ typedef struct server { #define SERVER_SLAVE 0x0004 /**<< The server is a slave, i.e. can handle reads */ #define SERVER_JOINED 0x0008 /**<< The server is joined in a Galera cluster */ #define SERVER_MAINT 0x1000 /**<< Server is in maintenance mode */ -#define SERVER_SLAVE_OF_EXTERNAL_MASTER 0x0016 /**<< Server is slave of a Master outside the provided replication topology */ +#define SERVER_SLAVE_OF_EXTERNAL_MASTER 0x0080 /**<< Server is slave of a Master outside the provided replication topology */ /** * Is the server running - the macro returns true if the server is marked as running