BzZzZ - ustvarjamo podobe logo
slovenščina
english
Using mysql socket in apache jail

Confining apache and mysql in separate jails creates interesting problem - how to make them communicate with each other. TCP works, but is much slower than using mysql socket - some measurements show up to 10 times difference. If you add current FreebSD syncache bug that causes packet drops in TCP, this becomes much needed option.

To be able to communicati trough unix sockets both jails must have access to the same directory. For start create required directories:

  • In parent system create subdirectory /usr/mysqltmp
  • In each jail create subdirectory /mysqltmp

Then merge those directories by using

  • mount_unionfs /usr/mysqltmp /pathtoapachejail/mysqltmp
  • mount_unionfs /usr/mysqltmp /pathtomysqljail/mysqltmp


NOTE: you would need freebsd version 7.2.for that as mount_unionfs is buggy in previous versions.

In the both jails open upd /var/db/my.cnf and change at both [client] and [server] parts:
socket = /mysqltmp/mysql.sock (server part is actually not needed in apache jail).

In apache jail also change php.ini mysql.default_socket setting from undefined to mysql.default_socket = /mysqltmp/mysql.sock - if you are using also mysqli change also the same setting there. If you are using php in mysql jail do the same there.

 
  • strateško usmerjeno
  • integrirano
  • s kreativnostjo pospešeno
  • učinkovito komuniciranje
© BzZzZ 2008
stik z nami    zaposlitev    kazalo strani