在windows上安装redis并设置密码,IP绑定【提供安装包】

JSON 2016-08-22 16:33:32 45835

先说废话。

Redis  是一个开源,先进的存储,并用于构建高性能,可扩展的 Web  应用程序的完美解决方案。

Redis  从它的许多竞争继承来的三个主要特点:

  1. Redis  数据库完全在内存中,使用磁盘仅用于持久性。
  2. 相比许多键值数据存储, Redis  拥有一套较为丰富的数据类型。
  3. Redis  可以将数据复制到任意数量的从服务器。

一、下载及安装Redis

首先下载,下载方式:

  1. github  下载:https://github.com/MSOpenTech/redis/releases
  2. 从本站国内 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 string:
#
# 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等。


版权所属:SO JSON在线解析

原文地址:https://www.sojson.com/blog/110.html

转载时必须以链接形式注明原始出处及本声明。


附件下载:

备注:点击文件名下载,附件源来自云端,只能在本站下载。复制下载链接无效。

本文主题:

如果本文对你有帮助,那么请你赞助我,让我更有激情的写下去,帮助更多的人。

关于作者
上天我不能,入地我不愿,我只能徘徊于天地之间。生当夏花,死而无憾!
相关文章
Redis 密码、端口、ip绑定,bat编写运行redis
阿里云Linux、代理Squid服务安装,高匿、用户/密码校验配
MySQL数据库为用户设置密码,Mysql修改密码。Mysql忘记密码解决方法
Mysql5.6下载安装,Mysql5.7下载安装Windows64位,绿色安装(解压缩安装)图文安装教程
Linux 安装 Redis 详细步骤讲解
Mac Fidder 抓替代方案 Charles-proxy 抓包工具下载 + 安装 + 破解 charles.jar 下载
Nodejs环境安装,Nodejs环境安装一篇就够了
Shiro教程(四)Shiro + Redis
Mac mtr 安装并使用,mrt: command not found
Elasticsearch教程(二),IK分词器安装
最新文章
Java获取浏览器请求头(User-Agent),分析浏览器信息,系统信息的几种办法。 138208
最热文章
Java获取浏览器请求头(User-Agent),分析浏览器信息,系统信息的几种办法。 138208
支付扫码

所有赞助/开支都讲公开明细,用于网站维护:赞助名单查看

查看我的收藏

正在加载... ...