on Mar 11th, 2009Munin and Use of uninitializer value in eval

On some of freshly installed servers (Debian Etch), I encountered these error messages in /var/log/munin/munin-node.log:

Use of uninitialized value in eval {block} exit at /usr/sbin/munin-node line 456, <CHILD> line 8.

What a great error message :)

After digging into Google results, I found it was just a problem with host_name variable in the configuration. Default value is hostname.localdomain. I’ve replaced it with a valid hostname and it works!

on Mar 9th, 2009Nginx and worker_connections are more than open file resource limit warning

If you encounter this warning message under Linux:

2009/03/09 21:23:19 [warn] 26827#0: 4096 worker_connections are more than open file resource limit: 1024

A solution is to use the command ulimit in nginx start script, just before lunching nginx:

[...]
ulimit  -n 65536
[...]

on Feb 24th, 2009Debian Lenny and perl locales warning messages

If like me you just have upgraded your Debian system to Lenny, you probably encounter the following warnings while launching perl:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "fr_FR.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

To get rid of these annoying messages, I’ve just reconfigured locales with the command:

# dpkg-reconfigure locales

Choose your locale when you’re asked for your “Default locale for the system environment”.

You should have a message like:

Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.

Then, logout, login and your perl installation works fine!

on Nov 27th, 2008Check if cron is working with monit

I encountered a problem last week with cron. crond was running but the jobs seems to not work. After debugging the crontab, I saw that on one job, the username was missing.

Nothing was written in the logs to say that there was a problem.

To avoid future problems, I wrote an alert for monit.

In my crontab, I’ve added the following job:

*/5 * * * *       root    touch /tmp/check_cron

This job will update the timestamp of the file /tmp/check_cron every 5 minutes.

And in monit configuration (/etc/monit/monitrc), I’ve added the following alert:

check file check_cron with path /tmp/check_cron
        if timestamp > 10 minutes then alert

If the crontab is not working, monit will send you an alert email like this:

Subject: monit alert --  Exists check_cron

Exists Service check_cron 

	Date:        Thu, 27 Nov 2008 21:21:53 +0100
	Action:      alert
	Host:        myhost
	Description: 'check_cron' file exist

Your faithful employee,
monit

on Nov 25th, 2008Amazon is moving into CDN market

As read in Diamond Notes, Amazon is moving into CDN market with CloudFront.

Some Content Delivery Network providers

on Nov 21st, 2008Install gem without documentation

If you need to install your gems without extra documentation, use flags –no-rdoc and –no-ri

Example:

$ gem install --no-rdoc --no-ri rails

on Nov 14th, 2008Fix nginx increase server_names_hash_bucket_size error

When adding new virtual hosts in your nginx configuration file, you can experience this error message:

# nginx -t
2008/11/13 09:37:03 [emerg] 12299#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
2008/11/13 09:37:03 [emerg] 12299#0: the configuration file /etc/nginx/nginx.conf test failed

server_names_hash_bucket_size controls the maximum length of a virtual host entry (ie the length of the domain name).

In other words, if your domain names are long, increase this parameter.

You need to add this flag in the http context:

http {
    server_names_hash_bucket_size 64;
    ...
}

After increasing the value, test your configuration file and reload nginx:

# nginx -t
2008/11/13 09:48:06 [info] 12315#0: the configuration file /etc/nginx/nginx.conf syntax is ok
2008/11/13 09:48:06 [info] 12315#0: the configuration file /etc/nginx/nginx.conf was tested successfully
# kill -HUP `cat /var/run/nginx.pid`

on Nov 13th, 2008Install Sun Java Runtime Environment (JRE) on Debian Etch

Sun JRE is available in the non-free repository. You need to update your repositories configuration file (/etc/apt/sources.list).

Add the following line:

deb http://ftp.us.debian.org/debian/ etch main contrib non-free

Update apt with apt-get update command and you’re ready to install the JRE.

$ apt-get install sun-java5-jre

Check your java binary:

$ java -version
java version "1.5.0_14"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
Java HotSpot(TM) Client VM (build 1.5.0_14-b03, mixed mode, sharing)

on Oct 21st, 2008Benchmark disk IOs

While reading this interresting article on benchmarking disks, Benjamin Schweizer pointed out a link to a python tool he wrote: benchmark disks IOs.

I made a try on different available servers.

Server 1

  • PowerEdge 2950 – Intel(R) Xeon(R) CPU 5160  @ 3.00GHz
  • Dell PowerEdge Expandable RAID controller 5 (LSI Logic SAS based MegaRAID driver, PERC 5/i Integrated)
  • 6 disks RAID 10
  • uname -a Linux … 2.6.22.1 #1 SMP Wed Aug 8 11:02:15 CEST 2007 x86_64 GNU/Linux
# python iotest-2008-10-15 /dev/sda4 10
/dev/sda4, 397 GB, 512B blocks: 169.8 IOs/s, 84 kB/s
/dev/sda4, 397 GB, 1024B blocks: 160.7 IOs/s, 160 kB/s
/dev/sda4, 397 GB, 2 kB blocks: 153.2 IOs/s, 306 kB/s
/dev/sda4, 397 GB, 4 kB blocks: 140.2 IOs/s, 560 kB/s
/dev/sda4, 397 GB, 8 kB blocks: 133.0 IOs/s, 1 MB/s
/dev/sda4, 397 GB, 16 kB blocks: 113.2 IOs/s, 1 MB/s
/dev/sda4, 397 GB, 32 kB blocks: 85.7 IOs/s, 2 MB/s
/dev/sda4, 397 GB, 64 kB blocks: 80.0 IOs/s, 4 MB/s
/dev/sda4, 397 GB, 128 kB blocks: 74.2 IOs/s, 9 MB/s
/dev/sda4, 397 GB, 256 kB blocks: 70.9 IOs/s, 17 MB/s
/dev/sda4, 397 GB, 512 kB blocks: 62.3 IOs/s, 31 MB/s
/dev/sda4, 397 GB, 1024 kB blocks: 53.8 IOs/s, 53 MB/s

Server 2

  • PowerEdge 2950 – Intel(R) Xeon(R) CPU 5130  @ 2.00GHz
  • LSI Logic SAS based MegaRAID driver
  • 2 disks RAID 0
  • uname -a: Linux … 2.6.18-5-686 #1 SMP Fri Jun 1 00:47:00 UTC 2007 i686 GNU/Linux
# python iotest-2008-10-15 /dev/sda4 10
/dev/sda4, 220 GB, 512B blocks: 78.7 IOs/s, 39 kB/s
/dev/sda4, 220 GB, 1024B blocks: 76.9 IOs/s, 76 kB/s
/dev/sda4, 220 GB, 2 kB blocks: 77.5 IOs/s, 154 kB/s
/dev/sda4, 220 GB, 4 kB blocks: 77.9 IOs/s, 311 kB/s
/dev/sda4, 220 GB, 8 kB blocks: 76.6 IOs/s, 613 kB/s
/dev/sda4, 220 GB, 16 kB blocks: 75.5 IOs/s, 1 MB/s
/dev/sda4, 220 GB, 32 kB blocks: 73.9 IOs/s, 2 MB/s
/dev/sda4, 220 GB, 64 kB blocks: 68.5 IOs/s, 4 MB/s
/dev/sda4, 220 GB, 128 kB blocks: 58.9 IOs/s, 7 MB/s
/dev/sda4, 220 GB, 256 kB blocks: 44.7 IOs/s, 11 MB/s
/dev/sda4, 220 GB, 512 kB blocks: 33.3 IOs/s, 16 MB/s
/dev/sda4, 220 GB, 1024 kB blocks: 23.4 IOs/s, 23 MB/s

Server 3

  • PowerEdge 1950
  • Intel(R) Xeon(R) CPU E5410  @ 2.33GHz
  • LSI Logic / Symbios Logic – SAS1078 PCI-X Fusion-MPT SAS
  • 2 disks RAID 1
  • uname -a: Linux … 2.6.18-6-686 #1 SMP Tue Jun 17 21:31:27 UTC 2008 i686 GNU/Linux
# python iotest-2008-10-15 /dev/sda4 10
/dev/sda4, 220 GB, 512B blocks: 88.6 IOs/s, 44 kB/s
/dev/sda4, 220 GB, 1024B blocks: 89.6 IOs/s, 89 kB/s
/dev/sda4, 220 GB, 2 kB blocks: 87.7 IOs/s, 175 kB/s
/dev/sda4, 220 GB, 4 kB blocks: 86.4 IOs/s, 345 kB/s
/dev/sda4, 220 GB, 8 kB blocks: 86.4 IOs/s, 690 kB/s
/dev/sda4, 220 GB, 16 kB blocks: 83.6 IOs/s, 1 MB/s
/dev/sda4, 220 GB, 32 kB blocks: 79.9 IOs/s, 2 MB/s
/dev/sda4, 220 GB, 64 kB blocks: 71.9 IOs/s, 4 MB/s
/dev/sda4, 220 GB, 128 kB blocks: 59.2 IOs/s, 7 MB/s
/dev/sda4, 220 GB, 256 kB blocks: 54.2 IOs/s, 13 MB/s
/dev/sda4, 220 GB, 512 kB blocks: 34.6 IOs/s, 17 MB/s
/dev/sda4, 220 GB, 1024 kB blocks: 22.1 IOs/s, 22 MB/s

Links

on Oct 2nd, 2008Use multiple memcached daemons on FreeBSD

As you may know, when using memcached on 32-bit servers, processes can only address 4GB of virtual memory making the memcached daemon handle only 2 or 3 Gb of memory.

If you want to address more memory, you need to launch multiple memcached daemons.

I wrote an rc script , mmemcached, for FreeBSD to manage this.

To use it, you need to add this in /etc/rc.conf:

mmemcached_enable="YES"
mmemcached_servers="1 2"
mmemcached_user="nobody"
mmemcached_args="-c 8192 -t 2 -m 2048 -d"

Copy the mmemcached script in /usr/local/etc/rc.d for example and launch it with the start argument. With the above configuration it will launch two memcached daemons listening on ports 11211 and 11212 (mmemcached_servers parameter) with 2Gb of memory.

Configuration

Details of the rc.conf configuration:

  • mmemcached_enabled: let this script “startable”,
  • mmemcached_servers: List of the daemons you want to start. Each number is used to generate the port number of the daemon. For example, 2 will launch a daemon listening on port 11212,
  • mmemcached_user: user that will start the daemon,
  • mmemcached_args: flags to pass to the daemon.

Download

Download the script on github.