<?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>ServerAdminBlog &#187; CentOS</title>
	<atom:link href="http://www.serveradminblog.com/category/centos/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.serveradminblog.com</link>
	<description>Short Circuit...</description>
	<lastBuildDate>Sat, 04 Feb 2012 16:56:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MySQL Performance &#8211; Howto &#8211; part 1 (high performance tuning scripts)</title>
		<link>http://www.serveradminblog.com/2011/03/tuning-mysql-performance-howto-part-1/</link>
		<comments>http://www.serveradminblog.com/2011/03/tuning-mysql-performance-howto-part-1/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 09:24:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=40</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2011/03/tuning-mysql-performance-howto-part-1/' addthis:title='MySQL Performance &#8211; Howto &#8211; part 1 (high performance tuning scripts) '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Often the server admin has little control over the applications which uses MySQL and it is hard to find the bottlenecks. This blog post can&#8217;t bring the peace in the world, or help NASA to finally land on the Mars. Instead those tasks, I&#8217;ll try to solve something else and present my own experiences with [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2011/03/tuning-mysql-performance-howto-part-1/' addthis:title='MySQL Performance &#8211; Howto &#8211; part 1 (high performance tuning scripts) '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Often the server admin has little control over the applications which uses MySQL and it is hard to find the bottlenecks. This blog post can&#8217;t bring the peace in the world, or help NASA to finally land on the Mars. Instead those tasks, I&#8217;ll try to solve something else and present my own experiences with MySQL storage engines (at least for MyISAM and InnoDB as the most popular).<br />
<span id="more-40"></span></p>
<p>Keep in mind that I&#8217;m not an expert in this field. When I have problems with MySQL, I dig with my both hands (and head) to solve them without casualties. Every app has its own queries and you&#8217;ll need to track them down via slow query log. </p>
<p>Before you do anything, keep in mind that default MySQL installation usually works fine. Unfortunately maximum performances can&#8217;t be achieved without adjustments to increase performance and stability.</p>
<p>Before you can do anything, you need to enable slow query log. </p>
<p>Exec</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;"># touch /var/log/slow-query.log</pre></div></div>

<p>to create slow-query.log file. Then add</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">log-slow-queries = /var/log/slow-query.log
long_query_time = 4
log-queries-not-using-indexes</pre></div></div>

<p>(for MySQL 5.0.x)</p>
<p>to /etc/my.cnf (inside [mysqld] section) and restart mysql. Wait at least 24-48 hours before you proceed to the next step. </p>
<p>(For MySQL 5.1.x check here: <a href="http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html">LINK</a>)</p>
<p><strong>High performance tuning scripts</strong></p>
<p><strong>Mysqltuner</strong></p>
<p>MySQLTuner is a script written in Perl that will assist you with your MySQL configuration and make recommendations for increased performance and stability.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># wget mysqltuner.pl
# chmod +x mysqltuner.pl
# ./mysqltuner.pl</pre></div></div>

<p>Read output and try to follow the recommendations.</p>
<p><strong>Tuning-primer</strong></p>
<p>Tuning-primer is another script who takes information from &#8220;SHOW STATUS LIKE&#8230;&#8221; and &#8220;SHOW VARIABLES LIKE&#8230;&#8221; to produce readable recommendations for tuning server variables.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># wget http://www.day32.com/MySQL/tuning-primer.sh
# ./tuning-primer.sh</pre></div></div>

<p>Also, read output and try to see what you can do to fix problems. Keep in mind that you need to restart mysql after you add something to /etc/my.cnf. In case something goes wrong, check mysql log (usually /var/log/mysqld.log</p>
<p><strong>MyTOP</strong></p>
<p>Mytop is a console-based (non-gui) tool for monitoring the threads and overall performance of a MySQL</p>
<p>To install mytop,</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># wget http://jeremy.zawodny.com/mysql/mytop/mytop-1.6.tar.gz
# tar -xvzf mytop-1.6.tar.gz
# cd mytop-1.6
# perl Makefile.PL
# make
# make install</pre></div></div>

<p>In case some Perl libraries are missing, you should install them via cpan.</p>
<p>For example, Term::ReadKey is required and you can get it via cpan.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># cpan
(pres Enter several times until you get cpan shell)
cpan&gt; install Term::ReadKey
cpan&gt; quit</pre></div></div>

<p>Usage: # mytop -d DATABASE -u USERNAME -p PASSWORD</p>
<p>(replace the DATABASE, USERNAME and PASSWORD with your parameters. </p>
<p><strong>MySQLReport</strong></p>
<p>mysqlreport makes a friendly report of important MySQL status values. mysqlreport transforms the values from SHOW STATUS into an easy-to-read report that provides an in-depth understanding of how well MySQL is running. mysqlreport is a better alternative (and practically the only alternative) to manually interpreting SHOW STATUS.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># wget http://hackmysql.com/mysqlreport
# chmod +x mysqlreport
# ./mysqlreport --user root --password</pre></div></div>

<p>Enter password for root and check output. More info can be found here. <a href="http://hackmysql.com/mysqlreport">LINK</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2011/03/tuning-mysql-performance-howto-part-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FreeRadius install howto (3)</title>
		<link>http://www.serveradminblog.com/2011/03/freeradius-install-howto-3/</link>
		<comments>http://www.serveradminblog.com/2011/03/freeradius-install-howto-3/#comments</comments>
		<pubDate>Sun, 20 Mar 2011 15:14:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[FreeRadius]]></category>
		<category><![CDATA[Networks]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=281</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2011/03/freeradius-install-howto-3/' addthis:title='FreeRadius install howto (3) '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>In this post I will say something about FreeRadius config files, database connection, basic instruction how to insert user in database, etc. Before you step inside this post, I recommend reading part 1 and part 2. I suppose you&#8217;re using RH based distros (Red Hat, CentOS, Fedora,..) and you already installed FreeRadius from source (config [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2011/03/freeradius-install-howto-3/' addthis:title='FreeRadius install howto (3) '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>In this post I will say something about FreeRadius config files, database connection, basic instruction how to insert user in database, etc. Before you step inside this post, I recommend reading <a href="http://www.serveradminblog.com/2011/01/freeradius-howto-part-1/">part 1</a> and <a href="http://www.serveradminblog.com/2011/03/freeradius-install-howto-2/">part 2</a>. </p>
<p>I suppose you&#8217;re using RH based distros (Red Hat, CentOS, Fedora,..) and you already installed FreeRadius from source (config files are located in /usr/local/etc/raddb/). Now lets get back to FreeRadius source dir (the place where you extracted the tar.gz).</p>
<p>Inside redhat dir you can find <em>freeradius-radiusd-init</em> script which can be used for easy start/stop radiusd process. Copy this script to /etc/init.d/ dir</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># cp freeradius-radiusd-init /etc/init.d/radiusd</pre></div></div>

<p>Now open /etc/init.d/radiusd script and change the next lines</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">exec=${exec:=/usr/sbin/$prog}
config_dir=${config_dir:=/etc/raddb}
config=${config:=$config_dir/radiusd.conf}
pidfile=${pidfile:=/var/run/$prog/$prog.pid}
lockfile=${lockfile:=/var/lock/subsys/radiusd}</pre></div></div>

<p>into</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">exec=${exec:=/usr/local/sbin/$prog}
config_dir=${config_dir:=/usr/local/etc/raddb}
config=${config:=$config_dir/radiusd.conf}
pidfile=${pidfile:=/usr/local/var/run/$prog/$prog.pid}
lockfile=${lockfile:=/var/lock/subsys/radiusd}</pre></div></div>

<p>Save changes and exit from editor. (Notice above that we actually changed the path from / to /usr/local/)</p>
<p>Now you can easily start/stop radiusd process.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[root@ms /]# service radiusd
Usage: /etc/init.d/radiusd {start|stop|status|restart|condrestart|try-restart|reload|force-reload}</pre></div></div>

<p>Also, you can exec <strong>chkconfig &#8211;level 235 radiusd on</strong> to start radiusd on boot. </p>
<p>Now lets get back to our setup. </p>
<p>I suppose you have at least one NAS (A Network Access Server (NAS) is a system that provides access to a network. In some cases also known as a Terminal Server or Remote Access Server (RAS).) NAS is a CLIENT for your radiusd server so please do not mess users and clients. Freeradius doesn&#8217;t interact with your users directly so &#8220;radius client&#8221; is another term for NAS. </p>
<p>The first step is to add your NAS to client list and to create a unique password. Inside clients.conf (/usr/local/etc/raddb/clients.conf) you can find the next lines</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#client 192.168.0.0/24 {
#       secret          = testing123-1
#       shortname       = private-network-1
#}</pre></div></div>

<p>Uncomment those lines and set up client IP address according to your addresses. In the example shown above, all IPs from 192.168.0.0/24 network will be able to use your radiusd server. </p>
<p>You can allow any IP with</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">client 0.0.0.0/0 {
       secret          = mysecret
       shortname       = myNAS
}</pre></div></div>

<p>which means all IPs in the world can use my radius server (<strong>which is not recommended</strong>)&#8230; </p>
<p>To allow only one IP (in this case 192.168.0.15),</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">client 192.168.0.15 {
       secret          = mysecret
       shortname       = myNAS
}</pre></div></div>

<p>Delete <strong>user Cleartext-Password := &#8220;password&#8221;</strong> line from users because we don&#8217;t need this any more. </p>
<p>Stop radiusd and start in debugging mode (radiusd -X).</p>
<p>You should see the similar lines</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">...............
radiusd: #### Loading Clients ####
 client localhost {
        ipaddr = 127.0.0.1
        require_message_authenticator = no
        secret = &quot;testing123&quot;
        nastype = &quot;other&quot;
 }
 client 192.168.0.15 {
        require_message_authenticator = no
        secret = &quot;mysecret&quot;
        shortname = &quot;myNAS&quot;
 }
...........</pre></div></div>

<p>This means that radiusd will allow NAS with IP address 192.168.0.15 and secret mysecret. Ctrl+C to stop radiusd. </p>
<p>In case you want to use MySQL with freeradius, you should do the next steps. Before anything, you need to create a database for freeradius.</p>
<p>Connect as root to your mysql and exec next queries.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">USER</span> <span style="color: #ff0000;">'radius'</span>@<span style="color: #ff0000;">'localhost'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span>  <span style="color: #ff0000;">'radpass'</span>;
<span style="color: #993333; font-weight: bold;">GRANT</span> USAGE <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">.</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">TO</span>  <span style="color: #ff0000;">'radius'</span>@<span style="color: #ff0000;">'localhost'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span>  <span style="color: #ff0000;">'radpass'</span>;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span>  <span style="color: #ff0000;">`radius`</span> ;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">ALL</span> PRIVILEGES <span style="color: #993333; font-weight: bold;">ON</span>  <span style="color: #ff0000;">`radius`</span> <span style="color: #66cc66;">.</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">TO</span>  <span style="color: #ff0000;">'radius'</span>@<span style="color: #ff0000;">'localhost'</span>;</pre></div></div>

<p>Another option is to use admin.sql script from raddb/sql/mysql dir.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">USER</span> <span style="color: #ff0000;">'radius'</span>@<span style="color: #ff0000;">'localhost'</span>;
<span style="color: #993333; font-weight: bold;">SET</span> PASSWORD <span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #ff0000;">'radius'</span>@<span style="color: #ff0000;">'localhost'</span> <span style="color: #66cc66;">=</span> PASSWORD<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'radpass'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">ON</span> radius<span style="color: #66cc66;">.*</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'radius'</span>@<span style="color: #ff0000;">'localhost'</span>;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">ALL</span> <span style="color: #993333; font-weight: bold;">ON</span> radius<span style="color: #66cc66;">.</span>radacct <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'radius'</span>@<span style="color: #ff0000;">'localhost'</span>;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">ALL</span> <span style="color: #993333; font-weight: bold;">ON</span> radius<span style="color: #66cc66;">.</span>radpostauth <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'radius'</span>@<span style="color: #ff0000;">'localhost'</span>;</pre></div></div>

<p>This script will set a little bit safer permissions where radius will be able only to write radacct and radpostauth tables. (<strong>Do not forget to change default username/pass shown above</strong>).</p>
<p>The next step is to import default Freeradius tables (the sql files can be found inside raddb/sql/mysql dir). You should import nas.sql and schema.sql. The nas.sql will create a table for your NASes. It is much easier to maintain the NAS list inside database then inside clients.conf. Also, you can add more fields to nas table so you can do other operations with your NAS. </p>
<p>After this operations you should have something like:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #66cc66;">&#91;</span>root@ms mysql<span style="color: #66cc66;">&#93;</span># mysql <span style="color: #66cc66;">-</span>u radius <span style="color: #66cc66;">-</span>p
Enter password:
Welcome <span style="color: #993333; font-weight: bold;">TO</span> the MySQL monitor<span style="color: #66cc66;">.</span>  Commands <span style="color: #993333; font-weight: bold;">END</span> <span style="color: #993333; font-weight: bold;">WITH</span> ; <span style="color: #993333; font-weight: bold;">OR</span> \g<span style="color: #66cc66;">.</span>
Your MySQL connection id <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #cc66cc;">23387</span>
Server version: 5<span style="color: #66cc66;">.</span>0<span style="color: #66cc66;">.</span>77<span style="color: #66cc66;">-</span>log <span style="color: #993333; font-weight: bold;">SOURCE</span> distribution
&nbsp;
<span style="color: #993333; font-weight: bold;">TYPE</span> <span style="color: #ff0000;">'help;'</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\h</span>'</span> <span style="color: #993333; font-weight: bold;">FOR</span> help<span style="color: #66cc66;">.</span> <span style="color: #993333; font-weight: bold;">TYPE</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\c</span>'</span> <span style="color: #993333; font-weight: bold;">TO</span> clear the buffer<span style="color: #66cc66;">.</span>
&nbsp;
mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">USE</span> radius;
Reading <span style="color: #993333; font-weight: bold;">TABLE</span> information <span style="color: #993333; font-weight: bold;">FOR</span> completion <span style="color: #993333; font-weight: bold;">OF</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">AND</span> <span style="color: #993333; font-weight: bold;">COLUMN</span> names
You can turn off this feature <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #993333; font-weight: bold;">GET</span> a quicker startup <span style="color: #993333; font-weight: bold;">WITH</span> <span style="color: #66cc66;">-</span>A
&nbsp;
<span style="color: #993333; font-weight: bold;">DATABASE</span> changed
mysql<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SHOW</span> <span style="color: #993333; font-weight: bold;">TABLES</span>;
<span style="color: #66cc66;">+</span><span style="color: #808080; font-style: italic;">------------------+</span>
<span style="color: #66cc66;">|</span> Tables_in_radius <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">+</span><span style="color: #808080; font-style: italic;">------------------+</span>
<span style="color: #66cc66;">|</span> nas              <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|</span> radacct          <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|</span> radcheck         <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|</span> radgroupcheck    <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|</span> radgroupreply    <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|</span> radpostauth      <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|</span> radreply         <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">|</span> radusergroup     <span style="color: #66cc66;">|</span>
<span style="color: #66cc66;">+</span><span style="color: #808080; font-style: italic;">------------------+</span>
<span style="color: #cc66cc;">8</span> <span style="color: #993333; font-weight: bold;">ROWS</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.00</span> sec<span style="color: #66cc66;">&#41;</span>
&nbsp;
mysql<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>Now we have a working database and we need to configure FreeRadius to use SQL. </p>
<p><strong>radiusd.conf</strong></p>
<p>Open radiusd.conf file (/usr/local/etc/raddb/radiusd.conf), and uncomment <strong>$INCLUDE sql.conf</strong> line inside modules section. Save changes and exit. </p>
<p><strong>sql.conf</strong></p>
<p>Open sql.conf and edit next lines</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">        # Connection info:
        server = &quot;localhost&quot;
        #port = 3306
        login = &quot;radius&quot;
        password = &quot;radpass&quot;
&nbsp;
        # Database table configuration for everything except Oracle
        radius_db = &quot;radius&quot;</pre></div></div>

<p>to fit your settings (database name, username and password).</p>
<p><strong>dialup.conf</strong></p>
<p>Then open /usr/local/etc/raddb/sql/mysql/dialup.conf and find the next lines (near the end)</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"> # Uncomment simul_count_query to enable simultaneous use checking
        simul_count_query = &quot;SELECT COUNT(*) \
                             FROM ${acct_table1} \
                             WHERE username = '%{SQL-User-Name}' \
                             AND acctstoptime IS NULL&quot;</pre></div></div>

<p>Sometimes you will need to check users for simultaneous use and uncommenting <strong>sql</strong> in session section and uncommenting the query shown above will help you to do this. </p>
<p><strong>default</strong></p>
<p>Now open /usr/local/etc/raddb/sites-available/default and uncomment <strong>sql</strong> lines inside authorize, accounting and session sections. You can uncomment sql inside post-auth section too if you want to log login attempts (notice that this is not recommended for production servers. Your database can grow and eat up all free space in case someone tries to brute force your NAS.). </p>
<p>Then comment the next lines: <strong>files</strong> inside authorize section, <strong>detail</strong>, <strong>unix</strong> and <strong>radutmp</strong> inside accounting section and <strong>radutmp</strong> inside session section.</p>
<p>Please note that those lines we commented above are not important for now and commenting those lines can improve performance. Also, note that <strong>detail</strong> should remain uncommented in case you want to create &#8216;detail&#8217;ed log of the packets for accounting requests. You will need this in case you want to proxy accounting to another server. </p>
<p>Then save the file and check your config with radiusd -X (debugging mode).</p>
<p>After this you should see something like</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
rlm_sql (sql): Attempting to connect to radius@localhost:/radius
rlm_sql (sql): starting 0
rlm_sql (sql): Attempting to connect rlm_sql_mysql #0
rlm_sql_mysql: Starting connect to MySQL server for #0
rlm_sql (sql): Connected new DB handle, #0
rlm_sql (sql): starting 1
rlm_sql (sql): Attempting to connect rlm_sql_mysql #1
rlm_sql_mysql: Starting connect to MySQL server for #1
rlm_sql (sql): Connected new DB handle, #1
rlm_sql (sql): starting 2
rlm_sql (sql): Attempting to connect rlm_sql_mysql #2
rlm_sql_mysql: Starting connect to MySQL server for #2
rlm_sql (sql): Connected new DB handle, #2
rlm_sql (sql): starting 3
rlm_sql (sql): Attempting to connect rlm_sql_mysql #3
rlm_sql_mysql: Starting connect to MySQL server for #3
rlm_sql (sql): Connected new DB handle, #3
rlm_sql (sql): starting 4
rlm_sql (sql): Attempting to connect rlm_sql_mysql #4
rlm_sql_mysql: Starting connect to MySQL server for #4
rlm_sql (sql): Connected new DB handle, #4</pre></div></div>

<p>which means your freeradius server successfully connected to MySQL database. </p>
<p>There are hundreds of options inside the files shown above and it is impossible to explain all of them. Read comments inside config files and try to figure yourself about them. If you&#8217;re using another database scheme, you will need to set up sql.conf and dialup.conf according to your tables. All parameters are editable and it is very easy to understand them. For example if you have a large number on users (1000-xxxx) open sql.conf and increase num_sql_socks from 5 to 15 or 20. </p>
<p><strong>You should not change/delete any other lines in the config file without reading and understanding the comments!</strong></p>
<p><strong>Populating tables and testing</strong></p>
<p>This is the most important part. Before you continue, you need to know what actually do you want from FreeRadius. Which kind of connection do you expect, etc. Also, you need to know something about tables, attributes, operators, etc. </p>
<p>This is it for now&#8230;. Next time we will add some users inside database and see what we can do.</p>
<p>Stay tuned&#8230; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2011/03/freeradius-install-howto-3/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>kipmi0 problem</title>
		<link>http://www.serveradminblog.com/2011/02/kipmi0-problem/</link>
		<comments>http://www.serveradminblog.com/2011/02/kipmi0-problem/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 01:24:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=253</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2011/02/kipmi0-problem/' addthis:title='kipmi0 problem '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Few days ago one client called and asked about high CPU load on his Fedora server&#8230; It was very easy to detect that CPU is consumed by kipmi0 process. Unfortunately classic commands kill, pkill, kill -9, &#8230; didn&#8217;t help. The problem was in loaded modules (lsmod command) ipmi_si 38349 0 ipmi_msghandler 32665 1 ipmi_si I [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2011/02/kipmi0-problem/' addthis:title='kipmi0 problem '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Few days ago one client called and asked about high CPU load on his Fedora server&#8230;<br />
It was very easy to detect that CPU is consumed by kipmi0 process. Unfortunately classic commands kill, pkill, kill -9, &#8230; didn&#8217;t help. </p>
<p>The problem was in loaded modules (lsmod command)</p>
<p>ipmi_si                38349  0<br />
ipmi_msghandler        32665  1 ipmi_si</p>
<p>I didn&#8217;t have enough time to investigate about this but simple <strong>rmmod ipmi_msghandler</strong> and <strong>rmmod ipmi_si</strong> was enough to solve this problem. Well I was wrong that this will solve the problem&#8230; After reboot it was all like before&#8230; The modules are still here and kipmi0 process was too aggressive&#8230; </p>
<p>Searching on Google about this problem didn&#8217;t help a lot. After some digging, I found out that the lm_sensors is responsible for loading these modules. </p>
<p> nano /etc/sysconfig/lm_sensors gave me the answer. At the end, there are few lines</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">MODULE_0=ipmi-si
MODULE_1=ipmisensors
MODULE_2=coretemp</pre></div></div>

<p>Commenting those lines was enough to solve this problem. I suppose that this server is too old (Fedora 6) and some incompatibility exists between hardware platform and those modules&#8230; </p>
<p> If you have any info about this problem, please drop a comment so we can all learn something&#8230; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2011/02/kipmi0-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Neighbour table overflow &#8211; sysctl.conf tunning</title>
		<link>http://www.serveradminblog.com/2011/02/neighbour-table-overflow-sysctl-conf-tunning/</link>
		<comments>http://www.serveradminblog.com/2011/02/neighbour-table-overflow-sysctl-conf-tunning/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 11:23:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Networks]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=254</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2011/02/neighbour-table-overflow-sysctl-conf-tunning/' addthis:title='Neighbour table overflow &#8211; sysctl.conf tunning '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>If you have a big network with the hundreds of hosts you can expect &#8220;Neighbour table overflow&#8221; error which occurs in large networks when there are two many ARP requests which the server is not able to reply. For example you&#8217;re using server as a DHCP server, cable modems provisioning, etc. Nov 10 03:18:17 myhost [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2011/02/neighbour-table-overflow-sysctl-conf-tunning/' addthis:title='Neighbour table overflow &#8211; sysctl.conf tunning '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>If you have a big network with the hundreds of hosts you can expect &#8220;Neighbour table overflow&#8221; error which occurs in large networks when there are two many ARP requests which the server is not able to reply. For example you&#8217;re using server as a DHCP server, cable modems provisioning, etc.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Nov 10 03:18:17 myhost Neighbour table overflow.
Nov 10 03:18:23 myhost printk: 12 messages suppressed.</pre></div></div>

<p><span id="more-254"></span></p>
<p>Of curse, this can be fixed. The solution is to increase the threshhold values in /etc/sysctl.conf. Add following lines to /etc/sysctl.conf (RH based distros)</p>
<p>net.ipv4.neigh.default.gc_thresh1 = 4096<br />
net.ipv4.neigh.default.gc_thresh2 = 8192<br />
net.ipv4.neigh.default.gc_thresh3 = 8192<br />
net.ipv4.neigh.default.base_reachable_time = 86400<br />
net.ipv4.neigh.default.gc_stale_time = 86400</p>
<p>Save sysctl.conf and exec <strong>sysctl -p</strong>. You can also reboot but it isn&#8217;t necessary. </p>
<p>The default sysctl.conf file</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">net.ipv4.ip_forward=0
kernel.shmmax=68719476736
kernel.msgmax=65536
kernel.msgmnb=65536
net.ipv4.conf.default.rp_filter=1
kernel.sysrq=0
net.ipv4.conf.default.accept_source_route=0
kernel.shmall=4294967296
kernel.core_uses_pid=1
net.ipv4.tcp_syncookies=1</pre></div></div>

<p>&#8220;Tuned&#8221; systctl.conf</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">net.ipv4.ip_forward=0
kernel.shmmax=4294967295
kernel.msgmax=65536
kernel.msgmnb=65536
net.ipv4.conf.default.rp_filter=1
kernel.sysrq=0
net.ipv4.conf.default.accept_source_route=0
kernel.shmall=268435456
kernel.core_uses_pid=1
net.ipv4.tcp_syncookies=1
net.ipv4.neigh.default.gc_thresh1 = 4096
net.ipv4.neigh.default.gc_thresh2 = 8192
net.ipv4.neigh.default.gc_thresh3 = 8192
net.ipv4.neigh.default.base_reachable_time = 86400
net.ipv4.neigh.default.gc_stale_time = 86400</pre></div></div>

<p>Explanation&#8230; </p>
<p>The neighbour table is generally known as ARP table and the default value for gc_thresh1 is 128 (Adjust where the gc will leave arp table alone)</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[root@myServer ~]# cat /proc/sys/net/ipv4/neigh/default/gc_thresh1
128</pre></div></div>

<p>which is not enough for large networks (more than 128 hosts). Thats why we need to tune this value. The gc_thresh2 is a soft limit (Tell the gc when to become aggressive with arp table cleaning.) and the gc_thresh3 is a hard limit (Don&#8217;t allow the arp table to become bigger than this). </p>
<p>To enlarge the ARP cache table on the live system run:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># sysctl -w net.ipv4.neigh.default.gc_thresh3=8192
# sysctl -w net.ipv4.neigh.default.gc_thresh2=8192
# sysctl -w net.ipv4.neigh.default.gc_thresh1=4096</pre></div></div>

<p>It is possible that after distro update your systctl.conf will be replaced with the default values. Check this file periodically..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2011/02/neighbour-table-overflow-sysctl-conf-tunning/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Problem with apache &#8211; Address already in use&#8230; Unable to open logs</title>
		<link>http://www.serveradminblog.com/2011/02/problem-with-apache-address-already-in-use-unable-to-open-logs/</link>
		<comments>http://www.serveradminblog.com/2011/02/problem-with-apache-address-already-in-use-unable-to-open-logs/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 20:15:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[CentOS]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=251</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2011/02/problem-with-apache-address-already-in-use-unable-to-open-logs/' addthis:title='Problem with apache &#8211; Address already in use&#8230; Unable to open logs '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>This morning I had a problem with apache. The httpd was stopped and the #service httpd restart didn&#8217;t work. Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs The port [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2011/02/problem-with-apache-address-already-in-use-unable-to-open-logs/' addthis:title='Problem with apache &#8211; Address already in use&#8230; Unable to open logs '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>This morning I had a problem with apache. The httpd was stopped and the <em>#service httpd restart</em> didn&#8217;t work.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs</pre></div></div>

<p>The port 80 was already in use.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># fuser -k -n tcp 80</pre></div></div>

<p>was the solution&#8230; </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2011/02/problem-with-apache-address-already-in-use-unable-to-open-logs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeRadius install howto (1)</title>
		<link>http://www.serveradminblog.com/2011/01/freeradius-howto-part-1/</link>
		<comments>http://www.serveradminblog.com/2011/01/freeradius-howto-part-1/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 15:06:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[FreeRadius]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=171</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2011/01/freeradius-howto-part-1/' addthis:title='FreeRadius install howto (1) '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>FreeRADIUS is the most widely deployed RADIUS server in the world. It is the basis for multiple commercial offerings. It supplies the AAA needs of many Fortune-500 companies and Tier 1 ISPs. In this post I will try to describe basic installation and config options (at least some of them). The biggest problem for me [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2011/01/freeradius-howto-part-1/' addthis:title='FreeRadius install howto (1) '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>FreeRADIUS is the most widely deployed RADIUS server in the world. It is the basis for multiple commercial offerings. It supplies the AAA needs of many Fortune-500 companies and Tier 1 ISPs. In this post I will try to describe basic installation and config options (at least some of them). The biggest problem for me was the lack of documentation and it was very hard to learn something about it when the latest book about Radius was published 8 years ago.</p>
<p>Where possible, I recommend using the packaging system that is used for your distro. The version that is supplied might be out of date, but it is likely to work &#8220;out of the box&#8221;.</p>
<p><strong>RPM packages</strong></p>
<p>FreeRADIUS is distributed on Fedora/RHEL/CentOS systems as a set of RPM packages. There is a main package called &#8220;freeradius&#8221; and several subpackages whose name is &#8220;freeradius-XXX&#8221; where XXX is optional functionality. For example the support needed for MySQL database backend will be found in the package &#8220;freeradius-mysql&#8221;. </p>
<p>On CentOS and Red Hat, &#8220;yum install freeradius&#8221; will install FreeRadius 1.1.3 which is a several years old version. Better option is to install FreeRadius 2.x with <em>yum install freeradius2</em>. Please see the notes above about optional packages. Also, keep in mind that all config files will be installed in /etc/raddb. More info can be found <a href="http://people.redhat.com/jdennis/freeradius-rhel-centos/" target="_blank">HERE</a>.</p>
<p>More info about RPM versions can be found <a href="http://wiki.freeradius.org/Red_Hat_FAQ" target="_blank">Here</a> (Thanks J. Dennis).</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[root@ms ~]# yum search freeradius
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.centos.com.ba
 * base: mirror.centos.com.ba
 * extras: mirror.centos.com.ba
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: mirror.centos.com.ba
Excluding Packages in global exclude list
Finished
====================== Matched: freeradius ===================================
freeradius.x86_64 : High-performance and highly configurable free RADIUS server.
freeradius-mysql.x86_64 : MySQL bindings for freeradius
freeradius-postgresql.x86_64 : postgresql bindings for freeradius
freeradius-unixODBC.x86_64 : unixODBC bindings for freeradius
freeradius2.x86_64 : High-performance and highly configurable free RADIUS server
freeradius2-krb5.x86_64 : Kerberos 5 support for freeradius
freeradius2-ldap.x86_64 : LDAP support for freeradius
freeradius2-mysql.x86_64 : MySQL support for freeradius
freeradius2-perl.x86_64 : Perl support for freeradius
freeradius2-postgresql.x86_64 : Postgresql support for freeradius
freeradius2-python.x86_64 : Python support for freeradius
freeradius2-unixODBC.x86_64 : Unix ODBC support for freeradius
freeradius2-utils.x86_64 : FreeRADIUS utilities</pre></div></div>

<p>More info about basic settings will be shown later. </p>
<p><strong>Install from source</strong></p>
<p>Download the latest FreeRadius from this <a href="http://freeradius.org/download.html">link</a>. (Current version is 2.1.10)</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># wget ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-2.1.10.tar.gz
# tar xvzf freeradius-server-2.1.10.tar.gz
# cd freeradius-server-2.1.10
# ./configure</pre></div></div>

<p>It is very likely that config process will fail for some reasons. To fix this, search WARNINGS lines and install the missing rpms (<em>yum install libtood-ltdl libtool-ltdl-devel</em> is required).</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># make
# make install</pre></div></div>

<p>This is a default installation and all config files will be located in /usr/local/etc/raddb and you should find the next files inside</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[root@ms raddb]# ls -la
total 220
drwxr-xr-x 7 root root  4096 Jan 27 15:54 .
drwxr-xr-x 4 root root  4096 Jan 27 15:53 ..
-rw-r----- 1 root root   671 Jan 27 15:54 acct_users
-rw-r----- 1 root root  4174 Jan 27 15:54 attrs
-rw-r----- 1 root root   513 Jan 27 15:54 attrs.access_challenge
-rw-r----- 1 root root   458 Jan 27 15:54 attrs.access_reject
-rw-r----- 1 root root   437 Jan 27 15:54 attrs.accounting_response
-rw-r----- 1 root root  2022 Jan 27 15:54 attrs.pre-proxy
drwxr-x--- 2 root root  4096 Jan 27 15:54 certs
-rw-r----- 1 root root  6703 Jan 27 15:54 clients.conf
-rw-r----- 1 root root   883 Jan 27 15:54 dictionary
-rw-r----- 1 root root 18063 Jan 27 15:54 eap.conf
-rwxr-xr-x 1 root root  4744 Jan 27 15:54 example.pl
-rw-r----- 1 root root 12722 Jan 27 15:54 experimental.conf
-rw-r----- 1 root root  2352 Jan 27 15:54 hints
-rw-r----- 1 root root  1604 Jan 27 15:54 huntgroups
-rw-r----- 1 root root  3218 Jan 27 15:54 ldap.attrmap
drwxr-x--- 2 root root  4096 Jan 27 15:54 modules
-rw-r----- 1 root root  2840 Jan 27 15:54 policy.conf
-rw-r----- 1 root root  4873 Jan 27 15:54 policy.txt
-rw-r----- 1 root root   984 Jan 27 15:54 preproxy_users
-rw-r----- 1 root root 26529 Jan 27 15:54 proxy.conf
-rw-r----- 1 root root 27238 Jan 27 15:54 radiusd.conf
drwxr-x--- 2 root root  4096 Jan 27 15:54 sites-available
drwxr-x--- 2 root root  4096 Jan 27 15:54 sites-enabled
drwxr-x--- 7 root root  4096 Jan 27 15:54 sql
-rw-r----- 1 root root  3042 Jan 27 15:54 sql.conf
-rw-r----- 1 root root  2475 Jan 27 15:54 sqlippool.conf
-rw-r----- 1 root root  3597 Jan 27 15:54 templates.conf
-rw-r----- 1 root root  6524 Jan 27 15:54 users</pre></div></div>

<p>The default configuration is designed to work everywhere, and to provide nearly every authentication method. Do not edit the default configuration files until you understand what they do. This means reading the documentation contained in the comments of the configuration files.</p>
<p>When the server has been installed on a new machine, the first step is to start it in debugging mode, as user root:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># radiusd -X</pre></div></div>

<p>This step demonstrates that the server is installed and configured properly. If you have installed Version 2 from source, this step will also create the default certificates used for EAP authentication. If everything went OK, you should see the lines</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">......
Listening on authentication address * port 1812
Listening on accounting address * port 1813
Listening on command file /usr/local/var/run/radiusd/radiusd.sock
Listening on authentication address 127.0.0.1 port 18120 as server inner-tunnel
Listening on proxy address * port 1814
Ready to process requests.</pre></div></div>

<p>To stop freeradius press <strong>Ctrl+C</strong>. </p>
<p>Thats all for now&#8230; In next few days I will add more articles about FreeRadius. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2011/01/freeradius-howto-part-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>mcelog problem</title>
		<link>http://www.serveradminblog.com/2010/11/mcelog-problem/</link>
		<comments>http://www.serveradminblog.com/2010/11/mcelog-problem/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 14:26:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=201</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2010/11/mcelog-problem/' addthis:title='mcelog problem '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Few servers I maintain totally confused me. The loadavg is steadily increasing every round hour. With top command I can&#8217;t see any relevant process which can produce high load. top - 15:07:17 up 41 days, 3:52, 1 user, load average: 4.22, 1.61, 0.76 Tasks: 147 total, 1 running, 146 sleeping, 0 stopped, 0 zombie Cpu(s): [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2010/11/mcelog-problem/' addthis:title='mcelog problem '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Few servers I maintain totally confused me. The loadavg is steadily increasing every round hour. With top command I can&#8217;t see any relevant process which can produce high load.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">top - 15:07:17 up 41 days,  3:52,  1 user,  load average: 4.22, 1.61, 0.76
Tasks: 147 total,   1 running, 146 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.2%us,  0.7%sy,  0.0%ni, 85.5%id, 13.5%wa,  0.1%hi,  0.2%si,  0.0%st
Mem:   1025084k total,  1016732k used,     8352k free,    24472k buffers
Swap:  2064376k total,      116k used,  2064260k free,   133380k cached
&nbsp;
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 6082 root      15   0  126m 9632 5008 S  0.3  0.9   0:00.50 php
 7363 root      15   0 12736 1112  808 R  0.3  0.1   0:00.03 top
27418 root      15   0  347m 3860 1096 S  0.3  0.4   0:22.80 radiusd
    1 root      15   0 10344  680  568 S  0.0  0.1   0:01.88 init
    2 root      RT  -5     0    0    0 S  0.0  0.0   0:00.54 migration/0
    3 root      34  19     0    0    0 S  0.0  0.0   0:15.33 ksoftirqd/0
    4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
    5 root      RT  -5     0    0    0 S  0.0  0.0   0:01.81 migration/1
    6 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/1
    7 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/1
    8 root      RT  -5     0    0    0 S  0.0  0.0   0:39.01 migration/2
...</pre></div></div>

<p>The server is CentOS 5.5 64b, quad core Intel processor. After some digging I found out that 4 servers are affected and they are CentOS 5.x 64b. 32bit systems are not affected&#8230; </p>
<p>So, the first step is to check cron settings because it is obvious that something is triggered by cron (hourly). Here it is: mcelog.cron. After Googleing about this problem I found this <a href="http://bugs.centos.org/view.php?id=4019" target="_blank">LINK</a>. Or here <a href="https://bugzilla.redhat.com/show_bug.cgi?id=522827">LINK</a>.</p>
<p>The bug is &#8220;closed&#8221; but I wouldn&#8217;t say so&#8230; I had latest mcelog installed and it causes the same problem which is described above. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2010/11/mcelog-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YUM problem: rpmdb: Lock table is out of available locker entries</title>
		<link>http://www.serveradminblog.com/2010/10/yum-problem-rpmdb-lock-table-is-out-of-available-locker-entries/</link>
		<comments>http://www.serveradminblog.com/2010/10/yum-problem-rpmdb-lock-table-is-out-of-available-locker-entries/#comments</comments>
		<pubDate>Fri, 01 Oct 2010 21:00:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=187</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2010/10/yum-problem-rpmdb-lock-table-is-out-of-available-locker-entries/' addthis:title='YUM problem: rpmdb: Lock table is out of available locker entries '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>Few days ago I had a strange problem with yum and instead of clean install and update process I got Python errors and rpm message &#8220;rpmdb: Lock table is out of available locker entries&#8221;. After few minutes I found out that during installation or update process, rpm accesses the Berkeley database files and it makes [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2010/10/yum-problem-rpmdb-lock-table-is-out-of-available-locker-entries/' addthis:title='YUM problem: rpmdb: Lock table is out of available locker entries '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>Few days ago I had a strange problem with yum and instead of clean install and update process I got Python errors and rpm message &#8220;rpmdb: Lock  table is out of available locker entries&#8221;. After few minutes I found out that during installation or update process, rpm accesses the Berkeley database files and it makes temporary locker entries within the tables while it searches for data. Sometimes the locks are never cleared and we have a problem&#8230; Don&#8217;t worry&#8230; It can be fixed&#8230; </p>
<p>First here is the complete error:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[root@myserver ~]# yum install firefox
Loading &quot;fastestmirror&quot; plugin
rpmdb: Lock table is out of available locker entries
rpmdb: Unknown locker ID: 3929
error: db4 error(22) from db-&gt;close: Invalid argument
error: cannot open Packages index using db3 - Cannot allocate memory (12)
error: cannot open Packages database in /var/lib/rpm
Traceback (most recent call last):
  File &quot;/usr/bin/yum&quot;, line 29, in ?
    yummain.main(sys.argv[1:])
  File &quot;/usr/share/yum-cli/yummain.py&quot;, line 85, in main
    base.getOptionsConfig(args)
  File &quot;/usr/share/yum-cli/cli.py&quot;, line 163, in getOptionsConfig
    disabled_plugins=self.optparser._splitArg(opts.disableplugins))
  File &quot;/usr/lib/python2.4/site-packages/yum/__init__.py&quot;, line 164, in _getConf
ig
    self._conf = config.readMainConfig(startupconf)
  File &quot;/usr/lib/python2.4/site-packages/yum/config.py&quot;, line 685, in readMainCo
nfig
    yumvars['releasever'] = _getsysver(startupconf.installroot, startupconf.dist
roverpkg)
  File &quot;/usr/lib/python2.4/site-packages/yum/config.py&quot;, line 755, in _getsysver
    idx = ts.dbMatch('provides', distroverpkg)
TypeError: rpmdb open failed</pre></div></div>

<p>It looks scary <img src='http://www.serveradminblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>The first step is to backup /var/lib/rpm (in case that something goes wrong) with</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># mkdir /backup
# tar cvzf /backup/rpm-backup.tar.gz /var/lib/rpm</pre></div></div>

<p><strong>You don&#8217;t need to backup but it is highly recommended. </strong></p>
<p>Remove the Berkeley databases that rpm uses with</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># rm /var/lib/rpm/__db.00*</pre></div></div>

<p>Note: Probably there will be several files. Confirm all removal with &#8220;y&#8221;</p>
<p>Make rpm rebuild the databases from scratch (this may take a minute or two)</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># rpm --rebuilddb</pre></div></div>

<p>And that should be enough to fix this problem. Additionally you can list rpms to be sure that everything is OK.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># rpm -qa | sort</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2010/10/yum-problem-rpmdb-lock-table-is-out-of-available-locker-entries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manual MySQL update on RHEL/CentOS</title>
		<link>http://www.serveradminblog.com/2010/09/manual-mysql-update-on-rhelcentos/</link>
		<comments>http://www.serveradminblog.com/2010/09/manual-mysql-update-on-rhelcentos/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 09:37:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tips & Tricks]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=30</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2010/09/manual-mysql-update-on-rhelcentos/' addthis:title='Manual MySQL update on RHEL/CentOS '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>If you&#8217;re using RH based distros, you&#8217;ll probably notice that their habbit is to keep the same software versions in one release.  For example, if you need PHP on CentOS 5.x, # yum install php will install PHP 5.1.6  (Latest PHP version available on http://php.net is 5.3.x).  If you need MySQL, you can count on [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2010/09/manual-mysql-update-on-rhelcentos/' addthis:title='Manual MySQL update on RHEL/CentOS '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>If you&#8217;re using RH based distros, you&#8217;ll probably notice that their habbit is to keep the same software versions in one release.  For example, if you need PHP on CentOS 5.x, <strong><em># yum install php</em></strong> will install PHP 5.1.6  (Latest PHP version available on <a href="http://php.net" target="_blank">http://php.net</a> is 5.3.x).  If you need MySQL, you can count on MySQL 5.0.xx branch and any other wishes will force you to use independent repos (like <a href="http://www.jasonlitka.com/yum-repository/" target="_blank">http://www.jasonlitka.com/yum-repository/</a>). Another option is to use  &#8220;do-it-yourself&#8221; method.</p>
<p>In this post I&#8217;ll write about manual upgrade steps from rpm archives. Please keep in mind that this procedure works for me and please do not send me the private messages. I can&#8217;t help you on that way. Only options is to post your comments here and I will try to solve your problem(s).</p>
<p>First thing you need to do is to see what mysql packages do you have installed</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># rpm -qa | grep -i ^mysql</pre></div></div>

<p>You will get something like</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mysql-connector-odbc-3.51.12-2.2
mysql-5.0.77-4.el5_5.3
MySQL-python-1.2.1-1
mysql-server-5.0.77-4.el5_5.3
mysql-devel-5.0.77-4.el5_5.3
mysql-bench-5.0.77-4.el5_5.3</pre></div></div>

<p>Then backup all your databases, save them on the safe location, protect with alarms, guards, poison dogs, cobras, ninjas, etc&#8230; </p>
<p>Download rpms from http://www.mysql.com/downloads/mysql/ (MySQL-client-community-5.1.50-1.rhel5.i386.rpm, MySQL-devel-community-5.1.50-1.rhel5.i386.rpm, MySQL-server-community-5.1.50-1.rhel5.i386.rpm, MySQL-shared-community-5.1.50-1.rhel5.i386.rpm)</p>
<p>Note: if you have 32-bit OS, download i386 rpms, if you have 64bit download x86_64 rpms)</p>
<p>Stop mysql server with</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># service mysqld stop</pre></div></div>

<p>Then remove mysql rpms but with &#8211;nodeps option (in case you use yum remove mysql, you will need to reinstall a lot of apps because they will be deleted too)</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># rpm -e --nodeps mysql</pre></div></div>

<p>Repeat the same with other mysql packages (devel, bench, client,&#8230;). Then you need to install downloaded rpms with rpm -i mysql&#8230; and do it. </p>
<p>It is possible to receive the errors like</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">ls: /var/lib/mysql/*.err: No such file or directory
ls: /var/lib/mysql/*.err: No such file or directory
ERROR: 1136  Column count doesn't match value count at row 1
100910 10:24:00 [ERROR] Aborting
&nbsp;
100910 10:24:00 [Note] /usr/sbin/mysqld: Shutdown complete
&nbsp;
Installation of system tables failed!  Examine the logs in /var/lib/mysql for more information.</pre></div></div>

<p>This will be fixed later&#8230; </p>
<p>Now you need to add .my.cnf file to your root dir so you can execute mysql_upgrade command (note that . before m means that file is hidden). Add next lines inside this file (and don&#8217;t forget to replace rootpass with your real mysql root pass)</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[client]
user=root
password=rootpass</pre></div></div>

<p>(chmod .my.cnf to 600 for security reasons)</p>
<p>Then exec next command</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># service mysql start</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># mysql_upgrade</pre></div></div>

<p>This will produce the similar output</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck with default connection arguments
Running 'mysqlcheck with default connection arguments
blabla.table1                            OK
blabla.table2                             OK
blabla.table3                                OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log
Error    : You can't use locks with log tables.
status   : OK
mysql.help_category
error    : Table upgrade required. Please do &quot;REPAIR TABLE `help_category`&quot; or dump/reload to fix it!
mysql.help_keyword
error    : Table upgrade required. Please do &quot;REPAIR TABLE `help_keyword`&quot; or dump/reload to fix it!
mysql.help_relation                                OK
database2.cache
error    : Table upgrade required. Please do &quot;REPAIR TABLE `cache`&quot; or dump/reload to fix it!
database2.contacts                             OK
database2.identities                           OK
database2.messages
error    : Table upgrade required. Please do &quot;REPAIR TABLE `messages`&quot; or dump/reload to fix it!
database2.session
error    : Table upgrade required. Please do &quot;REPAIR TABLE `session`&quot; or dump/reload to fix it!
database2.users
error    : Table upgrade required. Please do &quot;REPAIR TABLE `users`&quot; or dump/reload to fix it!
&nbsp;
Repairing tables
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_topic                                   OK
mysql.proc                                         OK
mysql.time_zone_name                               OK
database2.cache
note     : The storage engine for the table doesn't support repair
database2.messages
note     : The storage engine for the table doesn't support repair
database2.session
note     : The storage engine for the table doesn't support repair
database2.users
note     : The storage engine for the table doesn't support repair
Running 'mysql_fix_privilege_tables'...
OK</pre></div></div>

<p>As you can see, the database database2 can&#8217;t be repaired and you should drop all tables inside this database and import your backup. After this, you can check is everything ok with <strong><em>mysql_upgrade &#8211;force</em></strong></p>
<p>Once again, restart mysql with service mysql restart and check logs. Test is everything ok, try ti create a new database, optimize your installation, eat something&#8230;  </p>
<p><strong>Note:</strong><br />
I had a lot of problems with this upgrade. I had to upgrade PHP to 5.3.x, I had to recompile postfix with MySQL support, I had to download and recompile Dovecot because Dovecot from CentOS repos is compiled with mysql 5.0 branch. Some versions of RoundCube doesn&#8217;t work with php 5.3.x so you should download latest, etc etc&#8230; It can be done but please be careful with this. Who knows which nuclear reactor will explode after this <img src='http://www.serveradminblog.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2010/09/manual-mysql-update-on-rhelcentos/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Upgrading PHP and MySQL on CentOS or RHEL</title>
		<link>http://www.serveradminblog.com/2010/09/upgrading-php-and-mysql-on-centos-fedora-or-rhel/</link>
		<comments>http://www.serveradminblog.com/2010/09/upgrading-php-and-mysql-on-centos-fedora-or-rhel/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 08:35:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.serveradminblog.com/?p=159</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2010/09/upgrading-php-and-mysql-on-centos-fedora-or-rhel/' addthis:title='Upgrading PHP and MySQL on CentOS or RHEL '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>I already wrote about upgrading via Jason Litka repo on this PAGE but in case you have problems with this repo, you can add Remi Collet repo. First, import Remi GPG key with #rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi # cd /etc/yum.repos.d # wget http://rpms.famillecollet.com/enterprise/remi.repo This file provides configuration for remi and remi-test repositories. Keep in mind that [...]]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://www.serveradminblog.com/2010/09/upgrading-php-and-mysql-on-centos-fedora-or-rhel/' addthis:title='Upgrading PHP and MySQL on CentOS or RHEL '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>I already wrote about upgrading via Jason Litka repo on this <a href="http://www.serveradminblog.com/2009/04/upgrading-to-php-525-on-rhel-and-centos/">PAGE</a> but in case you have problems with this repo, you can add Remi Collet repo. </p>
<p>First, import Remi GPG key with</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># cd /etc/yum.repos.d
# wget http://rpms.famillecollet.com/enterprise/remi.repo</pre></div></div>

<p>This file provides configuration for remi and remi-test repositories. Keep in mind that Remi repo is disabled by default so you can add &#8211;enablerepo=remi to yum command or you can edit line enabled=0 to enabled=1 inside remo.repo. For production servers I don&#8217;t recommend enabled=1 to remi-test repo.  </p>
<p>Current PHP is 5.3.3 and MySQL 5.1.50</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serveradminblog.com/2010/09/upgrading-php-and-mysql-on-centos-fedora-or-rhel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

