Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/guides/milvus/adopt/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Adopt an Existing Cluster
menu:
docs_{{ .version }}:
identifier: milvus-adopt
name: Adopt an Existing Cluster
parent: milvus-guides
weight: 95
menu_name: docs_{{ .version }}
---
361 changes: 361 additions & 0 deletions docs/guides/milvus/adopt/guide.md

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions docs/guides/milvus/adopt/yamls/auth-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Secret
metadata:
name: milvus-root
namespace: demo
type: kubernetes.io/basic-auth
stringData:
# the root credentials the running cluster uses today
username: root
password: <current-root-password>
39 changes: 39 additions & 0 deletions docs/guides/milvus/adopt/yamls/milvus-adopt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: kubedb.com/v1alpha2
kind: Milvus
metadata:
# the Service of the same name becomes the client endpoint
name: milvus
namespace: demo
annotations:
kubedb.com/milvus-orphan-on-delete: "true"
spec:
version: "2.6.15"
deletionPolicy: DoNotTerminate
authSecret:
kind: Secret
name: milvus-root
healthChecker:
disableWriteCheck: true
metaStorage:
externallyManaged: true
endpoints:
- http://milvus-etcd.demo.svc:2379
rootPath: by-dev
objectStorage:
configSecret:
name: milvus-object-storage
configuration:
secretName: milvus-current-config
topology:
mode: Distributed
distributed:
mixcoord:
replicas: 0
datanode:
replicas: 0
querynode:
replicas: 0
streamingnode:
replicas: 0
proxy:
replicas: 0
18 changes: 18 additions & 0 deletions docs/guides/milvus/adopt/yamls/object-storage-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Secret
metadata:
name: milvus-object-storage
namespace: demo
type: Opaque
stringData:
# every key overrides the same key under minio: in milvus.yaml
address: s3.example.internal
port: "443"
useSSL: "true"
bucketName: milvus-data
rootPath: files
useIAM: "false"
cloudProvider: aws
region: us-east-1
accessKeyID: <access-key>
secretAccessKey: <secret-key>
10 changes: 10 additions & 0 deletions docs/guides/milvus/backup/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Backup & Restore
menu:
docs_{{ .version }}:
identifier: milvus-backup
name: Backup & Restore
parent: milvus-guides
weight: 140
menu_name: docs_{{ .version }}
---
10 changes: 10 additions & 0 deletions docs/guides/milvus/backup/logical/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Logical Backup
menu:
docs_{{ .version }}:
identifier: milvus-backup-logical
name: Logical Backup
parent: milvus-backup
weight: 10
menu_name: docs_{{ .version }}
---
97 changes: 97 additions & 0 deletions docs/guides/milvus/backup/logical/guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
title: Logical Backup and Restore of Milvus | KubeStash
menu:
docs_{{ .version }}:
identifier: milvus-backup-logical-guide
name: Guide
parent: milvus-backup-logical
weight: 10
menu_name: docs_{{ .version }}
section_menu_id: guides
---

> New to KubeDB? Please start [here](/docs/README.md).

# Logical Backup and Restore of Milvus with KubeStash

A logical backup exports collections through Milvus itself with `milvus-backup`. It works for Standalone and Distributed Milvus, with a KubeDB-managed or an externally managed meta etcd, because it never reads etcd directly. It can back up and restore a subset of collections, and restore either alongside the existing collections or in place over them.

## Before You Begin

- Install [KubeStash](https://kubestash.com/docs/latest/setup/) and the KubeDB KubeStash catalog, which provides the `milvus-addon`.
- Create a `BackupStorage` and a `RetentionPolicy` in the `demo` namespace, as in the [KubeStash quickstart](https://kubestash.com/docs/latest/concepts/crds/backupstorage/).
- Have a Ready Milvus named `milvus` in `demo`.

> Note: The yaml files used in this tutorial are stored in [docs/guides/milvus/backup/logical/yamls](https://github.com/kubedb/docs/tree/{{< param "info.version" >}}/docs/guides/milvus/backup/logical/yamls) folder in GitHub repository [kubedb/docs](https://github.com/kubedb/docs).

## Parameters

Set these under `addon.tasks[].params`. All are strings.

| Task | Parameter | Default | Meaning |
|---|---|---|---|
| `logical-backup` | `collections` | `""` | Comma-separated `<db>.<collection>`. Empty backs up every collection |
| `logical-backup` | `backupTimeout` | `0s` | Hard limit on the backup, as a Go duration. `0s` means no limit |
| `logical-backup-restore` | `restoreSuffix` | `_restored` | Appended to every restored collection name |
| `logical-backup-restore` | `collections` | `""` | Comma-separated `<db>.<collection>` to restore. Empty restores every collection in the snapshot |
| `logical-backup-restore` | `inPlaceRestore` | `false` | Restore over the existing collections, replacing them. Takes precedence over the default `restoreSuffix` |
| `logical-backup-restore` | `dropExistCollection` | `false` | Drop a colliding collection in the target instead of failing |
| `logical-backup-restore` | `restoreTimeout` | `0s` | Hard limit on the restore, as a Go duration |

Users and roles are captured in every backup but are not restored. A restored user would carry the source password hash, which could lock the operator out of the target.

## Back up

```bash
$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/milvus/backup/logical/yamls/backupconfiguration.yaml
$ kubectl get backupsession -n demo -w
$ kubectl get snapshot -n demo -l kubestash.com/repo-name=milvus-logical-repo
```

For a large database set `backupTimeout` well above the time a backup takes, rather than leaving it unlimited, so a hung backup fails and the next schedule runs.

## Restore

A restore writes into the Milvus named in `spec.target`. Choose one of three forms.

### Alongside, into another Milvus (recommended for verification)

Restore the latest snapshot into a separate Milvus and compare it with the source before you trust the backup. Each collection is created as `<name>_restored`:

```bash
$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/milvus/backup/logical/yamls/restore-suffix.yaml
```

### Only some collections

Restore two collections next to the live ones in the source database:

```bash
$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/milvus/backup/logical/yamls/restore-collections.yaml
```

The granularity is the collection. A partition cannot be restored on its own.

### In place

`inPlaceRestore: "true"` drops each restored collection in the target and recreates it from the backup. Before dropping anything, the plugin checks that the backup holds a replacement for every collection it is about to drop. Always combine it with `collections`, so only what you mean to replace is touched:

```bash
$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/guides/milvus/backup/logical/yamls/restore-in-place.yaml
```

Without `inPlaceRestore`, a restore always uses a suffix. Running the same restore twice fails on the second run because `<name>_restored` already exists; nothing is dropped unless you set `dropExistCollection` or `inPlaceRestore`.

## Check a restore

```bash
$ kubectl get restoresession -n demo
$ kubectl describe restoresession -n demo milvus-restore-check
```

Then compare row counts and run a few known queries against the restored collections.

## What a logical backup does not cover

- **Point-in-time recovery and physical backups** come from a `MilvusArchiver`, which needs a KubeDB-managed meta etcd dedicated to the Milvus. A Milvus with `spec.metaStorage.externallyManaged: true` can use logical backups only.
- **Partition-level restore** is not available.
37 changes: 37 additions & 0 deletions docs/guides/milvus/backup/logical/yamls/backupconfiguration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: core.kubestash.com/v1alpha1
kind: BackupConfiguration
metadata:
name: milvus-logical-backup
namespace: demo
spec:
target:
apiGroup: kubedb.com
kind: Milvus
namespace: demo
name: milvus
backends:
- name: s3-backend
storageRef:
namespace: demo
name: s3-storage
retentionPolicy:
name: demo-retention
namespace: demo
sessions:
- name: daily
scheduler:
schedule: "0 1 * * *"
jobTemplate:
backoffLimit: 1
repositories:
- name: milvus-logical-repo
backend: s3-backend
directory: /milvus/logical
addon:
name: milvus-addon
tasks:
- name: logical-backup
params:
# empty backs up every collection; otherwise comma-separated <db>.<collection>
collections: ""
backupTimeout: "6h"
21 changes: 21 additions & 0 deletions docs/guides/milvus/backup/logical/yamls/restore-collections.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: core.kubestash.com/v1alpha1
kind: RestoreSession
metadata:
name: milvus-restore-two-collections
namespace: demo
spec:
target:
apiGroup: kubedb.com
kind: Milvus
namespace: demo
name: milvus
dataSource:
repository: milvus-logical-repo
snapshot: latest
addon:
name: milvus-addon
tasks:
- name: logical-backup-restore
params:
collections: "default.products,default.reviews"
restoreSuffix: "_restored"
21 changes: 21 additions & 0 deletions docs/guides/milvus/backup/logical/yamls/restore-in-place.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: core.kubestash.com/v1alpha1
kind: RestoreSession
metadata:
name: milvus-restore-in-place
namespace: demo
spec:
target:
apiGroup: kubedb.com
kind: Milvus
namespace: demo
name: milvus
dataSource:
repository: milvus-logical-repo
snapshot: latest
addon:
name: milvus-addon
tasks:
- name: logical-backup-restore
params:
collections: "default.products"
inPlaceRestore: "true"
22 changes: 22 additions & 0 deletions docs/guides/milvus/backup/logical/yamls/restore-suffix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: core.kubestash.com/v1alpha1
kind: RestoreSession
metadata:
name: milvus-restore-check
namespace: demo
spec:
target:
apiGroup: kubedb.com
kind: Milvus
namespace: restore-check
name: milvus-check
dataSource:
repository: milvus-logical-repo
namespace: demo
snapshot: latest
addon:
name: milvus-addon
tasks:
- name: logical-backup-restore
params:
restoreSuffix: "_restored"
restoreTimeout: "6h"
10 changes: 10 additions & 0 deletions docs/guides/milvus/gpu-sriov/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: GPU and SR-IOV
menu:
docs_{{ .version }}:
identifier: milvus-gpu-sriov
name: GPU and SR-IOV
parent: milvus-guides
weight: 90
menu_name: docs_{{ .version }}
---
Loading
Loading