> 文章列表 > Windows安装RedisJSON 模块

Windows安装RedisJSON 模块

Windows安装RedisJSON 模块

在 Windows 上安装 RedisJSON 模块可以分为以下几个步骤:

  1. 下载 RedisJSON 模块的源代码

你可以从 RedisJSON 的官方库中下载其源代码,在 Windows 上建议使用 Git Bash 或者是使用 Git 命令下载。下载命令如下:

git clone https://github.com/RedisJSON/RedisJSON.git
  1. 安装 Visual Studio Build Tools

RedisJSON 是使用 C 语言编写的,因此需要通过 Visual Studio Build Tools 来编译源代码。你可以在 Visual Studio Build Tools 的下载页面下载并安装。

  1. 安装 CMake

CMake 是一个跨平台的编译工具,源代码编译很多时候都需要用到它。你可以在 CMake 的 Windows 下载页面下载及安装。

  1. 生成 RedisJSON 模块的库文件

接下来使用 CMake 生成 RedisJSON 模块的库文件,使用以下命令进入 RedisJSON 的源码目录:

cd RedisJSON

生成库文件的命令如下:

cmake -H. -Bbuild && cmake --build build

这会在 RedisJSON 源代码根目录下的 build 目录中生成一个 redisjson.dll 文件,这个文件就是 RedisJSON 模块的库文件。

  1. 将 RedisJSON 模块的库文件加入 Redis

最后,将生成的 redisjson.dll 文件加入 Redis 的安装目录中,在 Redis 的配置文件 redis.conf 中添加以下配置项:

loadmodule /path/to/redisjson.dll

其中,/path/to/redisjson.dll 是 redisjson.dll 的绝对路径。完成之后启动 Redis 即可使用 RedisJSON 模块。

希望以上内容对你有帮助。