我之前安装了redis2.4.14。昨天,我得到了redis2.6.14,并直接"cd 2.6.14/src;make && make“。我移除了redis的dump.rdb和redis.log。我还将配置文件升级到2.6.14。当我安装redis-2.4.14时,我添加了redis来服务。我执行命令"service redis start",但它总是挂起没有"ok“信息。
[tys@localhost bin]# service redis start
Starting redis-server: 我可以正常地使用红葡萄酒
[tys@localhost redis]# redis-cli
redis 127.0.0.1:6379> set name tys
OK
redis 127.0.0.1:6379> get name
"tys"但如果我输入"ctrl + c“或"ctrl + z","redis-cli”将继续。
当我重新启动系统时,linux引导进程挂在“启动redis-server”(抱歉,我太“年轻”,不能发布映像)。https://groups.google.com/forum/#!topic/redis-db/iQnlyAAWE9Y)
但我能做到这是个虚拟机。redis.log中没有错误。
[1420] 11 Aug 04:27:05.879 # Server started, Redis version 2.6.14
[1420] 11 Aug 04:27:05.880 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
[1420] 11 Aug 04:27:05.903 * DB loaded from disk: 0.023 seconds
[1420] 11 Aug 04:27:05.903 * The server is now ready to accept connections on port 6379这是我的redis init.d脚本:
#!/bin/bash
#
#redis - this script starts and stops the redis-server daemon
#
# chkconfig: 235 90 10
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
redis="/usr/local/bin/redis-server"
prog=$(basename $redis)
REDIS_CONF_FILE="/etc/redis.conf"
[ -f /etc/sysconfig/redis ] && . /etc/sysconfig/redis
lockfile=/var/lock/subsys/redis
start() {
[ -x $redis ] || exit 5
[ -f $REDIS_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $redis $REDIS_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading $prog: "
killproc $redis -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac发布于 2013-08-11 05:51:09
我和Josiah在https://groups.google.com/forum/#!forum/redis-db的帮助下重新设计了它。
在我的redis.conf中,它是"daemonize no“。在我切换到"daemonize“之后,Redis就开始了。
发布于 2015-05-20 19:32:06
版本3.0.1 @ CentOS 6.6 --同样的问题。
尝试使用两个不同的init脚本。
'daemonize yes‘解决了这个问题!
https://stackoverflow.com/questions/18163839
复制相似问题