redis設置遠程鏈接

一、修改redis服務器的配置文件

  本機安裝的redis-4.0.14默認的配置文件 redis.conf 設置redis

  綁定本機地址:bind 127.0.0.1服務器

  開啓保護模式:protected-mode yesserver

  此時鏈接,服務器是拒絕的blog

     

[root@fjgh redis]# ./redis-cli -h 192.168.100.109  -p  6379 
Could not connect to Redis at 192.168.100.109:6379: Connection refused
Could not connect to Redis at 192.168.100.109:6379: Connection refused
not connected> eixt

  

        配置文件比較大,咱們經過ctrl + F  查找關鍵字修改成:進程

  bind 0.0.0.0 get

  protected-mode noit

二、重啓redis服務:先經過kill -9 殺死現有redis進程在啓動redis服務

 

[root@fjgh redis]# ps -ef|grep redis
root     10768     1  0 Jun19 ?        00:01:37 ./redis-server 127.0.0.1:6379
root     11339 11251  0 10:05 pts/1    00:00:00 grep --color=auto redis
[root@fjgh redis]# kill -9 10768
[root@fjgh redis]# ps -ef|grep redis
root     11343 11251  0 10:05 pts/1    00:00:00 grep --color=auto redis
[root@fjgh redis]# ./redis-server redis.conf
11344:C 20 Jun 10:05:46.798 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
11344:C 20 Jun 10:05:46.798 # Redis version=4.0.14, bits=64, commit=00000000, modified=0, pid=11344, just started
11344:C 20 Jun 10:05:46.798 # Configuration loaded

  

三、經過IP地址鏈接

[root@fjgh redis]# ./redis-cli -h 192.168.100.109  -p  6379 
192.168.100.109:6379> get setUpTime
"201906191227"
192.168.100.109:6379> 
相關文章
相關標籤/搜索