远程连接 reids 异常

远程连接 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 异常)