DRBD split-brain solution in primary/primary setup

Recently one of our customers DRBD cluster has detected split-brain: node2 kernel: block drbd1: Split-Brain detected, dropping connection! node2 kernel: block drbd1: helper command: /sbin/drbdadm split-brain minor-1 node2 kernel: block drbd1: helper command: /sbin/drbdadm split-brain minor-1 exit code 0 (0x0) This is  primary/primary cluster. And to fix this issue we had to perform manual procedures…

Python: how to get list of listen sockets in Linux

Here is an example of Python code to get listen socket from Python: def listen_sockets(): listens = [] lines = open(“/proc/net/tcp”).readlines() for l in lines: ls = l.split() if ls[3] == ‘0A’: lp = ls[1].split(‘:’) ip = str(lp[0]) pair = “%s.%s.%s.%s:%s” %( int(ip[6:8], 16), int(ip[4:6], 16), int(ip[2:4], 16), int(ip[0:2], 16), int(lp[1], 16)) listens.append(str(pair)) return listenslistens…

How to block huge amount of IP addresses with use of ipset in Fedora 14

Sometime you need to block really big numbers of IP addresses. It could be for different reasons. For example, in case of password bruteforce, DDoS attack. Of course, you can block them just in iptables. But there can be a problem. If set of IP addresses contain thousands of items iptables performance decreases (actually, performance…