提示NOAUTH Authentication required?
我的redis 有密碼,提示NOAUTH Authentication required 配置文件中殺出密碼,服務(wù)就無(wú)法啟動(dòng)了,密碼改回來(lái),服務(wù)才能啟動(dòng)。那么代碼中如何設(shè)置密碼的?
我的redis 有密碼,提示NOAUTH Authentication required 配置文件中殺出密碼,服務(wù)就無(wú)法啟動(dòng)了,密碼改回來(lái),服務(wù)才能啟動(dòng)。那么代碼中如何設(shè)置密碼的?
2017-06-01
舉報(bào)
2017-06-01
jedis.auth("密碼");
2017-06-02
JedisPoolConfig config=new JedisPoolConfig();
config.setMaxTotal(30);
config.setMaxIdle(10);
JedisPool jedisPool=new JedisPool(config, "127.0.0.1", 6329);
Jedis jedis=null;
jedis.auth("gdserver");
try {
jedisPool.getResource();
jedis.set("name", "imooc");
String aString= jedis.get("name");
System.out.println(jedis.get("name"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally
{
if (jedis!=null) {
jedis.close();
}
if (jedisPool!=null) {
jedisPool.close();
Exception in thread "main" java.lang.NullPointerException