CentOS 7安装redis及php扩展

安装remi源

wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

rpm -Uvh remi-release-7.rpm

sed -i -e "s/enabled=1/enabled=0/g" /etc/yum.repos.d/remi.repo

确认使用remi源时安装的Redis版本。

安装Redis

使用remi源yum安装Redis。

yum install redis --enablerepo=remi

确认Redis版本。

redis-server --version

修改Redis配置文件/etc/redis.conf

想以服务形式使用Redis因此进行daemonize参数从no改为yes。

/etc/redis.conf

Redis重要特点就是数据的持久性,Redis保存数据的方法RDB文件(RDB=Redis DataBase?)及AOF(Append Only File),可同时使用RDB文件保存及AOF。RDB文件保存目录是参数dir指定的目录。

save

Will save the DB if both the given number of seconds and the given

In the example below the behaviour will be to save:

Note: you can disable saving completely by commenting out all "save" lines.

It is also possible to remove all the previously configured save

points by adding a save directive with a single empty string argument

save ""

save 900 1 # 15分钟之内有一次变更时进行保存
save 300 10# 5分钟之内有10次变更时进行保存
save 60 10000# 1分钟之内有10000次变更时进行保存

redis-cli 命令 命令行打开客户端

安装php-redis扩展及简单使用

posted @ 2017-01-15 22:48  yuenan  阅读(933)  评论(0)    收藏  举报