Redis安装
首先要有 wget yum -y install wget
gcc yum install gcc
1、下载Redis安装包
wget http://download.redis.io/releases/redis-3.2.9.tar.gz
2、解压Redis安装包
tar -zxvf redis-3.2.9.tar.gz
3、安装
cd redis-3.2.9
make
cd src
mkdir /usr/local/redis
make install PREFIX=/usr/local/redis
4、移动配置文件到安装目录下
cd ../
mkdir /usr/local/redis/etc
mv redis.conf /usr/local/redis/etc
5、配置redis为后台启动
vi /usr/local/redis/etc/redis.conf //将daemonize no 改成daemonize yes
vi /usr/local/redis/etc/redis.conf // requirepass 123 (注意去掉前面的 “”#”号)
#bind 127.0.0.1 开启外网访问
6、开启redis
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
7、连接Redis客户端
/usr/local/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a "123"
PING 结果表示成功:
8、 关闭redis
./redis-cli -h 127.0.0.1 -p 6379 -a "123" shutdown