停止服务: 代码 redis-server--service-stop 5、删除Redis服务: 代码 redis-s

时间:2021-11-25 04:01:40

一、Redis下载地点:

https://github.com/MicrosoftArchive/redis/releases

1、Redis-x64-3.2.100.msi 为安置版

2、Redis-x64-3.2.100.zip 为压缩包

二、由于我使用的是安置版,本次问题也是安置版的问题

1、安置后的目录


停止服务: 代码 redis-server--service-stop 5、删除Redis服务: 代码 redis-s


 

2、安置版的Redis安置后处事会自动启动。



 

三、问题地址:

由于安置版的Redis处事自启动,是直接通过redis-server.exe启动的,但是,启动时并没有加载Redis的配置文件(redis.windows.conf),导致redis 中bind配置和暗码设置不生效。这导致我折腾了很久,后来才意识到这个问题。

四、Redis自启动导致的常见的问题有:

1、在CMD命令加载配置文件(redis.windows.conf)进行启动是弗成功的。提示如下:

代码  

1 D:\soft\Redis>redis-server.exe redis.windows.conf 2 [13760] 11 Jul 16:39:51.067 # Creating Server TCP listening socket 127.0.0.1:6379: bind: No error

因为Redis处事已经自启动,这里是不会再新启动的,故加载配置文件是掉败的。也没有呈现Redis启动的小盒子(下面有图片,慢慢往下看),需要注意的是Windows版的Redis安置时,默认启动加载的配置文件是redis.windows-service.conf,如下图所示:


停止服务: 代码 redis-server--service-stop 5、删除Redis服务: 代码 redis-s


 

2、暗码掉效

虽然在配置文件(redis.windows.conf)设置了暗码,暗码为123456:

代码  

1 ################################## SECURITY ################################### 2 ……省略…… 3 # requirepass foobared 4 requirepass 123456

但启动客户端进行Redis命令操纵时,是不需要暗码的,也没有提示无权限操纵,这是一个严重的安适问题。

代码  

1 D:\soft\Redis>redis-cli.exe 2 127.0.0.1:6379> get name 3 "haha" 4 127.0.0.1:6379>

3、Redis访谒IP绑定(bind)无效

Redis默认绑定的ip为127.0.0.1,但如果想内网的机器都能访谒,则需要设置内网的ip地点,如192.168.100.66,然后redis.host则可以设置为192.168.100.66访谒Redis。

Redis ip地点绑定默认说明:

代码  

1 ################################## NETWORK ##################################### 2 3 # By default, if no "bind" configuration directive is specified, Redis listens 4 # for connections from all the network interfaces available on the server. 5 # It is possible to listen to just one or multiple selected interfaces using 6 # the "bind" configuration directive, followed by one or more IP addresses. 7 # 8 # Examples: 9 # 10 # bind 192.168.1.100 10.0.0.1 11 # bind 127.0.0.1 ::1 12 # 13 # ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the 14 # internet, binding to all the interfaces is dangerous and will expose the 15 # instance to everybody on the internet. So by default we uncomment the 16 # following bind directive, that will force Redis to listen only into 17 # the IPv4 lookback interface address (this means Redis will be able to 18 # accept connections only from clients running into the same computer it 19 # is running). 20 # 21 # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES 22 # JUST COMMENT THE FOLLOWING LINE. 23 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 24 bind 127.0.0.1

主要是意思是,如果设置了bind,只能通过绑定的地点访谒Redis。