一redis简介:redis 是一个高性能的 key-value 数据库。 redis 的出现,很大程度补偿了memcached 这类 keyvalue 存储的不足,在部分场合可以对关系数据库起到很好的补充作用。它提供了 Python,Ruby,Erlang,PHP 客户端,使用很方便。Redis 的所有数据都是保存在内存中,然后不定期的通过异步方式保存到磁盘上(这称为“半持久化模式”);也可以把每一次数据变化都写入到一个appendonly file(aof)里面(这称为“全持久化模式”)。
二主机环境 rhel6.5 selinx and iptales disabled
1. Redis 安装
实验环境 172.25.254.2 vm2.example.com 上
首先得到 zxf redis-3.0.2.tar.gz
tar zxf redis-3.0.2.tar.gz
cd redis-3.0.2
make && make install
1.1. 配置并启动服务
cd utils/
./install_server.sh 这里一路回车都使用的默认
点击(此处)折叠或打开
[root@vm2 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]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server]
Selected config:
Port : 6379
Config file : /etc/redis/6379.conf
Log file : /var/log/redis_6379.log
Data dir : /var/lib/redis/6379
Executable : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
1.2简单测试,如下就证明成功
点击(此处)折叠或打开
[root@vm2 utils]# redis-cli
127.0.0.1:6379> ping
PONG
2 安装lnmp架构2.1 安装以下软件包
点击(此处)折叠或打开
[root@vm2 lnmp]# ls
nginx-1.8.0-1.el6.ngx.x86_64.rpm php-fpm-5.3.3-38.el6.x86_64.rpm
php-5.3.3-38.el6.x86_64.rpm php-gd-5.3.3-38.el6.x86_64.rpm
php-cli-5.3.3-38.el6.x86_64.rpm php-mbstring-5.3.3-38.el6.x86_64.rpm