简体中文
Appearance
简体中文
Appearance
本文介绍如何启用 Datalayers 的 Redis 兼容键值存储服务,并通过 redis-cli 完成最基本的连接与读写验证。
Datalayers 中的键值存储服务默认处于禁用状态。通过以下配置可开启 Redis 兼容服务。
配置文件默认路径为:/etc/datalayers/datalayers.toml
# The configurations of the Redis service.
[server.redis]
# Users can start this service only when Datalayers server starts in cluster mode.
# Do not support redis service by default.
# Default: "".
addr = "0.0.0.0:6379"
# The username.
# Default: "admin".
username = "admin"
# The password.
# Default: "public".
password = "public"其中,addr 决定 Redis 兼容服务监听的地址和端口。后续使用 redis-cli 连接时,请以这里配置的端口为准。
注意:键值存储服务仅在集群模式下支持。
# 使用 systemd
sudo systemctl restart datalayers
# 或者命令行
./target/debug/datalayers -c ./config/config.tomlredis-cli。redis-cli -p 6379连接成功后,可执行以下命令验证基础读写是否正常:
SET demo:key "hello datalayers"
GET demo:key
DEL demo:key如果 GET 返回 "hello datalayers",说明键值存储服务已经可以正常使用。