redis

来源:互联网 发布:软件光盘品牌 编辑:程序博客网 时间:2024/05/21 06:46

1.centos6.5安装redis

wgt http://download.redis.io/releases/redis-stable.tar.gztar zxvf redis-stable.tar.gzcd redis-stablemakemake installmake test

根据提示

You need tcl 8.5 or newer in order to run the Redis test

所以安装tcl

wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz  tar xzvf tcl8.6.1-src.tar.gz cd  tcl8.6.1/unix./configure  make  make install  

2.尝试启动redis

遇到问题

WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot.

按照提示做。

继续尝试启动redis-server

./redis-server ../redis.conf

发现启动了但是不能退出

这里写图片描述

需要把redis-server设置为后台运行(守护进程)

vi redis.conf设置里面的daemonize 为yes 即可

继续尝试启动redis-server

redis-server ../redis.conf

启动成功

redis-cli

测试一下

这里写图片描述

ok了

3.关联php

0 0