我在Ubuntu上安装了memcached
。如何将它作为守护进程运行,以便它在后台运行,我可以在我的rails应用程序中使用它?
谢谢, 姆兰
答案 0 :(得分:19)
memcached
配置为默认启动,至少在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
#
在运行级别2,3,4和5中,memcached将运行。
如果您不确定,可以使用status
:
# /etc/init.d/memcached status
* memcached is running
答案 1 :(得分:0)
在ubuntu上安装memcached
apt-get install memcached
启动memcached
/etc/init.d/memcached start
重新启动memcached
/etc/init.d/memcached start
检查memcached的状态
/etc/init.d/memcached status
编辑memcached config
sudo vi /etc/memcached.conf
默认情况下,memcached将在127.0.0.1:11211
上运行,并配置为默认启动时运行
答案 2 :(得分:0)
以防万一其他人最终在这里寻找如何直接运行守护程序(例如,在docker容器内部)。您要查找的标志是-d
。
/usr/bin/memcached start -u memcached -d