开发者

Ubuntu: Running Memcached as daemon

开发者 https://www.devze.com 2023-02-19 12:57 出处:网络
I have installed memcached on Ubuntu. How can I run it as a daemon so that it runs in the background and I can use it in my rails 开发者_如何学Goapplication?memcached is configured to run at boot by d

I have installed memcached on Ubuntu. How can I run it as a daemon so that it runs in the background and I can use it in my rails 开发者_如何学Goapplication?


memcached is configured to run at boot by default, at least on 10.10:

# apt-get install memcached
...
Setting up memcached (1.4.5-1ubuntu1) ...
Starting memcached: memcached.
# ls -l /etc/rc*.d/*memcached
lrwxrwxrwx 1 root root 19 2011-03-23 13:36 /etc/rc0.d/K20memcached -> ../init.d/memcached
lrwxrwxrwx 1 root root 19 2011-03-23 13:36 /etc/rc1.d/K20memcached -> ../init.d/memcached
lrwxrwxrwx 1 root root 19 2011-03-23 13:36 /etc/rc2.d/S20memcached -> ../init.d/memcached
lrwxrwxrwx 1 root root 19 2011-03-23 13:36 /etc/rc3.d/S20memcached -> ../init.d/memcached
lrwxrwxrwx 1 root root 19 2011-03-23 13:36 /etc/rc4.d/S20memcached -> ../init.d/memcached
lrwxrwxrwx 1 root root 19 2011-03-23 13:36 /etc/rc5.d/S20memcached -> ../init.d/memcached
lrwxrwxrwx 1 root root 19 2011-03-23 13:36 /etc/rc6.d/K20memcached -> ../init.d/memcached
#  

In runlevels 2, 3, 4, and 5, memcached will be running.

If you're not sure, you can run the initscript with status:

# /etc/init.d/memcached status
 * memcached is running


Just in case anyone else ends up here looking for how to run the daemon directly (like inside a docker container for example). The flag you're looking for is -d.

/usr/bin/memcached start -u memcached -d


To install memcached on ubuntu

apt-get install memcached

To start memcached

/etc/init.d/memcached start

To restart memcached

/etc/init.d/memcached start

To check the status of memcached

/etc/init.d/memcached status

To edit memcached config

sudo vi /etc/memcached.conf

By default memcached will run on 127.0.0.1:11211 and is configured to run at boot by default

0

精彩评论

暂无评论...
验证码 换一张
取 消