本文共 788 字,大约阅读时间需要 2 分钟。
前提:Linux一定保持联网状态
redis.conf
更改三个地方注释掉bind
在第70行左右 (命令模式直接输入70G
就直接跳转) 更改protected-mode为no
在第88行添加登录密码
在第789行的位置(更改为自己的密码我这里是123456) 这三个修改完成后Esc
然后:wq
保存退出 auth 密码
#关闭防火墙;systemctl stop firewalld.service#禁止防火墙启动;systemctl disable firewalld.service
application.properties
中添加配置 Linux的ip地址,端口号和密码 ------------(Linux中ip地址,在Linux中输入ifconfig
inet后面的就是)--------------- @SpringBootTestclass RedisSpringbootApplicationTests { @Autowired private RedisTemplate redisTemplate; @Test void contextLoads() { redisTemplate.opsForValue().set("mykey","hello yuaiiao"); System.out.println(redisTemplate.opsForValue().get("mykey")); }}
转载地址:http://mmqwi.baihongyu.com/