需求描述
下载最新的Redis稳定版本,编译安装Redis
配置安装Redis最新稳定版本,优先参考https://redis.io/topics/quickstart
本次安装到的版本为Redis 6.0.10 2021-2-15
root@server:~# mkdir -p /root/src root@server:~# cd /root/src root@server:~# wget http://download.redis.io/redis-stable.tar.gz root@server:~# tar xvzf redis-stable.tar.gz root@server:~# cd redis-stable root@server:~# make root@server:~# make install root@server:~# which redis-cli /usr/local/bin/redis-cli root@server:~# root@server:~# which redis-server /usr/local/bin/redis-server root@server:~# cp ./redis.conf /etc/redis.conf
修改/etc/redis.conf配置文件 配置Redis的监听和一个可靠的随机密码
bind 127.0.0.1 requirepass B230dddeAE678eDb
服务器内存资源不充足的情况下,建议设置
# The above configuration tells Redis to remove any key using the LRU algorithm when the max memory of 256mb is reached. maxmemory 256mb maxmemory-policy allkeys-lru
启动redis服务端
root@server:~# /usr/local/bin/redis-server /etc/redis.conf
测试redis是否正常启动
root@server:~# /usr/local/bin/redis-cli -a B230dddeAE678eDb ping Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. PONG root@server:~#