It appears bonding balance to a IPv4 address fails on our Ubuntu Feisty host. Details below:-
FAILS with IPv4 to localhost
"""
root@myhost:~# /usr/sbin/balance -f -d -a -b 127.0.0.1 3306 192.168.3.100:3306 % 192.168.3.101:3306
argv[0]=/usr/sbin/balance
bindhost=127.0.0.1
source port 3333
file /var/run/balance/balance.3333.127.0.0.1 created
setsockopt(IPV6_V6ONLY=0): Protocol not available
"""
FAILS with IPv4 to interface address
"""
root@myhost:~# /usr/sbin/balance -f -d -a -b 192.168.3.20 3306 192.168.3.100:3306 % 192.168.3.101:3306
argv[0]=/usr/sbin/balance
bindhost=192.168.3.20
source port 3333
file /var/run/balance/balance.3333.192.168.3.20 created
setsockopt(IPV6_V6ONLY=0): Protocol not available
"""
SUCCESS with IPv6 to localhost
"""
root@myhost:~# /usr/sbin/balance -f -d -a -b ::1 3306 192.168.3.100:3306 % 192.168.3.101:3306
argv[0]=/usr/sbin/balance
bindhost=::1
source port 3333
file /var/run/balance/balance.3333.::1 created
the following channels are active:
0 0 192.168.3.100:3306:0
1 0 192.168.3.101:3306:0
"""
SUCCESS with IPv4 to 0.0.0.0
"""
root@myhost:~# /usr/sbin/balance -d -f -a 3333 192.168.3.100:3306 % 192.168.3.101:3306
argv[0]=/usr/sbin/balance
bindhost=NULL
source port 3333
file /var/run/balance/balance.3333.0.0.0.0 created
the following channels are active:
0 0 192.168.3.100:3306:0
1 0 192.168.3.101:3306:0
"""
UNAME
"""
root@myhost:/var/run/balance# uname -a
Linux myhost 2.6.20-16-generic #2 SMP Sun Sep 23 18:31:23 UTC 2007 x86_64 GNU/Linux
"""
VERSION
"""
root@myhost:~# /usr/sbin/balance
_ _
| |__ __ _| | __ _ _ __ ___ ___
| '_ \ / _` | |/ _` | '_ \ / __/ _ \
| |_) | (_| | | (_| | | | | (_| __/
|_.__/ \__,_|_|\__,_|_| |_|\___\___|
this is balance 3.40
Copyright (c) 2000-2006,2007
by Inlab Software GmbH, Gruenwald, Germany.
All rights reserved.
"""
Logged In: NO
I solved this by simply commenting out the following part in balance.h:
sockoptoff = 0;
status = setsockopt(srv_socket, IPPROTO_IPV6, IPV6_V6ONLY, (char*) &sockopt$
if(status < 0) {
perror("setsockopt(IPV6_V6ONLY=0)");
exit(EX_OSERR);
}
and then recompiling. I have not had any trouble with this until now.
This can also be solved by using 'localhost' instead of '127.0.0.1', like so:
$ balance -b localhost 9200 192.168.1.18:9200 192.168.1.22:9200