一、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