准备环境:
Centos 6.X
redis3.+版本(自行下载,redis 的版本:副版本号奇数版本号是测试版,不建议在生产环境中使用。偶数版本时稳定版建议在生产环境中使用。3.0 版本更新比较大。集成了集群技术)
[root@VM_0_10_centos installPackage]# yum -y install gcc-c++
我这里版本:redis-3.0.0.tar.gz
第三步 解压压缩包
[root@VM_0_10_centos installPackage]# tar -zxvf redis-3.0.0.tar.gz
命令:进入 redis 的解压完毕的根目录下 执行命令:
[root@VM_0_10_centos redis-3.0.0]# make
最后显示这样
[root@VM_0_10_centos redis-3.0.0]# make install PREFIX=/usr/local/redis
cd src && make install
make[1]: Entering directory `/usr/local/soft/installPackage/redis-3.0.0/src'
Hint: It's a good idea to run 'make test' ;)
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
make[1]: Leaving directory `/usr/local/soft/installPackage/redis-3.0.0/src'
1,前端启动
在 bin 目录下执行命令: ./redis-server (ctrl+c)退出 redis
会显示这样的
(1)先将 redis 解压目录下的 redis.conf 文件拷贝到 安装好的 redis 的 bin 目录下
命令:cp redis.conf /usr/local/redis/bin
[root@VM_0_10_centos redis-3.0.0]# cp redis.conf /usr/local/redis/bin
(2)修改拷贝过来的 redis.conf 配置文件
命令:vim redis.conf
将 daemonize no 改为 yes(daemonize守护进程)
(3)启动 redis
在 bin 目录下执行命令:./redis-server redis.conf
[root@VM_0_10_centos bin]# ./redis-server redis.conf
(4)查看 redis 启动是否成功
输入命令:ps aux|grep redis
我们可以看到进程已经启动了,端口为6379
./redis-cli shutdown
这时候我们会发现,进程已经被关闭了
在 bin 目录下启动 redis 自带的客户端 ./redis-cli
常见 redis 命令:
ping--->pong
输入ping 返回pong 代表成功!