美文网首页
远程连接 reids 异常

远程连接 reids 异常

作者: 总瓢把子 | 来源:发表于2019-08-07 10:59 被阅读0次

远程连接 reids 异常

  1. bind
    redis 默认只能本地连接,远程连接需要配置 redis.conf

    本地能连,远程也可以连接

    • vi redis.conf
    bind 127.0.0.1
    bind 0.0.0.0
    

    修改完成后,指定配置文件路径的方式来启动

    redis-server /etc/redis.conf &

报错:

redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required.

解决方法:
redis.conf中 :
protected-mode (保护模式)是否开启
requiredpassword(密码)是多少

JedisShardInfo shardInfo = new JedisShardInfo(redisHost, redisPort);
shardInfo.setPassword(redisPassword);
Jedis jedis = new Jedis(shardInfo);
jedis.connect();

相关文章

网友评论

      本文标题:远程连接 reids 异常

      本文链接:https://www.haomeiwen.com/subject/yhandctx.html