qi-chao

1、修改redis的配置文件redis.conf

cd /usr/local/bin/myconfig   # redis.conf路径
vim redis.conf
  • 注释掉 bind 127.0.0.1 或者改为 bind 0.0.0.0

  • daemonize no 改成 daemonize yes

  • protected-mode yes 改成 protected-mode no

  • 设置访问redis的密码:requirepass 123

2、开放端口6379 firewall-cmd --zone=public --add-port=6379/tcp --permanet

并且在阿里云安全组开放6379端口

3、重启防火墙服务 systemctl restart firewalld.service

4、重启redis-server redis-server myconfig/redis.conf

5、打开客户端 redis-cli -p 6379,并且验证密码 auth 123

6、测试

Jedis jedis = new Jedis("106.14.34.181", 6379);
jedis.auth("123");
System.out.println(jedis.ping());  //测试连接

分类:

技术点:

相关文章:

  • 2021-10-04
  • 2021-12-07
  • 2021-05-26
  • 2022-01-17
  • 2021-11-24
  • 2021-11-21
  • 2021-06-18
猜你喜欢
  • 2021-11-10
  • 2021-12-13
  • 2021-10-23
  • 2021-11-27
  • 2021-09-12
  • 2021-12-14
  • 2021-12-07
相关资源
相似解决方案