Windows环境中Redis的安装与部署指引

一、安装Redis服务

1、获取Redis压缩包

下面提供的是一个网盘链接用于获取Redis压缩包,此版本为8.0,支持导入.rdb数据文件。

链接:百度网盘 请输入提取码

提取码:x0f1

——来自百度网盘超级会员V5的分享

2、解压至指定文件夹

将下载好的压缩包解压到特定文件夹,比如D:\redis,解压后的内容如下:

Windows环境中Redis的安装与部署指引

3、编辑redis.conf文件

需将redis.conf里的内容全部替换成以下配置,请注意是完全覆盖原有内容哦。要是你自己知道怎么修改配置文件,也可以按自己的方式来。

# Save the DB to disk.
# save <seconds> <changes> [<seconds> <changes> ...]
#
# Redis will save the DB if the given number of seconds elapsed and it
# surpassed the given number of write operations against the DB.
#
# Snapshotting can be completely disabled with a single empty string argument
# as in following example:
#
# save ""
#
# Unless specified otherwise, by default Redis will save the DB:
#   * After 3600 seconds (an hour) if at least 1 change was performed
#   * After 300 seconds (5 minutes) if at least 100 changes were performed
#   * After 60 seconds if at least 10000 changes were performed
#
# You can set these explicitly by uncommenting the following line.
#
# save 3600 1 300 100 60 10000

save ""
port 6379 
requirepass '123456' 
maxmemory 256mb
appendonly no
maxmemory-policy allkeys-lru

# Examples:
#
# bind 192.168.1.100 10.0.0.1     # listens on two specific IPv4 addresses
# bind 127.0.0.1 ::1              # listens on loopback IPv4 and IPv6
# bind * -::*                     # like the default, all available interfaces
#
# ~~~ 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 on the
# IPv4 and IPv6 (if available) loopback interface addresses (this means Redis
# will only be able to accept client connections from the same host that it is
# running on).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# COMMENT OUT THE FOLLOWING LINE.
#
# You will also need to set a password unless you explicitly disable protected
# mode.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

bind 127.0.0.1

# Redis supports recording timestamp annotations in the AOF to support restoring
# the data from a specific point-in-time. However, using this capability changes
# the AOF format in a way that may not be compatible with existing AOF parsers.
#aof-timestamp-enabled no

# Since version 5 of RDB a CRC64 checksum is placed at the end of the file.
# This makes the format more resistant to corruption but there is a performance
# hit to pay (around 10%) when saving and loading RDB files, so you can disable it
# for maximum performances.
#
# RDB files created with checksum disabled have a checksum of zero that will
# tell the loading code to skip the check.

rdbchecksum no

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

protected-mode yes

4、启动Redis服务

在Redis的安装目录中双击install_redis.cmd文件来启动服务:

Windows环境中Redis的安装与部署指引

要是出现类似上面的提示,那就说明启动成功啦~嘻嘻。

为了方便起见,建议把Redis的路径配置到系统变量Path里,这样就不用每次都输入完整路径了。

Windows环境中Redis的安装与部署指引
Redis常用服务指令
# 卸载服务
redis-server --service-uninstall

# 开启服务
redis-server --service-start

# 停止服务
redis-server --service-stop 

二、使用可视化工具

Redis Desktop Manager

需要安装使用,不过0.9.4及以上版本是收费的。

链接:百度网盘 请输入提取码

提取码:qwqp

——来自百度网盘超级会员V5的分享

把安装包下载下来后,修改一下安装路径,接着一直点击下一步就行。

无需进行任何配置就能直接连接,如下所示:

Windows环境中Redis的安装与部署指引

界面如下:

Windows环境中Redis的安装与部署指引

这样就能够可视化操作Redis数据库啦~~

版权声明:程序员胖胖胖虎阿 发表于 2025年7月24日 下午4:40。
转载请注明:Windows环境中Redis的安装与部署指引 | 胖虎的工具箱-编程导航

相关文章

暂无评论

暂无评论...