Archive for the ‘Linux’ Category

Skipping records with MySQL replication

Tuesday, October 18th, 2011

I manage several replicated MySQL DB servers. It seems like they break anytime we have a glitch in the network or with our hardware. I used to rebuild MySQL from scratch, now I just skip a record or two and see if it starts replicating properly.  Here how I skip records.  First log into MySQL as root then…

STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE;

wait a second or two then…
SHOW SLAVE STATUS\G

If your slave status shows Yes/Yes and your Seconds behind is 0 or greater and not NULL then you are in good shape!
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
                         ...
      Seconds_Behind_Master: 0

How to “Exclude” Packages from Updating with YUM & Centos/Redhat

Monday, October 17th, 2011

When keeping your servers up to date you may not want to have every package upgraded. This is especially true with programs like http servers, script processors (like PHP & Perl) or database servers. It seems that inevitably I want to only upgrade those programs when I know I can take alot of time to make sure their upgrade was perfect. So the quick solution is to “Exclude” them from the update.

Just grab your handy dandy favorite editor and edit /etc/yum.conf and add an exclude line…

[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
exclude=mysql*

# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h

installonly_limit = 5

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
tsflags=repackage

exclude=mysql*

You can then exclude any package you want or like I did above, no updates any MySQL package.

No when I am ready to finally do an upgrade on MySQL I can remove that entry.

Crystal Reports & Converting a UNIX Time Stamp

Friday, January 19th, 2007

I had a heck of a time finding out how to convert a UNIX time stamp in Crystal Reports.  My company has a ecommerce package that stores all sales date in a UNIX time stamp format.  Which means it stores the time and date by storing the number of seconds since 1/1/1970.   So here is the formula I came up with…

dateadd (“s”,{order.date}-18000, #1/1/1970#)

dateadd function does the trick,  the “s” is for seconds, order.date is the table that contains the unix time stamp, -18000 is -5 hours from UTC in seconds because im in the Eastern Time Zone and 1/1/1970 is the base date for dateadd to add the other argument to.

Hope This Helps!

Chris Edwards

How To Export and Import Your PuTTY Sessions

Wednesday, January 10th, 2007

If you want to copy Putty configuration from a Windows computer to another same version Windows computer, here is what to do:

    1. On a model computer, configure Putty to your desire, save and test it to make sure it works the way you want it to.
    2. Start/Run/regedit to run regedit tool
    3. Browse to HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys
    4. Delete all values under this key EXCEPT the (Default) value
    5. Right click on HKEY_CURRENT_USER\Software\SimonTatham and select Export, then save it as “setup-putty.reg” to a location that you want
    6. Copy setup-putty.reg and the Putty.exe files to a machine that you want to copy Putty configuration to
    7. On this new computer, double click on setup-putty.reg to import Putty configuration
    8. Upon successful configuration import, run Putty.exe. You should see all Putty configuration there. You can safely delete setup-putty.reg since you only need to run it ONCE on each new computer that you want to use Putty with tthe same configuration.

Fedora / Linux editing fstab in maintenance mode

Tuesday, January 9th, 2007

Today was a fun day.  I rebooted one of my IBM Blade servers only to find out that it would only come back online in maintenance mode.  I had added a fstab entry for a USB drive that I was adding to the machine.  I hadn’t taken the time yet to plug the drive in.  So when I rebooted the machine walla… maintenance mode… The server thought the drive was corrupt or bad.  Then I realized the machine booted into READ ONLY while in maintenance mode.  So I hunted the solution and thought I would share it.  The trick is to remount the drive as READ WRITEABLE.   Its an easy solution but may throw you for a loop in a tight spot.  Here ya go….

# mount -n -o remount,rw /