From ae58e68f4840390d04d578d29be2367583a1f40a Mon Sep 17 00:00:00 2001 From: luoxx Date: Wed, 23 Mar 2022 11:36:20 +0800 Subject: [PATCH] doc: add redis configuration documents (#53) --- docs/getting-started/config.md | 44 +++++++++++++++++++-- docs/getting-started/install/third-party.md | 1 + 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/docs/getting-started/config.md b/docs/getting-started/config.md index a24e367..8eea8be 100644 --- a/docs/getting-started/config.md +++ b/docs/getting-started/config.md @@ -116,14 +116,50 @@ halo: ```yaml halo: - # memory or level + # memory or level or redis cache: memory ``` -目前支持两种策略: +目前支持三种策略: - `memory` 将数据缓存至内存,重启服务缓存将清空。 - `level` 将数据缓存至本地,重启服务不会清空缓存。 +- `redis` 将数据缓存至 Redis,重启服务不会清空缓存,如需分布式部署 Halo,请选用此种缓存方式。 + +**注意事项**: + +- 如果选用 Redis 缓存方式,请在配置文件加入 Redis 相关配置,完整的配置示例如下: + +```yaml +server: + port: 8090 + + # Response data gzip. + compression: + enabled: true + +spring: + datasource: + # MySQL database configuration. + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://127.0.0.1:3306/halodb?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true + username: root + password: 123456 + redis: + # Redis cache configuration. + port: 6379 + database: 0 + host: 127.0.0.1 + password: 123456 + +halo: + # Your admin client path is https://your-domain/{admin-path} + admin-path: admin + + # memory or level or redis + cache: redis +``` + ### 压缩 @@ -171,7 +207,7 @@ halo: # Your admin client path is https://your-domain/{admin-path} admin-path: admin - # memory or level + # memory or level or redis cache: memory ``` @@ -196,7 +232,7 @@ halo: # Your admin client path is https://your-domain/{admin-path} admin-path: admin - # memory or level + # memory or level or redis cache: memory ``` diff --git a/docs/getting-started/install/third-party.md b/docs/getting-started/install/third-party.md index b6ecca9..54229cb 100644 --- a/docs/getting-started/install/third-party.md +++ b/docs/getting-started/install/third-party.md @@ -12,3 +12,4 @@ title: 三方指南 - [如何在 Windows 下搭建 Halo](https://ykanade.cn/2021/08/11/HaloInWindows/) - [Halo 博客建站记录](https://catchersun.cn/archives/halo%E5%8D%9A%E5%AE%A2%E5%BB%BA%E7%AB%99%E8%AE%B0%E5%BD%95) - [Windows下搭建halo并配置nginx与SSL](https://blog.shikangsi.cn/archives/halo-windows) +- [Linux环境下如何分布式部署Halo](https://luoxx.top/archives/halo-distributed-deploy) \ No newline at end of file