redis安装配置教程及phpredis扩展安装测试
来源:互联网 发布:韩顺平java视频百度云 编辑:程序博客网 时间:2024/04/28 17:59
作者:zhanhailiang 日期:2014-10-16
推荐阅读:
- Redis持久化策略
- 关于Redis更多资料阅读
1. 下载redis-2.8.17.tar.gz:http://download.redis.io/releases/redis-2.8.17.tar.gz;
2. 编译安装配置如下:
[redis-2.8.17]# make[redis-2.8.17]# make PREFIX=/usr/local/redis-2.8.17 install[redis-2.8.17]# ln -s /usr/local/redis-2.8.17/bin/redis-benchmark /usr/bin/redis-benchmark[redis-2.8.17]# ln -s /usr/local/redis-2.8.17/bin/redis-check-aof /usr/bin/redis-check-aof[redis-2.8.17]# ln -s /usr/local/redis-2.8.17/bin/redis-check-dump /usr/bin/redis-check-dump[redis-2.8.17]# ln -s /usr/local/redis-2.8.17/bin/redis-cli /usr/bin/redis-cli[redis-2.8.17]# ln -s /usr/local/redis-2.8.17/bin/redis-server /usr/bin/redis-server [redis-2.8.17]# cd utils[utils]# ./install_server.sh Welcome to the redis service installerThis script will help you easily set up a running redis server Please select the redis port for this instance: [6379] Selecting default: 6379Please select the redis config file name [/etc/redis/6379.conf] /usr/local/redis-2.8.17/conf/redis_6379.confPlease select the redis log file name [/var/log/redis_6379.log] /usr/local/redis-2.8.17/log/redis_6379.logPlease select the data directory for this instance [/var/lib/redis/6379] /usr/local/redis-2.8.17/data/6379Please select the redis executable path [/usr/bin/redis-server] Selected config:Port : 6379Config file : /usr/local/redis-2.8.17/conf/redis_6379.confLog file : /usr/local/redis-2.8.17/log/redis_6379.logData dir : /usr/local/redis-2.8.17/data/6379Executable : /usr/bin/redis-serverCli Executable : /usr/bin/redis-cliIs this ok? Then press ENTER to go on or Ctrl-C to abort.
接着开启AOF模式:appendonly yes:
############################## APPEND ONLY MODE ############################### # By default Redis asynchronously dumps the dataset on disk. This mode is# good enough in many applications, but an issue with the Redis process or# a power outage may result into a few minutes of writes lost (depending on# the configured save points).## The Append Only File is an alternative persistence mode that provides# much better durability. For instance using the default data fsync policy# (see later in the config file) Redis can lose just one second of writes in a# dramatic event like a server power outage, or a single write if something# wrong with the Redis process itself happens, but the operating system is# still running correctly.## AOF and RDB persistence can be enabled at the same time without problems.# If the AOF is enabled on startup Redis will load the AOF, that is the file# with the better durability guarantees.## Please check http://redis.io/topics/persistence for more information. appendonly yes # The name of the append only file (default: "appendonly.aof") appendfilename "appendonly_6379.aof"
通过redis服务命令重启下redis:
[redis-2.8.17]# /etc/init.d/redis_6379 --helpPlease use start, stop, restart or status as first argument[redis-2.8.17]# /etc/init.d/redis_6379 restartPlease use start, stop, restart or status as first argument
3. 下载igbinary扩展包(redis扩展包–enable-redis-igbinary依赖igbinary扩展包):http://pecl.php.net/get/igbinary-1.2.1.tgz
[redis-2.8.17]# /usr/local/php/bin/phpize[redis-2.8.17]# ./configure --with-php-config=/usr/local/php/bin/php-config --enable-igbinary[redis-2.8.17]# make && make install
4. 下载redis扩展包:http://download.redis.io/releases/redis-2.8.17.tar.gz
[redis-2.8.17]# /usr/local/php/bin/phpize[redis-2.8.17]# ./configure --with-php-config=/usr/local/php/bin/php-config --enable-redis --enable-redis-igbinary[redis-2.8.17]# make && make install
5. 修改php.ini配置:
; /usr/local/php/etc/php.iniextension=igbinary.soextension=redis.so
6. 测试扩展是否正常加载:
[redis-2.8.17]# /usr/local/php/bin/php -m[PHP Modules]...igbinary...redis... [Zend Modules]
7. 测试代码如下:
<?php$redis = new Redis();$redis->connect('127.0.0.1', 6379);$count = $redis->dbSize();echo "Redis has $count keys\n"; $ret = $redis->get('test5');var_dump($ret);
8. 安装配置Redis WEB管理工具phpRedisAdmin:https://github.com/ErikDubbelboer/phpRedisAdmin
[phpredisadmin]# git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git[phpredisadmin]# cd phpRedisAdmin[phpredisadmin]# git clone https://github.com/nrk/predis.git vendor
然后配置相应nginx配置即可看到当前Redis服务状态:
至此redis环境配置就完成了。
0 0
- redis安装配置教程及phpredis扩展安装测试
- Redis及phpredis安装配置
- Redis及phpredis安装配置
- Redis及phpredis安装配置
- Redis及phpredis安装配置
- redis安装 phpredis扩展
- redis安装+redis集群配置+phpredis扩展安装
- redis安装+redis集群配置+phpredis扩展安装
- redis安装及phpredis
- CentOS安装Redis、PHPredis扩展及Redis配置文件详解
- 安装Redis、PHPredis扩展及Redis配置文件详解
- CentOS安装Redis、PHPredis扩展及Redis配置文件详解
- Centos7下redis安装phpredis扩展安装
- php7安装redis php安装phpredis扩展
- Redis 以及 phpredis 安装配置
- linux下Redis与phpredis扩展安装
- Redis的php扩展phpredis安装
- linux下Redis与phpredis扩展安装
- android 最全的Tab与TabHost讲解
- 初学C#_5
- Java学习笔记(1)String常见面试知识总结
- Bag-of-words model (BoW模型)
- [leetcode] Path sum
- redis安装配置教程及phpredis扩展安装测试
- ext文本框TextField的处理事件
- STl全排列应用 HDU 2464
- python 第九章答案 9.5~
- source insight工程的相对路径
- Python机器学习——线性模型
- 摄氏度转换成华氏度
- 奔着作业而来(华摄氏度转华氏度),请勿喷,说的都是泪
- UVA11709- Trust groups