Are you Bonding? If not you are missing out on some great features.
It would be pretty hard now days to find a server with a single network card, even some of the laptops have two network interfaces.
It would be pretty hard now days to find a server with a single network card, even some of the laptops have two network interfaces.
Most of the Linux distributions have build in capability for so-called "Channel Bonding". Channel bonding of "Bonded Interfaces" allow you to logically bond (or merge) two or more physical network cards into one logical interface.
Why would someone do that? Several reasons - HA (high availability) and improved performance. If you are using one network card and run your MySQL replication (or clustering) over it and that card dies you will loose your HA, as a mater of fact if you are not bonding, the network card is a single point failure in your HA deployment!
Bonding on the other hand prevents outages and as in case of clustering false failovers in case of network card failures. In many MYSQL HA solution such as DRBD and NDB you must use some type of bonding.
The real of beauty of bonding is that its so simple to configure. Here is how to do it:
cd
/etc/sysconfig/network-scripts/ "This is your network config ditectory"
Create new file for your new bonded network interface - will name it bond0
vi bond0
Add the following lines to the bond0 file:
DEVICE=bond0 IPADDR=192.168.1.20 NETWORK=192.168.1.0 NETMASK=255.255.255.0 USERCTL=no BOOTPROTO=none ONBOOT=yes
Next modify your physical network card configuration files eh0 and eth1
(assuming eth0 and eth1 are the names of your network cards)
vi eth0
DEVICE=eth0 USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes
BOOTPROTO=none
Notice above that we are making your network card
a "slave" of our bonded interface bond0
MASTER=bond0
SLAVE=yes
Perform the same for the second card eth1:
DEVICE=eth1 USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes
BOOTPROTO=none
Now we have to make sure that the bonding kernel module loads when we bring up the interface:
# vi /etc/modprobe.conf
options bond0 mode=balance-alb miimon=100
Now load the bonding module:
#modprobe bonding
Restart your network for the changes to take effect:
#service network restart
Simple as that.
Be sure to test your new bonded interface by shutting down on of the cards eth0 or
eth1 and making sure your MySQL replication is working.
We can view the /proc/net/bonding/bond0 to monitor the state of bonded interface;
#cat /proc/net/bonding/bond0
Bonding Mode: load balancing (round-robin) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 200 Down Delay (ms): 200 Slave Interface: eth0 MII Status: up Link Failure Count: 0 Permanent HW addr: 00:0c:29:c6:be:59 Slave Interface: eth1 MII Status: up Link Failure Count: 0 Permanent HW addr: 00:0c:29:c6:be:63
No comments:
Post a Comment