Wednesday, February 1, 2012

emacs usb foot switch

Found an entry on emacswiki.org about foot switches. I see that xkeys now has a GPL'd SDK. I think it's time to get my feet in on the action...

Tuesday, January 24, 2012

DNS TTL Cheat Sheet

When migrating a DNS from an old server to a new server I lower the TTL 24 hours before so that when I make the change external users get the new site within an hour instead of the old site because the DNS information is cached for 24 hours.

When lowering the TTL I end up having to ask someone or look it up enough that I'm posting this cheat sheet for myself to search in the future. So if a longer TTL is inherited from the top of the zone file and foo.tld inherits that time it would look like the following:

foo                        A       123.456.7.8
To lower it's TTL to one hour I simply insert the time with units (else it's seconds) in between the hostname and the A:
foo        1h              A       123.456.7.8
Then after reloading the zone file query that DNS server for the name:
dig @123.456.2.1 foo.bar.com
and make sure the ANSWER section contains 3600, which is the number of seconds in an hour:
;; ANSWER SECTION:
foo.tld. 3600    IN      A       123.456.7.8

Monday, January 16, 2012

svn2git

Nothingmuch's Migrating from Subversion to Git worked for me for two SVN repos that I'm actively working on.

Quick notes:

yum install git-svn
git svn clone --prefix=svn/ --stdlayout --authors-file=authors.txt 
git svn-abandon-fix-refs
git svn-abandon-cleanup
This makes a clean git repo complete with tags, branches, and history. Now set the "central" repo location :
git remote add origin 
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
finally, push it up to the server :
git push origin master

Sunday, December 18, 2011

Mac 10.7, python-ldap, MySQL-python, homebrew

I configured a Mac 10.7 machine to resume writing a Python program I had to put on hold. I needed python-ldap and found a guide on how to get it working on Lion. I was also introduced to homebrew in the process. I also found a workaround for MySQL-python on Lion.

Wednesday, November 9, 2011

RHEL6 latency on Dell M610: C States

We ran into latency problems on Dell M610 servers using RHEL6 while RHEL5 performed perfectly. The RHEL6 stock kernel has a module called intel_idle which ignores Dell's BIOS settings to disable C-states. We've set the following in the tail of the boot line in /etc/grub.conf and so far so good.

intel_idle.max_cstate=0 processor.max_cstate=1
When I started here six years ago we had a DNS server with a similar problem solved basically the same way; with a "acpi=off" to disable ACPI.

Update: The above seems to have helped servers connected to the SAN but not one which just uses the local disk. RedHat had some interesting tweaks to try with MegaCli, hdparm, and the scheduler as they think it's IO related:

Set policy to cache data:

# MegaCli64 -LDSetProp -Cached -LAll -aAll
Enable disks' cache:
# MegaCli64 -LDSetProp EnDskCache -LAll -aAll
# MegaCli64 -LDSetProp ADRA -LALL -aALL
Enable write cache, but first verify if the controller is battery backed:
# MegaCli64 -AdpBbuCmd -GetBbuStatus -a0 | grep -e '^isSOHGood' -e '^Charger Status' 
If the above results display no BBU, do not proceed.
If we have a battery backed controller, enable write cache.
# MegaCli64 -LDSetProp WB -LALL -aALL
If battery fails or is discharged, disable write cache:
# MegaCli64 -LDSetProp NoCachedBadBBU -LALL -aALL
Verify policy is Enabled:
# MegaCli64 -LDInfo -LAll -aAll |grep 'Disk Cache'
Disk Cache Policy: Enabled
Disable local device caching:
# hdparm -W0 /dev/sda
- Add the above to /etc/rc.local to persist reboots.
Edit /etc/fstab and modify the mount options, ie: 
/dev/mapper/vg_root-lv_root / ext4 defaults,nobarriers,data=writeback 1 1
...
...
The filesystem(s) would need be remounted for changes to take effect.
Next, we will change the scheduler to Deadline.
# echo 'deadline' > /sys/block/sda/queue/scheduler
# echo 200 > /sys/block/sda/queue/iosched/read_expire
# echo 500 > /sys/block/sda/queue/iosched/write_expire
- Add the above commands to /etc/rc.local to persist reboots.