Skip to content

Instantly share code, notes, and snippets.

View dannysheehan's full-sized avatar

Danny Sheehan dannysheehan

View GitHub Profile
@dannysheehan
dannysheehan / gist:9107750
Created February 20, 2014 05:54
Create Gluster File system with 6 stripes and 2 replicas across 12 nodes
On every node in gluster. Turn /scratch disk into brick.
b01b01:~ # df -h /scratch
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 243G 6.8G 224G 3% /scratch
umount /scratch
mkfs.xfs -f -i size=512 /dev/sda5
@dannysheehan
dannysheehan / gist:9084174
Last active August 29, 2015 13:56
Find what countries your users are logging into your server from. Tested on SLES only and needs geoip-lookup to be installed on your server.
#!/bin/bash
grep "Accepted .* for " /var/log/messages | awk '{print $9, $11}' | egrep -v "nagios|bb|172\.|10\.|192\.168\." | sort | uniq | while read u
do
AUSER=`echo $u | awk '{print $1}'`
AIP=`echo $u | awk '{print $2}'`
COUNTRY=`geoip-lookup $AIP`
#echo $AUSER $COUNTRY $AIP
echo $AUSER $COUNTRY
done | sort | uniq -c | sort -n
@dannysheehan
dannysheehan / gist:9082958
Created February 18, 2014 23:40
Determine what processes are causing mystery load on a server
top -b -n 1 | awk '{if (NR <=7) print; else if ($8 == "D") {print; count++} } END {print "Total status D: "count}'
@dannysheehan
dannysheehan / gist:5794303
Created June 17, 2013 02:32
UFW application configuration for Galera MariaDB
[Galera]
title=Galera
description=Galera cluster. 'ufw allow from x.x.x.x to any app Galera' to add node x.x.xx to the cluster.
#
# 4567 - is the port other nodes will use to check if this node is synced
# and available to become a donor.
# 4568 - is used by snapshot state transfer (SST) i.e. copy of all data.
# 4444 - used by rsync.
# 3306 - the mysql port
#