1. Install redis under wins64
download link:
Download and install
configure windows service
Execute in the redis directory (as a windows service after execution)
redis-server --service-install redis.windows.conf
After installation, you need to manually start redis
redis-server --service-start
Out of service
redis-server --service-stop
uninstall redis service
redis-server --service-uninstall
It can be used with RunHiddenConsole to make .bat files, and it can be started quickly and automatically
2.Configuration of php+redis
Reference address:
http://www.cnblogs.com/zqifa/p/php-redis-1.html
3. Install redis in linux
$ wget http
:
//download.redis.io/releases/redis-2.8.17.tar.gz
$ tar xzf redis
-
2.8
.
17.tar
.
gz $ cd redis
-
2.8
.
17
$ make
$ make install
Use redis-server to start the service
Use redis-cli to test (need to be on another client)
Add redis to system services to ensure normal use of service commands
vim
redis.conf
其中daemonize默认值是false,pidfile默认值是pidfile /var/run/redis_6379.pid
第一个表示是否daemon化,显然我们要把它改成
daemonize yes;
第二个表示当服务以守护进程方式运行时,redis默认会把pid写入/var/run/redis_6379.pid文件,
服务运行中该文件就存在,服务一旦停止该文件就自动删除,因而可以用来判断redis是否正在运行
。
保存后退出
cd /etc
mkdir
redis
cp
/usr/redis/redis.conf /etc/redis/
6379
.conf
接着将redis_init_script脚本拷贝到
/etc/init.d/redisd
cp
/usr/redis/utils/redis_init_script
/etc/init.d/redisd
在/etc/init.d下的脚本都是可以在系统启动是自动启动的服务,而现在还缺一个系统启动时的配置:
chkconfig redisd on
然后就会发现报了一个错误:服务 redisd 不支持 chkconfig ?
#!/bin/sh
# chkconfig:
2345
90
10
# description: Redis is a persistent key-value database
至于这里2345 90 10分别代表什么意思,请参考上面的文章链接。
保存完重新拷贝到/etc/init.d/redisd后,再运行chkconfig就完成了。
一切就绪之后,可以执行以下命令检验service是否设置成功:
service redisd start service redisd stop
等价于
/etc/init.d/redisd start /etc/init.d/redisd stop