Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Shared webhosting

21 bytes added, 09:49, 11 March 2008
m
Robot: Automated text replacement (-VEs +containers)
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 containers between START_CTID and STOP_CTID and make sure that the links point to the correct socket. If they do not, the link will be recreated.
<pre>
###################################
# Location of private VEscontainers:
PRIVATE=/vz/private
mysql_inode=`ls -i ${MYSQL_SOCK_FILE} | awk '{ print $1;}'`
# Search through VEscontainers
cd $PRIVATE
for i in * ; do
2,253
edits