Skip to content

Instantly share code, notes, and snippets.

View tobert's full-sized avatar
💭
🏳️‍🌈 💻 🏳️‍🌈

Amy Tobey tobert

💭
🏳️‍🌈 💻 🏳️‍🌈
View GitHub Profile
@tobert
tobert / start-lxc-cluster.sh
Created August 29, 2011 04:54
instant lxc cluster
#!/bin/bash
COUNT=10
BRIDGE="br1"
FORMAT="lxc%d"
PARENT=$(hostname --fqdn)
LXC_ROOT=/srv/virt/lxc
OS_ROOT=/srv/virt/lxc/base/root
for num in $(seq 1 $COUNT)
@tobert
tobert / p2v-me.sh
Created September 1, 2011 21:37
example p2v
#!/bin/bash
vmname=$(hostname --fqdn)
mkdir -p /p2v-nfs /p2v-new
mount -t nfs 192.168.1.9:/incoming /p2v-nfs
dd if=/dev/zero of=/mnt/p2v/$vmname-root.img bs=11 skip=20G count=1
mount -o loop /p2v-nfs/$vmname-root.img /p2v-new
@tobert
tobert / jmxtrans-hadoop-namenode.json
Created September 6, 2011 00:11
JMXTrans config for Hadoop Namenodes & Graphite
{
"servers" : [
{
"port" : "NAMENODE_JMX_PORT",
"host" : "NAMENODE",
"numQueryThreads" : 8,
"queries" : [
{
"outputWriters" : [
{
@tobert
tobert / al-devbox-dstat.txt
Created September 6, 2011 06:36
I love the smell of forkbomb in the morning.
1m 5m 15m | read writ|run blk new| used buff cach free| in out | read writ| int csw |usr sys idl wai hiq siq| recv send
44.2 44.2 44.4| 0 7.90 | 48 0 40|3441M 52.0M 304M 4376M| 0 0 | 0 286k|1291 3470 | 88 12 0 0 0 0| 203k 7251B
44.3 44.2 44.4|0.70 11.3 | 46 0 55|3265M 52.0M 325M 4530M| 19k 0 | 19k 272k|1844 3367 | 85 15 0 0 0 0|2226k 36k
44.1 44.2 44.4| 0 2.30 | 46 0 50|3415M 52.0M 352M 4353M| 0 0 | 0 26k|1804 3166 | 85 15 0 0 0 0|2764k 30k
44.6 44.3 44.4| 0 23.9 | 48 0.1 50|3439M 52.0M 350M 4332M| 0 0 | 0 951k|2113 3373 | 85 14 0 0 0 1|5052k 398k
44.4 44.3 44.4|0.10 205 | 45 0.1 53|3402M 52.1M 383M 4336M| 0 0 | 410B 8166k|2162 3718 | 84 15 0 0 0 1|3612k 1202k
44.9 44.4 44.4| 0 0.80 | 48 0 38|3398M 52.1M 308M 4414M| 0 0 | 0 16k|2204 3522 | 85 14 0 0 0 1|4986k 70k
45.4 44.5 44.4| 0 61.4 | 45 0.1 50|3348M 52.1M 376M 4397M| 0 0 | 0
# a fragment ...
echo "Creating $LXC_DIR/lxc.conf ..."
cat > $LXC_DIR/lxc.conf <<EOF
lxc.utsname = $LXC_UTSNAME
lxc.rootfs = $LXC_ROOTFS
lxc.cgroup.cpuset.cpus = 0,1
lxc.cgroup.cpu.shares = 500
lxc.mount.entry=none proc proc nodev,noexec,nosuid 0 0
lxc.mount.entry=none dev/shm tmpfs defaults 0 0
#!/bin/bash
# this script installs LXC inside the container to provide
# /usr/lib64/lxc/lxc-init for use with lxc-execute
#
# The lxc-el5-x86_64 repository is locally generated using
# a locally-created package. LXC had to be hacked to work around
# usage of some newer Linux capabilities features to compile
# on CentOS 5.x. This version of LXC probably shouldn't be
# used to run containers; for production we'll use EL6 VM's
@tobert
tobert / dd_zero_ephemeral_mdraid1.txt
Created September 13, 2011 23:14
burning in ec2 ephemerals
hostname: eth0_total eth0_recv eth0_send read_iops write_iops 1min 5min 15min
----------------------------------------------------------------------------------------------------------------
ec2-xx-xx-xx-xx: 816 124 692 0/s 13,765/s 1.01 1.02 1.00
ec2-xx-xx-xxx-xx: 786 113 673 0/s 19,116/s 1.00 1.02 1.00
ec2-xx-xx-xxx-xxx: 784 113 671 0/s 15,573/s 1.10 1.08 1.09
ec2-xx-xx-xx-xxx: 798 120 678 0/s 13,045/s 1.09 1.05 1.01
ec2-xx-xxx-xxx-xxx: 786 113 673 0/s 3,008/s 1.02 1.03 1.00
ec2-xx-xxx-xx-xx: 761 120 641 0/s 0/s 0.00 0.00 0.00
ec2-xx-xx-xxx-xxx: 800 120 680 0/s 3,100/s 1.03 1.04 1.00
ec2-
@tobert
tobert / zeroed.txt
Created September 14, 2011 20:04
after zeroing drives in ec2
hostname: eth0_total eth0_recv eth0_send read_iops write_iops 1min 5min 15min
----------------------------------------------------------------------------------------------------------------
ec2-xxx-xxx-xxx-xxx: 917 131 786 0/s 50,567/s 1.55 1.05 0.46
ec2-xxx-xxx-xxx-xxx: 917 131 786 0/s 39,503/s 1.54 1.01 0.44
ec2-xxx-xxx-xxx-xxx: 917 131 786 0/s 55,467/s 1.32 0.95 0.42
ec2-xxx-xxx-xxx-xxx: 913 131 782 0/s 47,325/s 1.48 0.91 0.40
ec2-xxx-xxx-xxx-xxx: 897 131 766 0/s 12,048/s 1.01 0.75 0.34
ec2-xxx-xxx-xxx-xxx: 972 131 841 0/s 51,665/s 1.35 0.96 0.42
ec2-xxx-xxx-xxx-xxx: 916 131 785 0/s 59,382/s 1.33 0.93 0.42
@tobert
tobert / tune_cassandra_raid.sh
Created September 20, 2011 06:20
Tuning Linux MDRAID 5 for acceptable performance
#!/bin/bash
# Linux RAID5 tuning
# Al Tobey 2011-09-19 <al@ooyala.com>
for sysent in /sys/block/sd*
do
drive=$(basename $sysent)
sector_size=$(blockdev --getss /dev/$drive)
@tobert
tobert / zero-drives.sh
Created September 21, 2011 05:11
zero all ec2 instance drives
#!/bin/bash
# THIS WILL DESTROY ALL OF YOUR DATA
# well, almost all of it, it'll try to keep root around, but no guarantees
echo "Disabling RAID devices ..."
for raid in /dev/md*
do
grep -q $raid /proc/mounts && umount $raid
grep -q $raid /proc/mounts || \ # continue if NOT present
mdadm --stop $raid || \