IT

Linux Scsi Bus Rescan

Stephen
After adding disks to vmware clients or new luns to san, das services its useful to get the linux os to rescan the scsci devices. echo "- - -" > /sys/class/scsi_host/host0/scan That’s it. You can look for log messages at “dmesg” to see if it’s working. You can also look at /proc/scsi/scsi to see if the devices are there. There is also the “lsscsi” command that will show you the know devices plus the device entries that point to those devices (very usefull).

Mysql Dump Splitter

Stephen
After trying to import massive db dumps and it taking for ever i came up with a script to chop up a mysql dump at the table level. This allows me to import the dumps table by table, allowing for a multi threaded import rather than a single threaded import. #!/usr/bin/php <?php $start=time(); echo "MySQL Dump Split to Tables \r\n"; set_time_limit(600); $filetype=mime_content_type($argv[1]); if(!isset($argv[1])) { echo "Please provide dump file as a argument \r\n"; echo "If the 2nd argument is gzip it will compress the sql dumps of the tables \r\n"; exit(1); } if(isset($argv[2])) { if($argv[2] == "gzip") { $gzipoutput=true; } } if($filetype == "text/plain") { $handle = @fopen($argv[1], "r"); } else if($filetype == "application/x-gzip") { $handle = @gzopen($argv[1], "r"); } else { echo "Please provide a sql or gzip compressed sql file \r\n"; exit(1); } $header=true; if ($handle) { while (!

Mysql Dump Splitter / Benchmarks

Stephen
Just a quick post to let you know some interesting finding on the sql splitter script i wrote: The gzip compressed size 1.2G dump.sql.gz The decompressed size 6.4G dump.sql Time taken in seconds splitter dump.sql gzip -- 22 ./splitter dump.sql.gz gzip -- 29 ./splitter dump.sql -- 43 The limiting factors looks to be the cpu with the gzip to gzip as php only runs on one core. Where as uncompressed to uncompressed was IO wait.

Tomcat And Mod Proxy

Stephen
I was asked today to setup a server that will run multiple instances of tomcat, running the same application. That would sit behind a apache server that would forward the requests on the tomcat server. An example is below: http://localhost/tomcat1/appname -> tomcat1 :8180 http://localhost/tomcat2/appname -> tomcat2 :8280 So i added the correct items into my apache config: ProxyPreserveHost On ProxyRequests Off <Location /tomcat1/appname/> ProxyPass http://127.0.0.1:8180 ProxyPassReverse http://127.0.0.1:8180 </Location> <Locatin /tomcat2/appname/> ProxyPass http://127.

DD + Lzo = superfast

Stephen
I recently purchased a new laptop, (Hp Envy 14) that came pre-installed with windows. After leaving it on the hard drive for some time i finally needed the space. I shrank the partition as small as it could go but alas i have a SSD and every GB is expensive and needed. I thought to myself what’s the best way to back this up, dd + nc was the way to go i thought.

Hiera can do anything

Stephen
I have been meaning to write this Blog post regarding using Hiera as sort of an ENC for a very long time but I have never got round to it. Until On a recent trip to Melbourne I suffered from jet lag so finally got round to writing it. I believe that the best solution to a problem is normally the simplest one. For example I recently did some work for a client and will use the solution to highlight a way of driving everything from Hiera and the date we lookup for it.

Imapfilter + Offilineimap + Mutt + New Script = Even Less Pain

Stephen
My last article covered by original mail setup after some usage i have tweaked it even more so i have to do even less. I have now introduced imapfilter that can move messages to the correct mail folder before i run offlineimap. First you need to setup ~.imapfilter/config.lua {% codeblock lang:ini %} – Options – options.timeout = 120 options.subscribe = true – Accounts – Account = IMAP { server = ‘mail.