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> 
相关文章
相关标签/搜索