Redis 出现错误1067的解决办法,Redis设置密码无效
Redis 出现错误1067的解决办法
Redis 错误1067:进程意外终止,Redis不能启动,Redis启动不了
windows Redis绑定ip无效,Redis设置密码无效,Windows Redis 配置不生效,
一、问题描述:
Windows Redis requirepass不生效
在Windows启动Redis服务时,发生如下错误:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Windows无法启动Redis服务。 错误1067:进程意外终止。
©Copyright 蕃薯耀 2017年7月17日
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
在Windows CMD命令行启动时提示:
©Copyright 蕃薯耀 2017年7月11日
D:softRedisredis-server.exe redis.windows.conf [9560] 15 Jul 10:33:32.364 # Creating Server TCP listening socket 192.168.100.666:6379: 不知道这样的主机。
二、解决方案:
一、问题描述:
产生这个问题的原因是因为在配置文件中绑定了局域网的地址,就如下:
在Windows启动Redis服务时,发生如下错误:
一、Redis下载地址:
bind 127.0.0.1 192.168.1.666
Java代码
但绑定的ip地址找不到,所以导致报错,Redis服务不能启动。
- Windows无法启动Redis服务(位于本地计算机上)。
- 错误1067:进程意外终止。
1、Redis-x64-3.2.100.msi 为安装版
其实Redis装在本机,127.0.0.1是可以的,但局域网的ip由于电脑重启会重新获取ip,导致ip发生变化,此时再启动Redis时,就找不到原来的局域网ip地址,造成Redis无法启动。
2、Redis-x64-3.2.100.zip 为压缩包
解决方法就是把不固定的ip地址删除掉,保留127.0.0.1,再启动就没有问题。
以上就是Redis 出现错误1067的解决办法的介绍,如有疑问请留言或到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
二、由于我使用的是安装版,本次问题也是安装版的问题
在Windows CMD命令行启动时提示:
1、安装后的目录
Java代码
2、安装版的Redis安装后服务会自动启动。
- D:softRedis>redis-server.exe redis.windows.conf
- [9560] 15 Jul 10:33:32.364 # Creating Server TCP listening socket 192.168.100.666:6379: 不知道这样的主机。
三、问题所在:
二、解决方案:
由于安装版的Redis服务自启动,是直接通过redis-server.exe启动的,但是,启动时并没有加载Redis的配置文件(redis.windows.conf),导致redis 中bind配置和密码设置不生效。这导致我折腾了很久,后来才意识到这个问题。
产生这个问题(Redis服务无法启动)的原因是因为在配置文件(redis.windows.conf)中绑定了局域网的地址,就如下:
Java代码
四、Redis自启动导致的常见的问题有:
- bind 127.0.0.1 192.168.1.666
1、在CMD命令加载配置文件(redis.windows.conf)进行启动是不成功的。提示如下:
但绑定的ip地址找不到,所以导致报错,Redis服务不能启动。
Java代码
- D:softRedis>redis-server.exe redis.windows.conf
- [13760] 11 Jul 16:39:51.067 # Creating Server TCP listening socket 127.0.0.1:6379: bind: No error
其实Redis装在本机,127.0.0.1是可以的,但局域网的ip(192.168.100.666)由于电脑重启会重新获取ip,导致ip发生变化,此时再启动Redis时,就找不到原来的局域网ip地址,造成Redis无法启动。
因为Redis服务已经自启动,这里是不会再新启动的,故加载配置文件是失败的。也没有出现Redis启动的小盒子(下面有图片,慢慢往下看)
解决方法就是把不固定的ip地址(192.168.100.666)删除掉,保留127.0.0.1,再启动就没有问题。
2、密码失效
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
虽然在配置文件(redis.windows.conf)设置了密码,密码为123456:
©Copyright 蕃薯耀 2017年7月17日
Java代码
- ################################## SECURITY ###################################
- ……省略……
- # requirepass foobared
- requirepass 123456
但启动客户端进行Redis命令操作时,是不需要密码的,也没有提示无权限操作,这是一个严重的安全问题。
Java代码
- D:softRedis>redis-cli.exe
- 127.0.0.1:6379> get name
- "haha"
- 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地址绑定默认说明:
Java代码
- ################################## NETWORK #####################################
- # By default, if no "bind" configuration directive is specified, Redis listens
- # for connections from all the network interfaces available on the server.
- # It is possible to listen to just one or multiple selected interfaces using
- # the "bind" configuration directive, followed by one or more IP addresses.
- #
- # Examples:
- #
- # bind 192.168.1.100 10.0.0.1
- # bind 127.0.0.1 ::1
- #
- #
~ WARNING ~If the computer running Redis is directly exposed to the - # internet, binding to all the interfaces is dangerous and will expose the
- # instance to everybody on the internet. So by default we uncomment the
- # following bind directive, that will force Redis to listen only into
- # the IPv4 lookback interface address (this means Redis will be able to
- # accept connections only from clients running into the same computer it
- # is running).
- #
- # IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
- # JUST COMMENT THE FOLLOWING LINE.
- #
~~~~~~~~~~~~~~~~ - bind 127.0.0.1
主要是意思是,如果设置了bind,只能通过绑定的地址访问Redis。
如果不设置bind,则所有地址都可以访问,如果在项目部署外网,所有人都可以访问到,所以这里也是个注意的地址,还是设置bind比较安全。
绑定多个ip地址:
Java代码