圆月山庄资源网 Design By www.vgjia.com
安装Redis
(1) 下载Redis
wget http://redis.googlecode.com/files/redis-2.2.11.tar.gz tar xzvf redis-2.2.11.tar.gz
(2) 编译并安装Redis
make && make install
(3) 复制并修改配置文件
cp redis.conf /etc/redis.conf vi /etc/redis.conf
注意修改以下几项:
daemonize yes loglevel warning logfile /var/log/redis.log maxmemory 2GB
(自行斟酌是不要开通Virtual Memory选项)
(4) 设置Redis-Server自动启动服务
上网下载启动脚本(gist.github.com,搜索redis init.d),并简单修改
(至少需要修改redis、REDIS_CONF_FILE)
vi /etc/init.d/redisctl chmod 755 redisctl cp /etc/init.d/redisctl /etc/rc.d/init.d/redisctl && ln -s /etc/init.d/redisctl /etc/rc.d/rc2.d/S90redisctl && ln -s /etc/init.d/redisctl /etc/rc.d/rc3.d/S90redisctl && ln -s /etc/init.d/redisctl /etc/rc.d/rc4.d/S90redisctl && ln -s /etc/init.d/mongod /etc/rc.d/rc5.d/S90redisctl chkconfig --add redisctl
(5) 重新启动后可以测试redis-server是否正常启动
```redis-cli set foo Bar redis-cli get foo
Redis自动启动脚本
```ruby #!/bin/sh # # redis - this script starts and stops the redis-server daemon # # chkconfig: 2345 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=$"Stopping $prog: " killproc $prog -QUIT retval=$"Reloading $prog: " killproc $redis -HUP RETVAL=$"$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 retval=$"Reloading $prog: " killproc $redis -HUP RETVAL=$"$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 retval=$"Reloading $prog: " killproc $redis -HUP RETVAL=$"$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
Redis自动启动脚本
记得修改:
(1) —chuid group:user
(2) ln /etc/init.d/redisctl /etc/rc2.d/redisctl,重复rc3,rc4,rc5
启动脚本:
#! /bin/sh ### BEGIN INIT INFO # Provides: redis-server # Required-Start: $syslog # Required-Stop: $syslog # Should-Start: $local_fs # Should-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: redis-server - Persistent key-value db # Description: redis-server - Persistent key-value db ### END INIT INFO DAEMON=/usr/local/bin/redis-server DAEMON_ARGS=/etc/redis.conf NAME=redis-server DESC=redis-server PIDFILE=/var/run/redis.pid test -x $DAEMON || exit 0 test -x $DAEMONBOOTSTRAP || exit 0 set -e case "$1" in start) echo -n "Starting $DESC: " touch $PIDFILE # chown redis:redis $PIDFILE if start-stop-daemon —start —quiet —umask 007 —pidfile $PIDFILE —chuid redis:redis —exec $DAEMON — $DAEMON_ARGS then echo "$NAME." else echo "failed" fi ;; stop) echo -n "Stopping $DESC: " if start-stop-daemon —stop —retry 10 —quiet —oknodo —pidfile $PIDFILE —exec $DAEMON then echo "$NAME." else echo "failed" fi rm -f $PIDFILE ;; restart|force-reload) ${0} stop ${0} start ;; *) echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0
圆月山庄资源网 Design By www.vgjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
圆月山庄资源网 Design By www.vgjia.com
暂无评论...
更新日志
2024年11月08日
2024年11月08日
- 雨林唱片《赏》新曲+精选集SACD版[ISO][2.3G]
- 罗大佑与OK男女合唱团.1995-再会吧!素兰【音乐工厂】【WAV+CUE】
- 草蜢.1993-宝贝对不起(国)【宝丽金】【WAV+CUE】
- 杨培安.2009-抒·情(EP)【擎天娱乐】【WAV+CUE】
- 周慧敏《EndlessDream》[WAV+CUE]
- 彭芳《纯色角3》2007[WAV+CUE]
- 江志丰2008-今生为你[豪记][WAV+CUE]
- 罗大佑1994《恋曲2000》音乐工厂[WAV+CUE][1G]
- 群星《一首歌一个故事》赵英俊某些作品重唱企划[FLAC分轨][1G]
- 群星《网易云英文歌曲播放量TOP100》[MP3][1G]
- 方大同.2024-梦想家TheDreamer【赋音乐】【FLAC分轨】
- 李慧珍.2007-爱死了【华谊兄弟】【WAV+CUE】
- 王大文.2019-国际太空站【环球】【FLAC分轨】
- 群星《2022超好听的十倍音质网络歌曲(163)》U盘音乐[WAV分轨][1.1G]
- 童丽《啼笑姻缘》头版限量编号24K金碟[低速原抓WAV+CUE][1.1G]