課程
/后端開發
/Java
/Redis入門
我的redis 有密碼,提示NOAUTH Authentication required 配置文件中殺出密碼,服務就無法啟動了,密碼改回來,服務才能啟動。那么代碼中如何設置密碼的?
2017-06-01
源自:Redis入門 5-1
正在回答
jedis.auth("密碼");
玄鑒 提問者
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
舉報
本課程為Redis和Jedis使用的入門級教程,對Redis有初步了解
2 回答如果兩邊同時打開事務做加的操作呢?后提交的數據修改了提面提交的數據?
2 回答centos6.5 iso鏡像下載地址有哪位慕友提供一下?
1 回答老師能不能提供一份安裝所需要的內容呀??
3 回答事務執行期間redis不會再為其它的客戶端提供任何的服務,那為啥視頻中第二個窗口可以get
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
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