Redis使用教程

Linux redis安装

安装依赖

1
yum install -y gcc 

下载压缩包

1
2
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
tar -zxvf redis-5.0.3.tar.gz

编译

1
2
cd redis-5.0.3
make

指定目录安装

1
make install PREFIX=/usr/local/redis

启动服务

1
2
cd /usr/local/redis/bin/
./redis-server

后台启动

cp /usr/local/redis-5.0.3/redis.conf /usr/local/redis/bin/
修改 redis.conf文件 daemonize no 改为 daemonize yes
执行启动命令./redis-server redis.conf

配置

运行外部服务器访问,修改redis.conf
bind 127.0.0.1bind 0.0.0.0
或者启动命令加上--protected-mode no

设置开机启动

参考其他教程