不管是spring還是原生jedis連接redis,如果連不上多半是linux服務器的問題:
1 首先確保redis端口開放:
把6379或者redis的端口開放即可
2 redis.conf配置注釋掉 bind 127.0.0.1,redis默認綁定了本地ip,只允許本機使用,所以需要注釋
3 Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to
編輯配置文件關閉保護模式,保護模式下只能本機訪問
protected-mode no
4 如果還是連接報異常,就要考慮程序配置問題了,可以再windows中先測試是否能連通
telnet ip 6379