Kubernetes 操作符 支持存储文件系统快照。
先决条件
To configure file system snapshot storage, your Kubernetes Operator deployment must have a storage class configured with the ReadWriteMany method.
步骤
要配置文件系统快照存储,请执行以下操作:
创建 PersistentVolumeClaim 对象。
Create a PersistentVolumeClaim object, and allocate storage as needed. Set accessModes to ReadWriteMany:
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: snapshot-store-ops-manager spec: storageClassName: managed-nfs-storage #SC that supports(RWX) accessModes: - ReadWriteMany resources: requests: storage: 10G ...
创建并应用 Ops Manager 自定义资源定义,指定您的 PersistentVolumeClaim。
Create an Ops Manager CustomResourceDefinition that specifies your PersistentVolumeClaim object and the spec.backup.fileSystemStores field, which is the name of your file system snapshot store.
The following example creates a CustomResourceDefinition file named ops-manager-fs.yaml, for the MongoDB oplog store with a kube-user.
apiVersion: mongodb.com/v1 kind: MongoDBOpsManager metadata: name: ops-manager spec: replicas: 1 version: 8.0.0 adminCredentials: ops-manager-admin-secret statefulSet: spec: template: spec: volumes: - name: snapshot-store persistentVolumeClaim: claimName: snapshot-store-ops-manager containers: - name: mongodb-ops-manager volumeMounts: - name: snapshot-store mountPath: /snapshot_store backup: enabled: true fileSystemStores: - name: filesystem1 assignmentLabels: ["test1", "test2"] opLogStores: assignmentLabels: ["test1", "test2"] - name: oplog1 mongodbResourceRef: name: oplog-db # mongodbUserRef: # name: kube-user statefulSet: spec: template: spec: volumes: - name: snapshot-store persistentVolumeClaim: claimName: snapshot-store-ops-manager containers: - name: mongodb-backup-daemon volumeMounts: - name: snapshot-store mountPath: /snapshot_store applicationDatabase: members: 3 version: 8.0.0
配置 oplog 存储。
等待您的 Ops Manager 对象将其状态报告为 ,然后按照“ 部署Running Ops Manager 资源 ”过程的“ 配置备份设置 ”步骤中的描述配置您的 oplog 存储。
在 Ops Manager 中创建文件系统快照存储。
登录到您的 Ops Manager 实例并导航到: Admin Backup Snapshot Store Create New File System Store 。
Set the name to the value you set for backup.fileSystemStores in your CustomResourceDefinition. Set the other values as appropriate, then click Create.
创建新的文件系统存储后,Ops Manager 对象将报告Pending的BACKUP状态。