ubuntu 安装 redis server
ubuntu 安装 redis server
sudo apt update
sudo apt install redis-server
The following NEW packages will be installed:libhiredis0.14 libjemalloc2 liblua5.1-0 lua-bitop lua-cjson redis-server redis-tools
sudo systemctl start redis-server
sudo systemctl enable redis-server
sudo systemctl status redis-server
sudo vi /etc/redis/redis.conf
bind 0.0.0.0 ::1
protected-mode no
sudo service redis-server restart
命令即可。
测试:
sudo apt install redis-tools
redis-cli -h 192.168.xx.xxx
客户端安装后,就可以通过redis-cli命令远程连接到redis服务器了
二、服务端安装
1、suao apt install redis
2、redis-server -v
3、ss -nlt 默认端口6379
sudo systemctl disable redis-server
sudo systemctl enable redis-server
默认redis服务器监听地址为127.0.0.1 如果需要修改,配置文件在/etc/redis/redis.conf。
将bind 127.0.0.1 ::1 这行注释掉。
然后,如果需要远程连接redis,需要关闭保护模式。
修改protected-mode yes 为 no
修改后,需要重启启动redis服务器
service redis-server restart
1
# Redis数据库索引(默认为0)
spring.redis.database=0
# Redis服务器地址
spring.redis.host=127.0.0.1
# Redis服务器连接端口
spring.redis.port=6379
# Redis服务器连接密码(默认为空)
spring.redis.password=
# 连接池最大连接数(使用负值表示没有限制)
spring.redis.lettuce.pool.max-active=8
# 连接池最大阻塞等待时间(使用负值表示没有限制)
spring.redis.lettuce.pool.max-wait=-1ms
# 连接池中的最大空闲连接
spring.redis.lettuce.pool.max-idle=8
# 连接池中的最小空闲连接
spring.redis.pool.min-idle=0