909422229_在windows上安装redis并设置密码,IP绑定【提供安装包】
2017-05-17 14:26
627 查看
先说废话。
Redis 是一个开源,先进的存储,并用于构建高性能,可扩展的 Web 应用程序的完美解决方案。Redis 从它的许多竞争继承来的三个主要特点:
Redis 数据库完全在内存中,使用磁盘仅用于持久性。
相比许多键值数据存储, Redis 拥有一套较为丰富的数据类型。
Redis 可以将数据复制到任意数量的从服务器。
一、下载及安装Redis
首先下载,下载方式:从 github 下载:https://github.com/MSOpenTech/redis/releases
从本站国内 CDN 节点下载:本文下方【附件】下载即可。
github Windows 版本下载
下载后的文件为:
Redis-x64-2.8.2400.zip
二、设置密码
上次我们出现过一次大规模的Redis安全事件,给我们敲响了警钟,因为我们好多项目都是图方便,很少设置密码,而Redis的默认配置又是没有密码,导致基本都是没有设置密码。Redis设置密码有2个办法。
1.修改配置文件。
在刚刚解压的目录下,我们能够找到文件名为:redis.windows-service.conf
打开后用
Ctrl + F查找:
requirepass
################################## SECURITY ###################################
# Require clients to issue AUTH before processing any other
# commands. This might be useful in environments in which you do not trust
# others with access to the host running redis-server.
#
# This should stay commented out for backward compatibility and because most
# people do not need auth (e.g. they run their own servers).
#
# Warning: since Redis is pretty fast an outside user can try up to
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
requirepass <你的密码>
# Command renaming.
#
# It is possible to change the name of dangerous commands in a shared
# environment. For instance the CONFIG command may be renamed into something
# hard to guess so that it will still be available for internal-use tools
# but not available for general clients.
#
# Example:
#
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
#
# It is also possible to completely kill a command by renaming it into
# an empty s 10805 tring:
#
# rename-command CONFIG ""
#
# Please note that changing the name of commands that are logged into the
# AOF file or transmitted to slaves may cause problems.
比如我把密码设置为:asdfklfjfasdklfjasdklfjweruoweri。
那么就修改成这样:
requirepass asdfklfjfasdklfjasdklfjweruoweri
然后重启即可。
2.配置临时密码。
也就是启动后在控制台redis-cli.exe配置,但这种极其不推荐。所以也不说了。
PS:密码尽量设置复杂一点。
3.IP绑定
Ip绑定还是在redis.windows-service.conf配置文件里。
Ctrl + F搜索
127.0.0.1能找到如下所示:
# By default Redis listens for connections from all the network interfaces
# available on the server. It is possible to listen to just one or multiple
# 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
支持这2种 IP 绑定,我们一般就绑定内网,默认是内网外网都可以访问。所以我们从安全的角度考虑,如果是本机使用就绑定 127.0.0.1 ,如果是局域网内使用请绑定本地 IP ,如:
192.168.0.8等。
如果本文对你有帮助,那么请你赞助我,让我更有激情的写下去,帮助更多的人。
相关文章推荐
- 在windows上安装redis并设置密码,IP绑定【提供安装包】
- windows Redis绑定ip无效,Redis设置密码无效,Windows Redis 配置不生效, Windows Redis requirepass不生效
- IT忍者神龟之windows Redis绑定ip无效,Redis设置密码无效,Windows Redis 配置不生效, Windows Redis requirepass不生效
- 在windows上安装redis并设置密码
- redis 安装启动及设置密码<windows>
- Windows上安装Redis并设置密码
- windows系统上安装Redis,并且设置Redis密码
- redis 安装启动及设置密码<windows>
- windows系统上安装Redis,并且设置Redis密码
- redis 安装启动及设置密码<windows>
- redis 安装启动及设置密码<windows>
- redis 安装启动及设置密码<windows>
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis
- Windows下安装并设置Redis