redis windows环境安装

一、Windows环境安装

1、解压压缩包产生文件

 进行安装,在Windows的cmd命令窗口进行如下操作

1.1、进入redis解压的目录

1.2、执行redis-server.exe redis.windows-service.conf

1.3、执行redis-server.exe redis.windows.conf

 

至此redis安装完成,在cmd窗口 执行redis-cli.exe命令可测试安装是否正常

2、但是至此,当主机没事关键重启的时候redis不会随机器启动而重启,因此需要我们将redis的服务商设置成开机自动启动

2.1,在redis的目录下执行(执行后就作为windows服务了)

redis-server --service-install redis.windows.conf

2.2,安装好后需要手动启动redis

redis-server --service-start

2.3,停止服务

redis-server --service-start

2.4,卸载redis服务

redis-server --service-uninstall

3、当redis是以默认的配置进行启动的时候,其服务其他机器是不能连接的,因此需要配置redis的启动参数使其能够进行远程连接服务

修改redis的启动配置文件redis.windows.conf配置文件


################################## INCLUDES ###################################

# Include one or more other config files here.  This is useful if you
# have a standard template that goes to all Redis servers but also need
# to customize a few per-server settings.  Include files can include
# other files, so use this wisely.
#
# Notice option "include" won't be rewritten by command "CONFIG REWRITE"
# from admin or Redis Sentinel. Since Redis always uses the last processed
# line as value of a configuration directive, you'd better put includes
# at the beginning of this file to avoid overwriting config change at runtime.
#
# If instead you are interested in using includes to override configuration
# options, it is better to use include as the last line.
#
# include .\path\to\local.conf
# include c:\path\to\other.conf

################################## 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
#

将 bind 127.0.0.1 ::1 注释便可以允许远程连接,其含义为:redis服务绑定的可以连接的网络ip

因此将其注释后就没有限制的访问ip

在redis 3.0版本以后,redis增加了protected-mode,在这个模式下,即使注释掉了bind 127.0.0.1,再访问redisd时候还是报错,如下

修改办法:protected-mode no

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值