spring:
# redis 中间件
redis:
# redisson
redisson:
mode: single
password: 123456a
config: |
# Redisson 配置
singleServerConfig:
address: "redis://127.0.0.1:6379"
password: 123456
clientName: null
database: 15 #选择使用哪个数据库0~15
idleConnectionTimeout: 10000
pingTimeout: 1000
connectTimeout: 10000
timeout: 3000
retryAttempts: 3
retryInterval: 1500
reconnectionTimeout: 3000
failedAttempts: 3
subscriptionsPerConnection: 5
subscriptionConnectionMinimumIdleSize: 1
subscriptionConnectionPoolSize: 50
connectionMinimumIdleSize: 32
connectionPoolSize: 64
dnsMonitoringInterval: 5000
#dnsMonitoring: false
threads: 0
nettyThreads: 0
codec:
class: "org.redisson.codec.JsonJacksonCodec"
transportMode: "NIO"
一些redis的配置:
vim /usr/local/etc/redis.conf
requirepass 123456a
protected-mode no
brew services restart redis
redis-cli -h 127.0.0.1 -p 6379 -a 123456a
127.0.0.1:6379> keys *
(empty array)
redis.yml
spring:
# redis 中间件
redis:
# 集群
#cluster:
# 节点
#nodes: 127.0.0.1:6379
# redis访问密码(默认为空)
host: 127.0.0.1
password: 123456a
# redis数据库索引(默认为0)
database: 0
# redis连接超时时间(单位为毫秒)
timeout: 60000
# 是否开启ssl,默认开启
ssl: false
# redis lettuce 连接池配置,可更改为jedis,官方推荐lettuce
lettuce:
pool:
# 最大可用连接数(默认为8,负数表示无限)
max-active: 8
# 最大空闲连接数(默认为8,负数表示无限)
max-idle: 8
# 最小空闲连接数(默认为0,该值只有为正数才有作用)
min-idle: 0
# 从连接池中获取连接最大等待时间(默认为-1,单位为毫秒,负数表示无限)
max-wait: -1
brew install redis过程
$ brew install redis
Running `brew update --preinstall`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 1 formula.
==> Downloading https://ghcr.io/v2/homebrew/core/redis/manifests/6.2.6
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/redis/blobs/sha256:ac30519a604ff014e3903893ddca6c563c134002fec58df3613632e42c4d117c
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:ac30519a604ff014e3903893ddca6c563c134002fec58df3613632e42c4d117c?se=2021-12-27T02%3A40%3A00Z&sig=GSXGt12fN%2BvtBksfTgEhyAfD%2Bp
######################################################################## 100.0%
==> Pouring redis--6.2.6.monterey.bottle.tar.gz
==> Caveats
To restart redis after an upgrade:
brew services restart redis
Or, if you don't want/need a background service you can just run:
/usr/local/opt/redis/bin/redis-server /usr/local/etc/redis.conf
==> Summary
🍺 /usr/local/Cellar/redis/6.2.6: 14 files, 2.0MB
==> Running `brew cleanup redis`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).