首先排除redis服務器的問題,將redis 配置文件中的 bind 127.0.0.1 注釋掉,然后將保護模式關閉 protected-mode no ,以服務端啟動redis ./redis-server ./redis.conf
然后修改本地項目配置文件,將redis相關配置放到spring下。
spring: # thymelaef 配置 thymeleaf: cache: false #redis 配置 redis: #服務器地址 host: 192.168.152.130 port: 6379 #數據庫 database: 0 #超時時間 timeout: 10000ms lettuce: pool: #最大連接數 max-active : 8 #最大連接阻塞等待時間,默認-1 max-wait: 10000ms #最大空閑連接,默認8 max-idle: 200 #最小空閑連接,默認0 min-idle: 5