1,下载redis源码
从官网下载
wget http://download.redis.io/releases/redis-3.0.0.tar.gz
解压源码:
tar -zxvf redis-3.0.0.tar.gz
然后
cd /usr/local/redis-3.0.0
编译并安装
make && make PREFIX=/usr/local/redis install
安装完后会在/usr/local/redis下出现一个bin目录,bin目录中就是我们要使用的内容
[root@VM-0-12-centos bin]# ls
redis-benchmark redis-check-aof redis-check-dump redis-cli redis-sentinel redis-server
一般使用redis-cli作为启动的客户端的工具,redis-server作为启动服务端的工具
前端模式启动服务端:./redis-server
可以再开一个窗口启动客户端进行存储数据测试:./redis-cli
客户端中存储数据测试:
[root@VM-0-12-centos bin]# ./redis-cli
127.0.0.1:6379>
127.0.0.1:6379> set pan zhang
OK
127.0.0.1:6379> get pan
"zhang"
127.0.0.1:6379>
配置后端启动
[root@VM-0-12-centos redis-3.0.0]# mv redis.conf /usr/local/redis/bin/
vim redis.conf
daemonize yes
进行后端模式启动:./redis-server redis.conf
然后查看是否成功启动服务:ps -aux|grep redis
[root@VM-0-12-centos bin]# ps -aux|grep redis
root 19631 0.0 0.1 20208 5172 pts/1 S+ 02:04 0:00 ./redis-cli
root 21083 0.0 0.1 140996 7460 ? Ssl 02:12 0:00 ./redis-server *:6379
root 21113 0.0 0.0 112812 972 pts/0 S+ 02:12 0:00 grep --color=auto redis
使用客户端工具关闭:./redis-cli shutdown