redis安装和配置教程phpredis扩展安装测试
作者:zhanhailiang 日期:2014-10-16
推荐阅读:
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 installer
This script will help you easily set up a running redis server
Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf] /usr/local/redis-2.8.17/conf/redis_6379.conf
Please select the redis log file name [/var/log/redis_6379.log] /usr/local/redis-2.8.17/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379] /usr/local/redis-2.8.17/data/6379
Please select the redis executable path [/usr/bin/redis-server]
Selected config:
Port : 6379
Config file : /usr/local/redis-2.8.17/conf/redis_6379.conf
Log file : /usr/local/redis-2.8.17/log/redis_6379.log
Data dir : /usr/local/redis-2.8.17/data/6379
Executable : /usr/bin/redis-server
Cli Executable : /usr/bin/redis-cli
Is 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 --help
Please use start, stop, restart or status as first argument
[redis-2.8.17]# /etc/init.d/redis_6379 restart
Please 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.ini
extension=igbinary.so
extension=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环境配置完毕。
版权声明:本文博主原创文章。博客,未经同意不得转载。
redis安装和配置教程phpredis扩展安装测试的更多相关文章
- PHP-Redis扩展安装(四)
PHP-Redis扩展安装(四) 安装环境链接:http://pan.baidu.com/s/1i4IbJox Memecached 服务器安装(一) memcached php扩展(二) redis ...
- centos redis 安装 php-redis扩展安装 及使用
前提:centos7.php7 安装redis-server 1:yum install redis 编译安装php-redis 扩展 1:下载编译安装 wget https://codeload.g ...
- linux下Redis与phpredis扩展安装
++++++++++++++++++++++++++++++++++++++++++++++linux下Redis与phpredis扩展安装++++++++++++++++++++++++++++++ ...
- centos7安装redis3.0和phpredis扩展详细教程(图文)
整理一下centos7安装redis3.0和phpredis扩展的过程,有需要的朋友可以拿去使用. 一.安装redis3.0 1.安装必要的包 yum install gcc 2.centos7安装r ...
- ***phpredis扩展安装总结
phpredis扩展安装总结:PHP扩展安装在[root@iZ254lfyd6nZ lampp]# cd include 目录下创建一个目录phpredis下载扩展:wget https://gith ...
- Termux 高级终端安装使用配置教程
Termux 高级终端安装使用配置教程,这篇文章拖了有小半年.因为网上相关的文章相对来说还是比较少的,恰好今天又刷了机,所以就特意来总结一下,希望本文可以帮助到其他的小伙伴.发挥Android平台更大 ...
- Tomcat7安装及配置教程
Apache Tomcat7.0安装及配置教程.. Apache Tomcat7.0官方网站链接:http://tomcat.apache.org/ apache-tomcat-7.0.73-wi ...
- Tomcat8安装及配置教程
Apache Tomcat8.0安装及配置教程.. Apache Tomcat8.0官方网站链接:http://tomcat.apache.org/ apache-tomcat-8.0.39-wi ...
- Mysql免安装版配置教程和常用命令图
Mysql免安装版配置教程 图文版 配置环境变量 新建一个my.ini文件,添加下面内容 [mysqld] basedir=C:\\software\Mysql\mysql-5.7.14-winx64 ...
随机推荐
- log4j 实例 , 浅析
一.新建log4j.propperties,放在工程的src目录下. #fileAppender log4j.rootCategory = DEBUG,file,consoleAppender log ...
- 《Linux Device Drivers》 第十七章 网络驱动程序——note
基本介绍 第三类是标准的网络接口Linux设备,本章介绍的内核,其余的交互网络接口描述 网络接口,必须使用特定的内核数据结构本身注册,与外部分组交换数据线打电话时准备 经常使用的文件上的网络接口操作是 ...
- jQuery来源学习笔记:整体结构
1.1.由于调用一个匿名函数: (function( window, undefined ) { // jquery code })(window); 这是一个自调用匿名函数,第一个括号内是一个匿名函 ...
- Java二叉排序树(转)
一.二叉排序树定义 1.二叉排序树的定义 二叉排序树(Binary Sort Tree)又称二叉查找(搜索)树(Binary Search Tree).其定义为:二叉排序树或者是空树,或者是满足如下性 ...
- CentOS配置smaba与Windows共享文件
操作环境:CentOS 6.5 64bit Linux与Linux间通过什么共享文件呢--NFS,Windows与Windows之间呢--共享文件功能就OK了,那Windows与Linux之间呢? 这 ...
- 三种方式上传文件-Java
前言:负责,因为该项目他(jetty嵌入式开始SpringMvc)实现文件上传的必要性,并拥有java文件上传这一块还没有被曝光.并 Http 更多晦涩协议.因此,这种渐进的方式来学习和实践上载文件的 ...
- maven配置文件里改动默认jre
方法一:打开%maven_home%\conf\setting.xml,仅仅会在新建项目时自己主动使用1.6的导入项目不会 在<profiles>标签内加入�例如以下配置: <pro ...
- 【Web探索之旅】第一部分:什么是Web?
内容简介 1.Web探索之旅:开宗明义 2.第一部分第一课:什么是Web? 3.第一部分第二课:Web,服务和云 4.第一部分第三课:Web的诞生史 Web探索之旅:开宗明义 大家好. 我们这个系列课 ...
- c#中 uint--byte[]--char[]--string相互转换汇总
原文:c#中 uint--byte[]--char[]--string相互转换汇总 在在做一些互操作的时候往往需要一些类型的相互转换,比如用c#访问win32api的时候往往需要向api中传入DWOR ...
- BZOJ3362 [Usaco2004 Feb]Navigation Nightmare 导航噩梦
标题效果:自脑补. 思维:与维护两个维度和可设置为检查右. 注意,标题给予一堆关系的.我们应该加入两对关系. Code: #include <cstdio> #include <cs ...