Changes

Jump to: navigation, search

Shared webhosting

No change in size, 09:43, 11 March 2008
m
Robot: Automated text replacement (-VEID +CTID)
Sharing the MySQL socket works really well until the MySQL database is restarted or the VE running MySQL is restarted. When this happens, the socket file is removed and recreated. In most cases, a different inode will be used, causing existing hard links to the mysql.sock file to no longer work. The solution is to relink these sockets.
There are more elegant solutions to this problem, but the following script is a decent hack that can be run via a cron job every minute or two. It will loop through all VEs between START_VEID START_CTID and STOP_VEID STOP_CTID and make sure that the links point to the correct socket. If they do not, the link will be recreated.
<pre>
PRIVATE=/vz/private
# Starting CT ID. VEIDs CTIDs with this ID or greater will have mysql.sock link createdSTART_VEIDSTART_CTID=1001
# Stopping CT ID. VEIDs CTIDs with this ID or less will have mysql.sock link createdSTOP_VEIDSTOP_CTID=2000
# Shared Mysql CT ID:
MYSQL_VEIDMYSQL_CTID=201
# Location of mysql socket file
# Full path to socket
MYSQL_SOCK_FILE=${PRIVATE}/${MYSQL_VEIDMYSQL_CTID}${MYSQL_SOCK_DIR}/${MYSQL_SOCK}
[ $QUIET -eq 0 ] && echo
# Check if VE should be processed
if [ $veid -ne $MYSQL_VEID MYSQL_CTID -a $veid -ge $START_VEID START_CTID -a $veid -le $STOP_VEID STOP_CTID ]; then
# Get this VE's socket
2,253
edits

Navigation menu