Tips learnt in Mysql HA classes
Posted on May 22, 2008 by Vide
Replication
- the
--read-onlyswitch (orread_onlyin my.cnf) it’s the best way to block unwanted writes in a replication slave. So, ditch your specific user’s privileges :) EDIT: this only applies to Mysql > 5.1.15 log-slave-updatesin my.cnf needs underscores _ because with normal dashes doesn’t work at all (at least with Mysql 5.1.22). So, it’slog_slave_updates- Talking about
log_slave_updatesagain, it’s fundamental if you’re mounting a circular replication system. Without it, replication will stop at first hop. SET GLOBAL SQL_SLAVE_SKIP_COUNTER=ncould be usefull if you have to skip on a replication error. Be careful anyway because it can lead to logical inconsistences in your data if abused.
Cluster
- When starting up data nodes using ndbd, you can add the
--nostartflag to have the process in memory without doing nothing. Then, you can tell the node to actually start working from the management console withID_node start. Moreover, you can put the nostart flag in your config.ini, in the[ndbd default]section, if you want the change to apply to every node. - in the management console, as said, you can start (or stop, or restart) the data nodes manually, but if you try with the SQL nodes, you’ll get a strange error. That’s because SQL nodes can only be restarted from the local machine, as it were a normal mysql installation (in fact, it is a normal mysql install :)
Mysql Proxy
- If you are trying to execute mysql-proxy with a LUA script, and you have the scripts tree in /usr/share/mysql-proxy, then you have to issue a command like this, otherways mysql-proxy will complain about LUA includes that cannot be found:
LUA_PATH=/usr/share/mysql-proxy/?.lua mysql-proxy --proxy-backend-addresses=192.168.45.112:3306 --proxy-lua-script=/usr/share/mysql-proxy/rw-splitting.lua