配置Redis3.2.5 与 php-redis

一、配置Redis

1、下载Redis3.2.5安装包

[root@zhangsan /] wget http://download.redis.io/releases/redis-3.2.5.tar.gz
2、解压、编译、安装redis-3.2.5:
[root@zhangsan /]tar -zxvf redis-3.2..tar.gz -C /usr/src/
[root@zhangsan /]cd /usr/src/redis-3.2./
[root@zhangsan /]make && make install
3、创建redis相关目录:
[root@iZ2z /]mkdir -p /home/redis/bin
[root@iZ2z /]mkdir -p /home/redis/log
[root@iZ2z /]mkdir -p /home/redis/pid
[root@iZ2z /]mkdir -p /home/redis/db
4、将可执行文件复制到自己的安装目录:/home/redis/

[root@iZ2z /]ln -s /usr/local/bin/redis-*   /home/redis/bin/
 
5、复制配置文件到自己的安装目录:/home/redis/
 
[root@iZ2z /]cp redis.conf /home/redis/
 
6、进入自己的安装目录,编辑redis.conf配置文件:
 
[root@iZ2ze /]cd /home/redis/
[root@iZ2ze /]vim /home/redis/redis.conf
#根据实际需要修改配置文件,以下仅供参考
  daemonize yes
  pidfile /home/redis/pid/redis.pid
  logfile /home/redis/log/redis.log
  dir /home/redis/db
  port 6379
7、创建redis服务脚本,并赋予权限:vim /etc/init.d/redis 
#!/bin/sh
#
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
PATH=/home/redis/bin:/sbin:/usr/bin:/bin
REDISPORT=
EXEC=/home/redis/bin/redis-server
CLIEXEC=/home/redis/bin/redis-cli
PIDFILE=/home/redis/pid/redis.pid
CONF="/home/redis/redis.conf" case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC -p $REDISPORT shutdown
while [ -x /proc/${PID} ]
do
echo "Waiting for Redis to shutdown ..."
sleep
done
echo "Redis stopped"
fi
;;
*)
echo "Please use start or stop as first argument"
;;
esac
8、添加redis服务开机启动:
 
[root@iZ2ze /] chmod a+x /etc/init.d/redis
 
9、启动redis服务:
 
[root@iZ2ze /] service redis start
[root@iZ2ze /] ps -ef | grep redis
[root@iZ2ze /] netstat -anptu | grep 6379
10、测试OK

[root@iZ2ze /]redis-cli set key1 hello 

get key1 
quit 

二、配置php-redis

1.下载phpredis

[root@iZ2ze /]git clone https://github.com/phpredis/phpredis.git 
[root@iZ2ze /]cd phpredis

2.开始编译phpredis扩展

[root@iZ2ze /] make
[root@iZ2ze /] make install

3.安装配置phpredis扩展

检查redis.so 库文件是否存在

[root@iZ2z /]# cd /usr/lib64/php/modules
[root@iZ2z modules]# ls
redis.so
#修改php.ini配置文件

[root@iZ2z modules] vim /etc/php.ini        //第881行
extention=redis.so                          //添加这一行扩展配置
[root@iZ2z modules] service php-fpm restart //重启php服务

//如果未能安装成功 请检查php配置文件是否成功添加配置并重启服务

参考文章:http://www.cnblogs.com/jeffen/p/6066325.html?utm_source=itdadao&utm_medium=referral

http://www.cnblogs.com/jimmy-lin/p/6426925.html

centos 6.8 配置 Redis3.2.5的更多相关文章

  1. 摘要: CentOS 6.5搭建Redis3.2.8伪分布式集群

    from https://my.oschina.net/ososchina/blog/856678     摘要: CentOS 6.5搭建Redis3.2.8伪分布式集群 前言 最近在服务器上搭建了 ...

  2. CentOS下Apache配置多域名或者多端口映射

    CentOS下Apache默认网站根目录为/var/www/html,假如我默认存了一个CI项目在html文件夹里,同时服务器的外网IP为ExampleIp,因为使用的是MVC框架,Apache需开启 ...

  3. CentOS 6.3配置PPTP VPN的方法

    1.验证ppp 用cat命令检查是否开启ppp,一般服务器都是开启的,除了特殊的VPS主机之外. [root@localhost1 /]# cat /dev/ppp cat: /dev/ppp: No ...

  4. 基于VMware为CentOS 6.5配置两个网卡

    为CentOS 6.5配置两块网卡,一块是eth0,一块是eth1,下面以master为例 1.选择“master”-->“编辑虚拟机设置”,如下所示 2.单击“添加”,如下 3.选择“网络适配 ...

  5. Centos下安装配置LAMP(Linux+Apache+MySQL+PHP)

    Centos下安装配置LAMP(Linux+Apache+MySQL+PHP)   关于LAMP的各种知识,还请大家自行百度谷歌,在这里就不详细的介绍了,今天主要是介绍一下在Centos下安装,搭建一 ...

  6. CentOS 6.5配置nfs服务

    CentOS 6.5配置nfs服务 网络文件系统(Network File System,NFS),一种使用于分散式文件系统的协议,由升阳公司开发,于1984年向外公布.功能是通过网络让不同的机器.不 ...

  7. CentOS安装与配置LNMP

    本文PDF文档下载:http://www.coderblog.cn/doc/Install_and_config_LNMP_under_CentOS.pdf 本文EPUB文档下载:http://www ...

  8. [转]CENTOS 6.5 配置YUM安装NGINX+服务器负载均衡

    原文连接: CENTOS 6.5 配置YUM安装NGINX  http://blog.sina.com.cn/s/blog_69f467b70102uyux.html 参考博文: Centos下安装. ...

  9. Tigase XMPP Server在CentOS部署和配置

    Tigase XMPP Server在CentOS部署与配置 作者:chszs,转载需注明.博客主页:http://blog.csdn.net/chszs 以下讲述Tigase XMPP Server ...

随机推荐

  1. 了解一下RabbitMQ

    RabbitMQ概述 RabbitMQ是遵从AMQP协议的 通信协议都设计到报文交互,换句话说RabbitMQ就是AMQP协议的Erlang的实现. AMQP说到底还是一个通信协议从low-level ...

  2. python爬虫数据解析之xpath

    xpath是一门在xml文档中查找信息的语言.xpath可以用来在xml文档中对元素和属性进行遍历. 在xpath中,有7中类型的节点,元素,属性,文本,命名空间,处理指令,注释及根节点. 节点 首先 ...

  3. C# 《编写高质量代码改善建议》整理&笔记 --(四)资源管理&序列化

    1.显示释放资源需继承接口IDisposable 什么是资源:C#中每一个类型都代表一种资源,而资源又分为以下两类. 托管资源:由CLR管理分配和释放的资源,即从CLR里new出来的对象. 非托管资源 ...

  4. java游戏开发杂谈 - java是什么

    java是一门编程语言, 它有三个开发平台:j2ee.j2se. j2me.(其实android也算一个了)      j2ee, 也就是web开发,比如网站.各类管理系统,主要是围绕数据库.网页等进 ...

  5. 时序数据库连载系列:指标届的独角兽Prometheus

    简介 Prometheus是SoundCloud公司开发的一站式监控告警平台,依赖少,功能齐全.于2016年加入CNCF,广泛用于 Kubernetes集群的监控系统中,2018.8月成为继K8S之后 ...

  6. 多线程协作wait、notify、notifyAll方法简介理解使用 多线程中篇(十四)

    在锁与监视器中有对wait和notify以及notifyAll进行了简单介绍 所有对象都有一个与之关联的锁与监视器 wait和notify以及notifyAll之所以是Object的方法就是因为任何一 ...

  7. DS标签控件文本解析格式

    DS标签控件使用DSL文本渲染引擎,支持DSL引擎代码.目前支持代码如下: <b>粗体</b> 以粗体显示 <i>斜体</i> 以斜体显示 <u& ...

  8. SpringBoot打包项目成war包,并部署到服务器的tomcat上

    最近遇到项目需要上线部署到服务器,需要讲自己的SpringBoot项目打包成war包,部署到tomcat上. 下面记录下打包部署的过程. (1) 将SpringBoot项目打包成war包, 一.修改打 ...

  9. iOS视频边下载边播放

    随着视频行业的发展,很多用户对于观看体验也有了更高的要求,以前的习惯是下载好了在观看,而现在是希望1分钟都不要等,ZUI好一边看着一边下载,等把这个视频看完也下载完了,也就是我们常说的“视频边下载边播 ...

  10. hash一致性

    参照:https://www.cnblogs.com/moonandstar08/p/5405991.html 参照:http://www.cnblogs.com/haippy/archive/201 ...