Run memcached at startup on Fedora

If you use memcached for your server, you clearly want it to come up on system startup.  The distribution ships with init scripts for Debian, but not Fedora.

Dev411 has init scripts for Fedora, but they wouldn’t work for me – just failed silently, which is something I’ve heard other people complain about.

The problem is that your environment variable LD_LIBRARY_PATH must be set with /usr/local/lib and exported in order for the application to run.  If you set this for your own environment, those values probably aren’t going to get carried through when this init.d script runs.  A quick and dirty way to get it running is just to add the line

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

to the top of the /etc/init.d/memcached-init script and voila.

(Oh and i assume you know how to use chkconfig to setup run levels and all that – this is just the one missing step).

Advertisements

2 Responses to Run memcached at startup on Fedora

  1. hoist2k says:

    I’ve had a couple people ask me about the memcached.conf and what it’s contents should be. It’s not very well document anywhere.
    It’s very simple – just stick the command line parameters in a text file at /etc/memcached.conf on a single line. e:g:
    -u user -m 100
    That’s it!

  2. aj says:

    I’ve just spent a while figuring out these start scripts.

    In the end I hashed out the line:

    #unshift @$params, “-u root” unless (grep $_ eq ‘-u’, @$params);

    from start-memcached at http://www.dev411.com/wiki/Memcached_startup_files_for_Red_Hat_(RHEL) as it was adding “-u root” regardless of what I put in my memcached.conf and I created the following memcached.conf:

    -u nobody -d -m 512 -l 127.0.0.1
    logfile /var/log/memcached.log

    This seems to work.

    I’m still not going to learn Perl!!! 😉

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: