我已经在Ubuntu上安装了memcached。我怎样才能把它作为一个守护进程来运行,这样它就可以在后台运行,并且我可以在我的Rails应用程序中使用它?
memcached
bkhjykvo1#
memcached默认配置为在 Boot 时运行,至少在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运行initscript:
status
# /etc/init.d/memcached status * memcached is running
bfhwhh0e2#
只是为了防止其他人在这里寻找如何直接运行守护进程(比如在一个docker容器中)。
/usr/bin/memcached start -u memcached -d
ulmd4ohb3#
在ubuntu上安装memcached/etc/init.d/memcached start若要启动memcached/etc/init.d/memcached start个若要重新启动memcached/etc/init.d/memcached start检查memcached的状态/etc/init.d/memcached status编辑memcached配置sudo vi /etc/memcached.conf默认情况下,memcached将在127.0.0.1:11211上运行,并且默认情况下配置为在 Boot 时运行
/etc/init.d/memcached start
/etc/init.d/memcached status
sudo vi /etc/memcached.conf
127.0.0.1:11211
3条答案
按热度按时间bkhjykvo1#
memcached
默认配置为在 Boot 时运行,至少在10.10:在运行级别2、3、4和5中,memcached将处于运行状态。
如果您不确定,可以使用
status
运行initscript:bfhwhh0e2#
只是为了防止其他人在这里寻找如何直接运行守护进程(比如在一个docker容器中)。
ulmd4ohb3#
在ubuntu上安装memcached
/etc/init.d/memcached start
若要启动memcached
/etc/init.d/memcached start
个若要重新启动memcached
/etc/init.d/memcached start
检查memcached的状态
/etc/init.d/memcached status
编辑memcached配置
sudo vi /etc/memcached.conf
默认情况下,memcached将在
127.0.0.1:11211
上运行,并且默认情况下配置为在 Boot 时运行