<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hack Admin &#187; Maintenance</title>
	<atom:link href="http://www.hackadmin.com/category/maintenance/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hackadmin.com</link>
	<description></description>
	<lastBuildDate>Tue, 16 Mar 2010 21:31:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting Rid Of MySQL Binary Logs</title>
		<link>http://www.hackadmin.com/2009/06/25/getting-rid-of-mysql-binary-logs/</link>
		<comments>http://www.hackadmin.com/2009/06/25/getting-rid-of-mysql-binary-logs/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 22:10:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Maintenance]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[binary]]></category>
		<category><![CDATA[binary logs]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[mysql master]]></category>
		<category><![CDATA[MySql Slave]]></category>
		<category><![CDATA[slave]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=96</guid>
		<description><![CDATA[If you&#8217;re in charge of a mysql database that does any sort of volume, you might find yourself in the peculiar situation where your binary logs have piled up to an unmanageble level.  Typically you&#8217;ll use the binary logs for replication from a master server to a slave.  This may not always be the case [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re in charge of a mysql database that does any sort of volume, you might find yourself in the peculiar situation where your binary logs have piled up to an unmanageble level.  Typically you&#8217;ll use the binary logs for replication from a master server to a slave.  This may not always be the case though.  The bottom line is, if you have binary logging enabled in your my.cnf you&#8217;ll be producing and stockpiling binlogs.</p>
<p><span id="more-96"></span><br />
When you first realize that you have a problem, you&#8217;ll have a gut reaction to just delete these files, and to be quite honest, I&#8217;m not sure if that really *breaks* anything or not.  MySQL does track these files though.  So it&#8217;s possible if you yank a file out from under the server, it might get a little whacky.   The bottom line is though, they are merely a binary representation of the sql that you intend to send to another server (typically), and they have nothing to do with the integrity of the data in the database.</p>
<p>So if you want to do it the *correct* way, mysql has a command set to deal with these logs.  First, to get a look at the files and their sizes, you can do a <strong><em>show binary logs</em></strong> . This will give you the breakdown of all the bin logs the server knows about.</p>
<p>It may be prudent, if you are running in a master/slave environment to take a look at your slave status so that you know you are not behind.  basically, log into your slave and run <em><strong>show slave status\G</strong></em> . Make sure that Slave_IO_Running: Yes and Slave_SQL_Running: Yes exist, and check Seconds_Behind_Master: 0.   These 3 things will tell you that your slave is running and up to date.  While you&#8217;re here, make note of the Master_Log_File: .   This should be the most recent log listed in your <em><strong>show binary logs</strong></em> output on the master server.</p>
<p>Now that you know where you are in your binary log world, all you need to do is tell the master to purge the files up to the next to the last file, or less if you&#8217;re paranoid.  If you&#8217;re most recent log file is mysql-bin.104 then you might want to issue the following command:  <em><strong>PURGE BINARY LOGS TO &#8216;mysql-bin.103&#8242;</strong></em>.  This will leave log 103 and 104 on the server and remove the rest.</p>
<p>That&#8217;s about it, Happy Purging!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2009/06/25/getting-rid-of-mysql-binary-logs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Beauty of mysqlcheck</title>
		<link>http://www.hackadmin.com/2009/06/22/the-beauty-of-mysqlcheck/</link>
		<comments>http://www.hackadmin.com/2009/06/22/the-beauty-of-mysqlcheck/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 23:45:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Maintenance]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Repair]]></category>
		<category><![CDATA[checking all mysql tables in a database]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[mysqlcheck]]></category>
		<category><![CDATA[Replication]]></category>
		<category><![CDATA[slave]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=37</guid>
		<description><![CDATA[I manage a ton of mysql databases, from single wordpress instances, to clusters, to systems that have a core data structure that selectively replicates out to as many as 50 systems.   Fortunately, or maybe not, they seldom have issues and after setup, other than disk space issues, I seldom have to touch them.
Recently, as I [...]]]></description>
			<content:encoded><![CDATA[<p>I manage a ton of mysql databases, from single wordpress instances, to clusters, to systems that have a core data structure that selectively replicates out to as many as 50 systems.   Fortunately, or maybe not, they seldom have issues and after setup, other than disk space issues, I seldom have to touch them.</p>
<p>Recently, as I was migrating a set of DBs from an aquired company onto new hardware in a new location, I ran across a DB that seemed to consistently become corrupt.  It was usually the larger tables and typically on the slave system.  At first, it was bad enough that I blamed the hardware.  So the box was replaced and things went well for a while.  Recently the head developer for this system came to me with corrupted tables.  He was seeing the output in his code and was feeding me the tables so that I could repair them.  We did them one by one and it became clear that I really needed to check the whole DB.</p>
<p><span id="more-37"></span>It would have been relatively simple to throw together a script to do this, but I was apparenlty feeling lazy and did a google search instead.  Low an behold, I ran across a utility that I have read about countless times in the past, and I&#8217;m sure at some point I had actually run.   mysqlcheck.  I believe this nice little script has been packaged with mysql since the late 3.x strains.</p>
<p>At any rate, I think I&#8217;m documenting it here so that I won&#8217;t forget 6 months from now when I need the same functionality again.</p>
<p>So, on the system in question, I had about 20 instances and only one of them needed to be checked.  This is a big deal as the check script, or the repair command, or the optimize command will lock up your tables when it does it&#8217;s work and there were 19 web/data instances running on this box that I didn&#8217;t want to bother.  The check script is smart enough to handle this situation with the &#8211;databases flag.  Simply add the names of the instances that you want the check after that flag and you&#8217;re off.</p>
<p>Obviously, you want to do your best to stop traffic to the instances you intend to repair.  Can you get away with not doing this?  Well sure, remember however that the check, repair and optimize functions will lock up the tables in question when they do their work.  What does this mean?  Well, it means that none of your inbound querys will be run, they will queue up behind the repair functions until those functions finish.  In a really bad scenario, it&#8217;s possible that each of your querys will be bound to an apache instance and your web server will start eating up memory and potentially crash the whole box.  Thus, it&#8217;s in your best interest to stop as much traffic as possible before you start.</p>
<p>In my case, the usage of mysqlcheck looked like this:</p>
<p>mysqlcheck -uroot -pxxxxx &#8211;auto-repair &#8211;optimize &#8211;databases broken_db</p>
<p>The output is fantastic, it tells you where it&#8217;s at and what is broken or ok.  If you don&#8217;t want to see the output, if you intend to run from cron or whatever, there is a &#8211;silent option as well.</p>
<p>At any rate, leave it to mysql to simplify your admin a bit.  Run the mysqlcheck without any options and you&#8217;ll see all the options.  Takes 5 minutes to read through them.</p>
<p>That&#8217;s it, happy mysql&#8217;ing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2009/06/22/the-beauty-of-mysqlcheck/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Dump SELinux</title>
		<link>http://www.hackadmin.com/2008/11/08/dump-selinux/</link>
		<comments>http://www.hackadmin.com/2008/11/08/dump-selinux/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 17:41:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Maintenance]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[error message]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[selinux]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/2008/11/08/dump-selinux/</guid>
		<description><![CDATA[The real problem here is that I don&#8217;t have the time to understand the perks of SELinux.. and.. it always seems to be in my way.  Current problem is with a yum install of bind.
Here&#8217;s the error:
Nov  8 07:21:24 localhost named: none:0: open: /etc/named.conf: permission denied
Nov  8 07:21:26 localhost setroubleshoot: SELinux is preventing the named-checkconf [...]]]></description>
			<content:encoded><![CDATA[<p>The real problem here is that I don&#8217;t have the time to understand the perks of SELinux.. and.. it always seems to be in my way.  Current problem is with a yum install of bind.</p>
<h3>Here&#8217;s the error:</h3>
<p><code>Nov  8 07:21:24 localhost named: none:0: open: /etc/named.conf: permission denied<br />
Nov  8 07:21:26 localhost setroubleshoot: SELinux is preventing the named-checkconf from using potentially mislabeled files (./named.conf). For complete SELinux messages. run sealert -l 82a8e3a9-7073-472c-b232-bec1d8e30374</code></p>
<p><span id="more-16"></span></p>
<h3>To make it go away, we do this:</h3>
<p><code>echo 0 &gt; /selinux/enforce</code></p>
<h3>If you want to bring it back:</h3>
<p><code>echo 1 &gt; /selinux/enforce</code></p>
<h3>To make it permanent:</h3>
<p>If you want it gone for good (after reboot), edit /etc/selinux/config and change this:<br />
<code>SELINUX=enforcing</code><br />
to this:<br />
<code>SELINUX=permissive</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2008/11/08/dump-selinux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>When to use MySQL BlackHole Tables</title>
		<link>http://www.hackadmin.com/2008/06/14/when-to-use-mysql-blackhole-tables/</link>
		<comments>http://www.hackadmin.com/2008/06/14/when-to-use-mysql-blackhole-tables/#comments</comments>
		<pubDate>Sat, 14 Jun 2008 18:09:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Maintenance]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[BlackHole Table Type]]></category>
		<category><![CDATA[data dump]]></category>
		<category><![CDATA[data import]]></category>
		<category><![CDATA[innodb]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[mysql server]]></category>
		<category><![CDATA[relay]]></category>
		<category><![CDATA[slave]]></category>
		<category><![CDATA[table types]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/2008/06/14/when-to-use-mysql-blackhole-tables/</guid>
		<description><![CDATA[We read about the black hole table type a long time ago and it&#8217;s kind of been a running joke &#8211; why in the hell would somebody want to insert into a black hole?  Many times it&#8217;s been suggested as the solution to all of our data problems&#8230; Just swap out all the InnoDB [...]]]></description>
			<content:encoded><![CDATA[<p>We read about the black hole table type a long time ago and it&#8217;s kind of been a running joke &#8211; why in the hell would somebody want to insert into a black hole?  Many times it&#8217;s been suggested as the solution to all of our data problems&#8230; Just swap out all the InnoDB tables for black hole and ta daaa!!!  No more capacity issues.</p>
<p>So as you might guess it was merely coincidence when we discovered it&#8217;s functionality.  Here&#8217;s the scenario:</p>
<p><span id="more-10"></span>1 DRBD/HA Master MySQL Server<br />
1 DRBD/HA Relay Slave<br />
20 Standalone Slaves</p>
<p>We found with one of our applications that it made alot of sense to keep some tables local and pull some from the master.  The tables that were kept locally on the 20 web serving boxes are rolled up every 10 minutes and their data is sent on for processing.  The tables that are replicated are slave to the Relay Slave, our middle man.</p>
<p><img src="http://www.hackadmin.com/wp-content/uploads/2008/06/bh.png" alt="bh.png" /></p>
<h3>So where does black hole fit in?</h3>
<p>We actually figured it out on the initial import of data.  The beginning database size was around 2GB.  We did the full import to the master and at the time, the relay slave was configured with InnoDB tables.  In addition, we were doing the dump as data infile.   Using data infile in a replication scenario works as follows.</p>
<ol>
<li>The entire file is imported to the master.</li>
<li>Once the file is completed on the master, the relay slave then begins to import the data.</li>
<li>Once the relay slave has completed the file, then the slaves begin to load the data.</li>
</ol>
<p>In our case these files were quite large.  What we discovered was, for each file we were going to have a hella long wait before it every got to the slaves (which is where we actually needed the data).  The solution?  Don&#8217;t write the data to the middle man.  Since binloging is enabled on the relay slave, all of the associated SQL commands are being passed from the Master to the Relay Slave.  Since we never planned on using the Relay Slave in any capacity other than passing on data, there&#8217;s no need to write the commands to disk.  Hence, Black Hole.  All of the SQL replication commands are executed on the Relay Slave, but the are basically sent to /dev/null so you save the write time.</p>
<p>The utility of this setup really stood out when using data infile because of the size of the files, it was really easy to see the lag in the middle.  It will probably not be as important with standard inserts and updates to the master as those happen rather quickly.  However, in the event of a problem, should we have to restore a table or whatever, we know moving forward we are going to save that write time in the middle and possible spare some downtime.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2008/06/14/when-to-use-mysql-blackhole-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Net-SNMP Startup Issues and package updates.</title>
		<link>http://www.hackadmin.com/2008/04/16/net-snmp-startup-issues-and-package-updates/</link>
		<comments>http://www.hackadmin.com/2008/04/16/net-snmp-startup-issues-and-package-updates/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 22:57:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Maintenance]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Repair]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[centos 4.5]]></category>
		<category><![CDATA[error message]]></category>
		<category><![CDATA[net-snmp]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/2008/04/16/net-snmp-startup-issues-and-package-updates/</guid>
		<description><![CDATA[I ran into an issue the other day installing net-snmp-utils via yum on a CentOS 4.5  box and it just happened to me again.  This time however, I didn&#8217;t install the net-snmp-utils, it was from the original load of net-snmp.  Basically, I typically just do a:
yum -y install net-snmp
Then copy over my [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into an issue the other day installing net-snmp-utils via yum on a CentOS 4.5  box and it just happened to me again.  This time however, I didn&#8217;t install the net-snmp-utils, it was from the original load of net-snmp.  Basically, I typically just do a:</p>
<p>yum -y install net-snmp</p>
<p>Then copy over my default snmpd.conf file and fire it up.</p>
<p>In these instances however, snmpd either refused to start or gave the following error in /var/log/messages:</p>
<p><span id="more-6"></span><code>Apr 16 18:14:35 msx-db01 kernel: audit(1208384075.250:6): avc:  denied  { read } for  pid=27712 comm="snmpd" name="snmpd.conf" dev=sda3 ino=7241736 scontext=root:system_r:snmpd_t tcontext=root:object_r:tmp_t tclass=file<br />
Apr 16 18:14:35 msx-db01 kernel: audit(1208384075.265:7): avc:  denied  { read } for  pid=27712 comm="snmpd" name="snmpd.conf" dev=sda3 ino=7241736 scontext=root:system_r:snmpd_t tcontext=root:object_r:tmp_t tclass=file<br />
Apr 16 18:14:35 msx-db01 snmpd[27712]: Warning: no access control information configured.   It's unlikely this agent can serve any useful purpose in this state.   Run "snmpconf -g basic_setup" to help you configure the snmpd.conf file for this agent.<br />
Apr 16 18:14:35 msx-db01 snmpd[27712]: NET-SNMP version 5.1.2<br />
</code></p>
<p>I tried to use snmpconf as suggested even though I knew my snmpd.conf file was fine.  snmpconf was not on the system so I didn&#8217;t waste any time trying to find out how to get it.</p>
<p>So the fix is to install the net-snmp-libs package, not sure what it updates but it works.</p>
<p><code>yum -y install net-snmp-libs</code></p>
<p>The catch after that is (at least in all 3 of my situations) the following error on the yum install:</p>
<p><code>Transaction Check Error:   file /usr/share/man/man8/ext2online.8.gz from install of e2fsprogs-1.35-12.11.el4_6.1 conflicts with file from package e2fsprogs-1.35-12.4.EL4</code></p>
<p>So, back to the hack admin package manager of choice *yum* :</p>
<p><code>yum update e2fsprogs</code></p>
<p>Once it&#8217;s updated, the net-snmp-libs goes in as expected.</p>
<p>So what&#8217;s the deal with all this?  I dunno, what the hell do utilities for ext2 have to do with my ability to run snmp monitoring?  Who gives a shit and if you know, you&#8217;re probably on the wrong site.  At any rate, my monitoring works and I&#8217;ll leave the rest to the server fairies.</p>
<p>Moral of the story: If your shit works, do you really need to understand it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2008/04/16/net-snmp-startup-issues-and-package-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

