連接失敗;在Linux上修改redis.conf文件
首先查看一下Linux上Redis的進程,後面爲redis-server 127.0.0.1:6379(很顯然這是連接不上的)
註釋掉69行本地鏈接限制(行號可能會不一致,因爲版本號不一樣內容不一樣)
# bind 127.0.0.1
和88行配置修改爲no
protected-mode no
以及#requirepass foobared去掉註釋,foobared改爲自己的密碼
停止redis任務
[root@localhost ~]# redis-cli SHUTDOWN
將其重啓,查看任務,這個時候就變成,redis-server *:6379,這個時候連接,可能你已經連接上去了,如果還連接不上,那就把Linux防火牆關閉;
CentOS7關閉防火牆
firewall-cmd --state #查看默認防火牆狀態(關閉後顯示not running,開啓後顯示running)
systemctl stop firewalld.service #停止防火牆
systemctl disable firewalld.service #禁止防火牆開機啓動
[root@localhost ~]# firewall-cmd --state
running
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# firewall-cmd --state
not running
[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]#