Tuesday, July 29, 2008

Redhat PHP/MySQL on top of mess

If a prior admin has installed php4/mysql4 on a rhel4 box and wanted to upgrade both to version 5 but didn't know about altering the channel subscription to Web Application Stack 1.0 Beta and instead installed them from source and simply had init start /usr/local/bin/mysqld and just edited /etc/httpd/conf.d/php.conf to include a module he dropped into /etc/httpd/modules/libphp5.so (yuck).... then you can do the following...

* Remove the old packages first
up2date doesn't have a remove option like yum (or better apt) so you'll have to dig around. rpm -ev everything that rpm -qa | grep -i php and rpm -qa | grep -i mysql return. Then up2date -u

* Subscribe to Web Application Stack 1.0 Beta
Install the newer versions: up2date -i mysql-server php php-mysql php-ldap php-gd php-xml. Your /etc/httpd/conf.d/php.conf should now just contain a reference RedHat's /etc/httpd/modules/libphp5.so.

* Fix MySQL
If the prior admin installed from source with the default options your data and binaries should be in different locations and can co-exist as you move them:

RedHat: /var/lib/mysql
local: /usr/local/mysql/data
Backup your databases with the old server running:
/usr/local/mysql/bin/mysqldump -u root -p --all-databases > backup.sql
Stop the old one and start the new one. Then drop in the new data. By default the root user shouldn't have a password:
/usr/bin/mysql -u root < backup.sql
Edit /etc/my.conf and update "old_passwords=1" with "old_passwords=0".

RHEL4/5's MySQL comes by default with the old_passwords flag in /etc/my.conf set to true from a default install (via up2date or yum). A new install doesn't have this value set and just uses the new password hash function. As a result the passwords that were created originally used the newer 41 byte hash and not the older 16 byte hash. Thus when you try to import those 41 byte passwords they will be stored but won't work since the system will expect 16 byte passwords until you update the flag and restart MySQL. For more information on MySQL's password hashing see: http://dev.mysql.com/doc/refman/6.0/en/password-hashing.html.

Monday, July 28, 2008

LVM Confused from Unzoned LUN

I recently had a situation where I confused LVM on a test server.

I had zoned a SAN to serve a block device and added it to the LVM. When I was done with the device I umounted it unzoned it. My mistake: not removing it from the LVM. I should have done:

  • lvremove
  • vgremove
  • pvremove
LVM was confused. I kept seeing /dev/dm-2: read failed after 0 of 4096 at 37580898304: Input/output error or ioctl BLKGETSIZE64 failed: No such device or address errors from all of the commands above. Even though /proc/scsi/scsi didn't list the device. The following didn't help:
  • vgreduce --removemissing $name
  • rm /etc/lvm/.cache
  • vgchange -ay
I ended up rebooting the system so that it could rescan the SCSI bus and it worked fine. I might have gotten away with this trick to rescan the SCSI bus.

Friday, July 25, 2008

Tuesday, July 22, 2008

DNS Vulnerability

There was a recently DNS cache poisoning vulnerability. Debian and RedHat released timely fixes and DJB's guarantee still stands. darkoz.com has a concise explanation.

Monday, July 21, 2008

TCP Tuning

A friend sent me two interesting links on tuning TCP to maximize throughput for moving large data:

Tuesday, July 8, 2008

MySQL multi-core performance

According to MySQL, MySQL [5.0] "is fully multi-threaded, and will make use of multiple CPUs, provided that the operating system supports them".

However, there are different ways to use the extra CPUs. Does a single query from one connection use all CPUs (Parallelism) OR does it just distribute processing per connection? In the later option a single query wouldn't run any faster but multiple variations of the query could be run at the same time depending on the number of extra CPUs.

I'm using MySQL 5.0 and a forum poster claims 5.1 might have parallelism. Neither RHEL5 nor Hardy Heron have MySQL 5.1 packages.

In my search for this information I came across the blog of a Google employee (AFAICT) who is working on MySQL. He pointed out some things he doesn't like about parallelism and suggested other things MySQL users can do to get parallel features. I also came across a PostgreSQL vs MySQL benchmark which claimed that MySQL performance only improved 37% from quadrupling the cores while PostgreSQL improved over 200%. However they didn't specify what queries they ran (as mentioned above) to measure this.

Thursday, July 3, 2008

Goolge Python Side Effect

While searching with the terms python dictionary for documentation on Python's dictionary data type I found Monty Python's Hungarian Dictionary skit.

Wednesday, July 2, 2008

OpenMoko for Mortals

OpenMoko Neo Freerunner Finally Available on July 4th

The FreeRunner is here! My current normal phone reports that I'm using GSM 850/1900 with AT&T. The FreeRunner supports this frequency band. My SIM card (63698 A 1002) is reported to be working so I just need to install it to have working voice. However, I'll need to add data service like PDA Personal for Internet access. I should be able to do all of this online (without talking to anybody) in five days for $400 + $30/month.

It comes with a 512M microSD card but 8G chips are ~$40.

What programs can you run? Using the OpenMoko Emulator (video) might be the best way to test the software. Note that qtopia has also been ported.

Update: arstechnica has a nice overview.

Serialize Python Data to a File

Found a blog post on using pickle (most Pythons have this mod by default) to store persistent data to a file.

Tuesday, July 1, 2008

Backup Hardware Ideas

  • Dell MD3000
    • iSCSI
    • Nearly 1/4 the price of the DL1500
    • 45TB max
    • RAID levels 0, 1, 10 and 5
    • 4 snapshot virtual disks
  • EMC DL1500
    • Fibre
    • Nearly 4 times the price of the MD3000
    • 36TB max
    • RAID6
    • Do SnapShots require a SnapView license?
    • Data Deduplication for only certain types of file systems