Friday, 14 March 2014

NTP the *#x+ does that mean?

Linux command ntpq should have defined it's columns within a man page but left it to the Internet to remember, so this page is dedicated to me staying sane:

The character in front of server hostnames from ntpq -p
" " Unresponsive peer, high stratum, Local
* The peer currently being used for time sync
# Fail over peers ready to take over in case one of the first six + peers fail
o Good peer using PPS
+ Good peer and has been included in the final set
Out of threshold, usage discarded
x Out of threshold, usage discarded

refid - how does the remote peer sync time? Popular options:

LOCL - This local host
GPS - GPS satellites, atomic clock source
PPS - Pulses Per Second, mostly from applicable GPS receivers
CDMA - Mobile phone networks using CDMA

st column - stratum of the remote peer

t column:
l = local time source
u = unicast (almost always this is true)
m = multicast
b = broadcast

when - last polled, default in seconds (h - hours, d - days)
poll – how often to poll peer
reach – 8-bit left-shift register - 377 for a perfect peer, 0 for a useless one
delay – Round trip time in milliseconds
offset – The difference for this peer between the local time and the weighted average of our set of peers
jitter – The variance in latency on the network to peer

Hope the above helps someone!

Wednesday, 5 March 2014

Load balancing interfaces on Debian/Centos using round Robin

Nothing like holding a IBM server worth more than your car in your hands (and thinking - do not drop it repeatedly... :-)

So basically we have two of these awesome servers ready for action, ample network ports, and a need to communicate directly with each other... which leaves only one geek option :-) - lets bond those free interfaces and kick some ass and speed and failover wise!

I know you can define the following in config files but with one server in production mode I couldn't afford a network restart going wrong (additionally I'm 50KM away from the facility in Johannesburg).

Instead I opted for the command route and adding them to /etc/rc.local in the rare event a server reboots. The commands (I was using eth2/eth3 so it may need tweaking for re-use).

If you experience any issues with more than 2 ports it may require a change to ALB mode (balance-alb) which load balances transceived frames using a MAC change method.

Application Server - Centos - installed by default?:
modprobe bonding mode=balance-rr miimon=100
ifconfig bond0 netmask up
ifenslave bond0 eth2
ifenslave bond0 eth3

Database Server - Debian - package: ifenslave-2.6:
modprobe bonding mode=balance-rr miimon=100
ifconfig bond0 netmask up
ifenslave bond0 eth2
ifenslave bond0 eth3
ip a add dev eth1
ip link set up dev eth1

The results:

[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  2.13 GBytes  1.83 Gbits/sec