Exception in thread 「main」 redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused: connect
at redis.clients.jedis.Connection.connect(Connection.java:154)
at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:83)
at redis.clients.jedis.Connection.sendCommand(Connection.java:93)
at redis.clients.jedis.BinaryClient.set(BinaryClient.java:100)
at redis.clients.jedis.Client.set(Client.java:29)
at redis.clients.jedis.Jedis.set(Jedis.java:65)
at cn.guyouda.redis.Test1.main(Test1.java:14)
html
1.在網上找了不少問題,很大的緣由就是防火牆沒有關閉 ,須要輸入一下命令便可,本身的電腦上顯示關了沒有用,必須在虛擬機中輸入下面命令java
systemctl stop firewalld.serviceredis
firewalld防火牆的基本使用安全
https://www.cnblogs.com/moxiaoan/p/5683743.html.net
2.註釋掉 bind 127.0.0.1或者改爲本身的虛擬機地址htm
三、關閉安全模式: protected-mode no
blog
四、重啓虛擬機,redis,而後就能夠正常訪問了
虛擬機