肯定测试环境和软件版本php
Linux : centOS-6.2
Nginx : nginx-1.2.0
MySQL : mysql-5.5.3
PHP : php-5.3.8
Redis : Redis 2.4.11 html
获取 redismysql
建立目录存放源码包nginx
mkdir -p /data0/software cd /data0/software
wget http://redis.googlecode.com/files/redis-2.4.11.tar.gz
注:须要更多版本的 Redis,移步:http://code.google.com/p/redis/downloads/listweb
编译安装 redisredis
tar zxvf redis-2.4.11.tar.gz mv redis-2.4.11 /usr/local/webserver/redis cd /usr/local/webserver/redis make && make install
redis 可执行文件sql
安装成功后,自动复制 redis 可执行文件到环境变量中shell
redis-cli:客户端程序
redis-server:服务程序
redis-check-dump:本地数据库检查
redis-check-aof:更新日志检查
redis-benchmark:性能测试,用以模拟同时由N个客户端发送 M 个 SETs/GETs 查询 (相似于 Apache 的 ab 工具)数据库
redis 启动工具
启动服务
redis-server redis.conf
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.
[解决办法]:键入 sysctl vm.overcommit_memory=1
该文件指定了内核针对内存分配的策略,其值能够是0、一、2。
0,表示内核将检查是否有足够的可用内存供应用进程使用;若是有足够的可用内存,内存申请容许;不然,内存申请失败,并把错误返回给应用进程。
1,表示内核容许分配全部的物理内存,而无论当前的内存状态如何。
2,表示内核容许分配超过全部物理内存和交换空间总和的内存
Warning: 32 bit instance detected but no memory limit set. Setting 3.5 GB maxmemory limit with 'noeviction' policy now.
[解决办法]:修改配置文件 redis.conf,将 maxmemory 设置为 maxmemory 1024000000 #分配256M内存
关闭服务
redis-cli shutdown
redis 基础配置
redis 各式文档
Redis 命令参考(中文):http://redis.readthedocs.org/en/latest/index.html
Redis 命令参考(英文):http://redis.io/commands