gpt4 book ai didi

docker - Kubernetes Redis rejson 持久化数据不保存

转载 作者:可可西里 更新时间:2023-11-01 11:06:07 25 4
gpt4 key购买 nike

我正在使用 https://hub.docker.com/r/redislabs/rejson/

apiVersion: v1
kind: Service
metadata:
name: redis
spec:
ports:
- port: 6379
name: redis
clusterIP: None
selector:
app: redis
---
apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
name: redis
spec:
selector:
matchLabels:
app: redis
serviceName: redis
replicas: 1
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redislabs/rejson
args: ["--requirepass", "pass", "--appendonly", "yes", "--save", "900", "1", "--save", "30", "2"]
ports:
- containerPort: 6379
name: redis
volumeMounts:
- name: redis-volume
mountPath: /data
volumeClaimTemplates:
- metadata:
name: redis-volume
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi

我将 arg 传递给 kubernetes 配置以使用 "--appendonly", "yes"

如果我没有传递 arg,它正在运行

`redis-cli:6379 > JSON.SET foo . '"bar"'`
OK

如果我将 arg 传递给 kubernetes 配置,它会生成错误,redis 中的 json 模块无法正常工作

`redis-cli:6379 > JSON.SET foo . '"bar"'`
(error) ERR unknown command `JSON.SET`, with args beginning with: `foo`, `.`, `"bar"`,

我正在关注这个:https://estl.tech/deploying-redis-with-persistence-on-google-kubernetes-engine-c1d60f70a043

最佳答案

redislabs/rejson 图像也需要将 loadmodule 开关作为 CMD 参数 - 这应该有效:

...
args: ["--requirepass", "pass", "--appendonly", "yes", "--save", "900", "1", "--save", "30", "2", "--loadmodule", "/usr/lib/redis/modules/rejson.so"]
...

关于docker - Kubernetes Redis rejson 持久化数据不保存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55589008/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com