假设我不在乎丢失数据,是否可以仅使用没有副本的主服务器配置Redis集群?这样,我就可以扩展处理范围并减少资源消耗。
答案 0 :(得分:0)
您可以尝试此操作,并根据需要对其进行修改,使其成为单个副本Redis集群,但是如果需要,可以在其中使用PVC来保留卷,以将其删除。我正在使用ReJson
中的模块Redis
,如果不需要,也可以将其删除。
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", "test", "--appendonly", "yes", "--loadmodule", "/usr/lib/redis/modules/rejson.so"]
ports:
- containerPort: 6379
name: redis
resources:
limits:
cpu: .25
memory: 1024Mi
requests:
cpu: .25
memory: 1024Mi
volumeMounts:
- name: redis-volume
mountPath: /data
volumeClaimTemplates:
- metadata:
name: redis-volume
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi