- 获取redis资源
wget http://download.redis.io/releases/redis-4.0.8.tar.gz
- 解压
tar xzvf redis-4.0.8.tar.gz
- 安装
cd redis-4.0.8
make
cd src
make install PREFIX=/usr/local/redis
- 移动配置文件到安装目录下
cd ../
mkdir /usr/local/redis/etc
mv redis.conf /usr/local/redis/etc
- 配置redis为后台启动
vi /usr/local/redis/etc/redis.conf //将daemonize no 改成daemonize yes
- 将redis加入到开机启动
vi /etc/rc.local //在里面添加内容:/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
(意思就是开机调用这段开启redis的命令)
- 开启redis
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
image.png
-
启动redis
两种方式:
(1)后台程序方式运行:redis-server &
(2)或:redis-server
image.png -
检测后台进程是否存在
ps -ef |grep redis
image.png
- 检测6379端口是否在监听
netstat -lntp | grep 6379
image.png
- 关闭redis
redis-cli shutdown
网友评论