XtraDB cluster does not properly detect bonded network interfaces
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MySQL patches by Codership |
Incomplete
|
Undecided
|
Unassigned | ||
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC |
Expired
|
Undecided
|
Unassigned |
Bug Description
when using bonded network interfaces:
WSREP: Failed to read output of: '/sbin/ifconfig | grep -m1 -1 -E '^[a-z]?eth[0-9]' | tail -n 1 | awk '{ print $2 }' | awk -F : '{ print $2 }''
[Warning] WSREP: Failed to autoguess base node address
[Note] WSREP: Service disconnected.
[Note] WSREP: Some threads may fail to exit.
This might work better and should be interface type agnostic:
ping -i 1 -c 1 $(hostname) | grep -m1 -1 -E '\([0-9.]+{4}\)' | awk '{ print $3 }' | sed 's/[()]//g' | grep -v '127.0.0.1'
There should also probably be an option to set the preferred IP via an environment variable before installing the RPM. It may be the case that multiple interfaces exist, and the administrator prefers to use a particular interface (not just the first one from the list, or the one associated with the hostname). For unattended installations, setting the interface automatically may not work.
Changed in percona-xtradb-cluster: | |
status: | New → Incomplete |
I think pinging $(hostname) is not a good solution either, because it also relies on something that does not have to exist (e.g. hostname may not resolve into anything). The following command finds all non-local IP addresses associated with network interfaces.
/sbin/ifconfig | sed -e '/./{H; $!d};x; /LOOPBACK/ d;/inet addr:.\+ UP [ A-Z]\+RUNNING/ !d;s/.* inet addr:\( [0-9.]\ +\).*/\ 1/'
'| head -1' can be appended to automatically choose the first IP address. However as ifconfig is begin deprecated, it might be a good idea to use /sbin/ip instead.