我无法在azure kuberenetes服务中运行cassandra,我已经制作了服务文件和statefulset yaml文件,如下所示:
(base) bert:~$ kubectl get service cassandra -o yaml
apiVersion: v1
kind: Service
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"cassandra"},"name":"cassandra","namespace":"default"},"spec":{"clusterIP":"None","ports":[{"port":9042}],"selector":{"app":"cassandra"}}}
creationTimestamp: "2024-08-30T11:09:05Z"
labels:
app: cassandra
name: cassandra
namespace: default
resourceVersion: "13709044"
uid: 9dc2efa0-6741-4dad-9ab0-904ab51c225a
spec:
clusterIP: None
clusterIPs:
- None
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- port: 9042
protocol: TCP
targetPort: 9042
selector:
app: cassandra
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
和
(base) bert:~$ kubectl get statefulset cassandra -n default -o yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apps/v1","kind":"StatefulSet","metadata":{"annotations":{},"labels":{"app":"cassandra"},"name":"cassandra","namespace":"default"},"spec":{"replicas":1,"selector":{"matchLabels":{"app":"cassandra"}},"serviceName":"cassandra","template":{"metadata":{"labels":{"app":"cassandra"}},"spec":{"containers":[{"env":[{"name":"MAX_HEAP_SIZE","value":"512M"},{"name":"HEAP_NEWSIZE","value":"100M"},{"name":"CASSANDRA_SEEDS","value":"cassandra-0.cassandra.default.svc.cluster.local"},{"name":"CASSANDRA_CLUSTER_NAME","value":"K8Demo"},{"name":"CASSANDRA_DC","value":"DC1-K8Demo"},{"name":"CASSANDRA_RACK","value":"Rack1-K8Demo"},{"name":"POD_IP","valueFrom":{"fieldRef":{"fieldPath":"status.podIP"}}}],"image":"gcr.io/google-samples/cassandra:v13","imagePullPolicy":"Always","lifecycle":{"preStop":{"exec":{"command":["/bin/sh","-c","nodetool drain"]}}},"name":"cassandra","ports":[{"containerPort":7000,"name":"intra-node"},{"containerPort":7001,"name":"tls-intra-node"},{"containerPort":7199,"name":"jmx"},{"containerPort":9042,"name":"cql"}],"readinessProbe":{"exec":{"command":["/bin/bash","-c","/ready-probe.sh"]},"initialDelaySeconds":15,"timeoutSeconds":5},"resources":{"limits":{"cpu":"2000m","memory":"4Gi"},"requests":{"cpu":"1000m","memory":"2Gi"}},"securityContext":{"capabilities":{"add":["IPC_LOCK"]}},"volumeMounts":[{"mountPath":"/cassandra_data","name":"cassandra-data"}]}],"terminationGracePeriodSeconds":500}},"volumeClaimTemplates":[{"metadata":{"name":"cassandra-data"},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}},"storageClassName":"fast"}}]}}
creationTimestamp: "2024-08-30T12:22:25Z"
generation: 1
labels:
app: cassandra
name: cassandra
namespace: default
resourceVersion: "13729005"
uid: fbc72546-b52e-4654-a0f9-0d09fff8c89c
spec:
persistentVolumeClaimRetentionPolicy:
whenDeleted: Retain
whenScaled: Retain
podManagementPolicy: OrderedReady
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: cassandra
serviceName: cassandra
template:
metadata:
creationTimestamp: null
labels:
app: cassandra
spec:
containers:
- env:
- name: MAX_HEAP_SIZE
value: 512M
- name: HEAP_NEWSIZE
value: 100M
- name: CASSANDRA_SEEDS
value: cassandra-0.cassandra.default.svc.cluster.local
- name: CASSANDRA_CLUSTER_NAME
value: K8Demo
- name: CASSANDRA_DC
value: DC1-K8Demo
- name: CASSANDRA_RACK
value: Rack1-K8Demo
- name: POD_IP
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.podIP
image: gcr.io/google-samples/cassandra:v13
imagePullPolicy: Always
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- nodetool drain
name: cassandra
ports:
- containerPort: 7000
name: intra-node
protocol: TCP
- containerPort: 7001
name: tls-intra-node
protocol: TCP
- containerPort: 7199
name: jmx
protocol: TCP
- containerPort: 9042
name: cql
protocol: TCP
readinessProbe:
exec:
command:
- /bin/bash
- -c
- /ready-probe.sh
failureThreshold: 3
initialDelaySeconds: 15
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
resources:
limits:
cpu: "2"
memory: 4Gi
requests:
cpu: "1"
memory: 2Gi
securityContext:
capabilities:
add:
- IPC_LOCK
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /cassandra_data
name: cassandra-data
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 500
updateStrategy:
rollingUpdate:
partition: 0
type: RollingUpdate
volumeClaimTemplates:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
creationTimestamp: null
name: cassandra-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: fast
volumeMode: Filesystem
status:
phase: Pending
status:
availableReplicas: 0
collisionCount: 0
currentReplicas: 1
currentRevision: cassandra-5ff88569c
observedGeneration: 1
replicas: 1
updateRevision: cassandra-5ff88569c
updatedReplicas: 1
这是我的资源监视器:附加为图像
我的 cassandra-0 pod 进入 crashloopbackoff: 这是 cassandra 日志错误: 检测到不可读的 sstables
我想在集群的节点池上运行 cassandra,并且我正在寻找解决方案,为什么会发生这种情况。
您的问题中没有足够的相关信息,但您描述的问题表明磁盘上存在与 pod 上安装的 Cassandra 二进制文件不兼容的 SSTable。
当 Cassandra 进程在启动过程中检测到数据目录中至少有 1 个文件格式不兼容时,会抛出错误
Detected unreadable sstables
。这表明安装的 data/
卷不为空,并且包含以前安装的 Cassandra 中的文件。
附带说明,您需要在问题中提供更多详细信息。您需要添加的主要内容是 (1) 完整的错误消息加上 (2) 完整的堆栈跟踪,以及 (3) Cassandra 版本。
友情提醒,提问时应提供足够的信息,以便贡献者更容易为您提供帮助。如果您需要指导,请参阅 stackoverflow.com/help/how-to-ask。针对与 Cassandra 相关的问题,我在 Apache Cassandra 网站上发布了提出好问题。干杯!