redis安装
在这里分享一下redis在windows server服务器下的redis安装,其实redis的安装在windows下还是比较容易也是非常简单的,在最后也会有安装包来分享出来。
1.首先将下载下来的redis安装包传到我们用的windows server服务器上,这里我们还是放到C盘的ceshi文件夹中,然后安装包中包含服务端和客户端,我们这里安装的是服务端。
2.通过win+R的方式启动cmd命令
3.根据我们存放的redis文件夹进入redis安装目录
C:\Users\Administrator>cd /
C:\>cd ceshi
C:\ceshi>cd redis
C:\ceshi\redis>cd 服务
C:\ceshi\redis\服务>cd Redis-x64-3.2.100
4.启动redis服务
C:\ceshi\redis\服务\Redis-x64-3.2.100>redis-server.exe redis.windows.conf
当出现以下内容,证明服务已打开
C:\ceshi\redis\服务\Redis-x64-3.2.100>redis-server.exe redis.windows.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.100 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 2572
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[2572] 04 Jun 15:44:56.803 # Server started, Redis version 3.2.100
[2572] 04 Jun 15:44:56.803 * DB loaded from disk: 0.000 seconds
[2572] 04 Jun 15:44:56.803 * The server is now ready to accept connections on po
rt 6379
redis配置
redis的配置主要是对远程客户端的连接,根据上文我们也看到了这个端口使用的是6379,第一次安装的时候redis是没有密码的,所以这里我们根据我们使用cmd命令打开的redis.windows.conf文件进行配置
这里需要配置的是IP登录地址的配置和protected-mode的配置,首先注释掉bind127.0.0.1,这样我们就可以通过别的IP地址来访问这个服务器的redis,同时将允许外部网络可以直接设置到允许的状态
这里我把这一段前面和后面的内容都复制出来,免得找不到地方
# ~~~ 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
# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
#
# When protected mode is on and if:
#
# 1) The server is not binding explicitly to a set of addresses using the
# "bind" directive.
# 2) No password is configured.
#
# The server only accepts connections from clients connecting from the
# IPv4 and IPv6 loopback addresses 127.0.0.1 and ::1, and from Unix domain
# sockets.
#
# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured, nor a specific set of interfaces
# are explicitly listed using the "bind" directive.
protected-mode no
# Accept connections on the specified port, default is 6379 (IANA #815344).
# If port 0 is specified Redis will not listen on a TCP socket.
port 6379
redis连接
1.打开我们安装包的客户端进行安装,这里基本上一直下一步就好,也没什么好说的,打开以后选择连接到Redis服务器。
2.连接设置中地址我们填写我们服务器的IP地址,本地的话直接可以通过127.0.0.1进行连接,不要忘记输入连接名。
3.最后双击我们新添加的Redis服务器完成连接
Redis安装包
链接:https://pan.baidu.com/s/1bZ6noC9f4XrW7AFbzRCqgg
提取码:5j1h