Shared unix socket between ve

atuin

Renowned Member
Jun 9, 2009
21
0
66
www.geco-it.fr
Hi,

We want Isolated MySQL Installation inside OpenVZ Cluster by shared mysql socket
view http://sudhaker.com/linux-unix/openvz/isolated-mysql-installation-openvz-cluster.html

Unfortunately, it seems there is a problem with openvz kernels, preventing this to work.

when we try to connect to mysql on other ve
=> ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/shared/mysql/mysql.sock' (111)

view patch
http://git.openvz.org/?p=linux-2.6.26-openvz;a=commit;h=89451f9b7cf93d3c71cdb201c624244eb49f1223
http://git.openvz.org/?p=linux-2.6.24-openvz;a=commit;h=8caa941fe7be3a18d8b88b8f38ac9497e5fb2fb2

can you include this on your kernel

Many thanks
cyril
 
Hi,

I guess using TCP networking would be a non-optimal workaround.

MySQL Manual says :

"A MySQL client on Unix can connect to the mysqld server in two different ways: By using a Unix socket file to connect through a file in the filesystem (default /tmp/mysql.sock), or by using TCP/IP, which connects through a port number. A Unix socket file connection is faster than TCP/IP, but can be used only when connecting to a server on the same computer. A Unix socket file is used if you don't specify a hostname or if you specify the special hostname localhost."

For mysql configuration ; skip networking or localhost only => no iptables or tcp wrapper rules

And just for fun !!


We recompile the kernel starting from your sources
We changed in the Makefile:

Code:
${KERNEL_SRC}/README: ${KERNEL_SRC}.org/README
        rm -rf ${KERNEL_SRC}
        cp -av ${KERNEL_SRC}.org ${KERNEL_SRC}
        ./applypatches.pl ${KERNEL_SRC}
        sed -i ${KERNEL_SRC}/Makefile -e 's/^EXTRAVERSION.*$$/EXTRAVERSION=${EXTRAVERSION}/'
        cd ${KERNEL_SRC}; patch -p 1 <../${BOOTSPLASH_PATCH}
        cd ${KERNEL_SRC}; patch -p 1 <../bridge-patch.diff
        touch $@
by:

Code:
${KERNEL_SRC}/README: ${KERNEL_SRC}.org/README
        chattr -i ${KERNEL_SRC}/net/unix/af_unix.c
        rm -rf ${KERNEL_SRC}
        cp -av ${KERNEL_SRC}.org ${KERNEL_SRC}
        ./applypatches.pl ${KERNEL_SRC}
        sed -i ${KERNEL_SRC}/Makefile -e 's/^EXTRAVERSION.*$$/EXTRAVERSION=${EXTRAVERSION}/'
        cd ${KERNEL_SRC}; patch -p 1 <../${BOOTSPLASH_PATCH}
        cd ${KERNEL_SRC}; patch -p 1 <../bridge-patch.diff
        cd ${KERNEL_SRC}; patch -p 1 <../../cross_ve_unixsocket.diff
        cd ${KERNEL_SRC}; chattr +i net/unix/af_unix.c
        patch -p 1 <../../kvm_mv_qemu.1.patch
        touch $@
We had to make the file immutable af_unix.c as it was amended during the compilation ???

All runs very well

Sorry fo my bad english ...
Cyril
 

Attachments

  • cross_ve_unixsocket.diff.txt
    516 bytes · Views: 7
I guess using TCP networking would be a non-optimal workaround.

MySQL Manual says :

"A MySQL client on Unix can connect to the mysqld server in two different ways: By using a Unix socket file to connect through a file in the filesystem (default /tmp/mysql.sock), or by using TCP/IP, which connects through a port number. A Unix socket file connection is faster than TCP/IP, but can be used only when connecting to a server on the same computer. A Unix socket file is used if you don't specify a hostname or if you specify the special hostname localhost."

So why is it non-optimal? Is performance really that worse? The shared socket is non-optimal because you loose connection each time the VM restarts?
 
Hi,

Dont run

We had to make the file immutable af_unix.c as it was amended during the compilation ???

I do not know why, but works very well with our kernel compiled with chattr command

We had in makefile :

Code:
${KERNEL_SRC}/README: ${KERNEL_SRC}.org/README
        [B]chattr -i ${KERNEL_SRC}/net/unix/af_unix.c[/B]
        rm -rf ${KERNEL_SRC}
        cp -av ${KERNEL_SRC}.org ${KERNEL_SRC}
        ./applypatches.pl ${KERNEL_SRC}
        sed -i ${KERNEL_SRC}/Makefile -e 's/^EXTRAVERSION.*$$/EXTRAVERSION=${EXTRAVERSION}/'
        cd ${KERNEL_SRC}; patch -p 1 <../${BOOTSPLASH_PATCH}
        cd ${KERNEL_SRC}; patch -p 1 <../bridge-patch.diff
        cd ${KERNEL_SRC}; patch -p 1 <../../cross_ve_unixsocket.diff
       [B] cd ${KERNEL_SRC}; chattr +i net/unix/af_unix.c[/B]
        touch $@
 
Hi,

I do not know why but without chattr command,
once the compilation is complete

diff linux-2.6.24-openvz.org/net/unix/af_unix.c linux-2.6.24-openvz/net/unix/af_unix.c

are completely different but the patch cross_ve_unixsocket.diff is not applied.

So I think the bug in http://www.proxmox.com/forum/showthread.php?t=1931 has nothing to do because the patch is not applied
 

Attachments

  • af_unix.c.diff.txt
    6.8 KB · Views: 4
diff linux-2.6.24-openvz.org/net/unix/af_unix.c linux-2.6.24-openvz/net/unix/af_unix.c

are completely different but the patch cross_ve_unixsocket.diff is not applied.

You compare different things!

linux-2.6.24-openvz.org/net/unix/af_unix.c (original)
linux-2.6.24-openvz/net/unix/af_unix.c (patched files)

The patch is applied to
linux-2.6.24-openvz/net/unix/af_unix.c, and that file does not change.

- Dietmar
 
You compare different things!

linux-2.6.24-openvz.org/net/unix/af_unix.c (original)
linux-2.6.24-openvz/net/unix/af_unix.c (patched files)

The patch is applied to
linux-2.6.24-openvz/net/unix/af_unix.c, and that file does not change.

- Dietmar

Yes so why in linux-2.6.24-openvz/net/unix/af_unix.c file the patch
are not applied ? and the file is completely different from original
linux-2.6.24-openvz.org/net/unix/af_unix.c after compilation
 
Yes so why in linux-2.6.24-openvz/net/unix/af_unix.c file the patch
are not applied ?

Why do you ask me? Here, everything works a expected.

and the file is completely different from original
linux-2.6.24-openvz.org/net/unix/af_unix.c after compilation

because we apply about 200 openvz patches (see makefile)

- Dietmar
 
So, I hope i found the error

The patch file 0001-2.6.24-ovz002.patch
(PVE_SRC/linux-2.6.24-openvz.org/debian/binary-custom.d/openvz/patchset/)

add this lines
if (s->sk_net != net)
continue;

in fonction static struct sock *__unix_find_socket_byname ()

Can you test if the bug (http://www.proxmox.com/forum/showthread.php?t=1931) is solved with this new patch ?

Cyril
 

Attachments

  • cross_ve_unixsocket_new.diff.txt
    852 bytes · Views: 3

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!