# HG changeset patch
# User Marian Marinov <[email protected]>
# Date 1268267087 -7200
# Branch mysql-ms
# Node ID cacb3e119fd9da6a7ea3c9f1d2d4f19d8e5b3bf6
# Parent 31ea5ae9c8e773edb89648cf482907ff3028d456
Low: RA: mysql: Set readonly
When starting the server, always make sure that the server is running in read
only mode.
I'm using the read_only global variable to achive this.
I set the read_only variable in mysql_start,mysql_promote and mysql_demote.
Only in mysql_promote read_only is set to off.
diff -r 31ea5ae9c8e7 -r cacb3e119fd9 heartbeat/mysql
--- a/heartbeat/mysql Thu Mar 11 02:20:46 2010 +0200
+++ b/heartbeat/mysql Thu Mar 11 02:24:47 2010 +0200
@@ -512,6 +512,8 @@
fi
sleep 2
done
+
+ mysql -S $OCF_RESKEY_socket -O connect_timeout=1 -e 'SET GLOBAL
read_only=on';
ocf_log info "MySQL started"
return $OCF_SUCCESS
@@ -569,6 +571,7 @@
if is_slave; then
mysql --socket=$OCF_RESKEY_socket -O connect_timeout=1 -e 'STOP
SLAVE'
fi
+ mysql -S $OCF_RESKEY_socket -O connect_timeout=1 -e 'SET GLOBAL
read_only=off';
return $OCF_SUCCESS
}
@@ -633,6 +636,7 @@
MASTER_CONNECT_RETRY=4"
mysql --socket=$OCF_RESKEY_socket -O connect_timeout=1 -e
'START SLAVE';
fi
+ mysql -S $OCF_RESKEY_socket -O connect_timeout=1 -e 'SET GLOBAL
read_only=on';
if is_slave 1; then
return $OCF_SUCCESS
else
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/