Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ronaldo #224

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
841e628
milvus backup support aliyun oss
yelusion2 Jun 20, 2023
b866227
Fix bug when restore with collection name using CLI (#142)
wayblink Jun 20, 2023
708bb1e
Compatible with empty milvus rootPath (#147)
wayblink Jun 29, 2023
84d8477
doc: add compatibility for milvus and milvus backup (#148)
zhuwenxing Jun 29, 2023
e4aa237
Support cross bucket restore (#149)
wayblink Jun 29, 2023
1723839
ci: add test for backup restore cross milvus version (#153)
zhuwenxing Jul 5, 2023
b967fa8
ci: cancel previous runs in the PR when pushed new commits (#154)
zhuwenxing Jul 5, 2023
f1a4072
fix empty rootpath (#157)
wayblink Jul 7, 2023
975689a
test: add test for different config (#150)
zhuwenxing Jul 7, 2023
ebead92
Support pass database in create and restore request (#155)
wayblink Jul 12, 2023
6569e45
Lazy initial milvus and storage client
wayblink Jul 12, 2023
e7464d1
update example (#168)
zhuwenxing Jul 19, 2023
7ec005e
Add a full_meta.json store the complete metadata
wayblink Jul 18, 2023
5924007
Fix client not reuse bug
wayblink Jul 18, 2023
14ee11e
Fix CI timeout bug
wayblink Jul 19, 2023
48b2700
Fix can't restore to unexist db bug
wayblink Jul 19, 2023
c854457
raise error when list segment files
wayblink Jul 19, 2023
34bde71
Fix empty backup size in meta
wayblink Jul 19, 2023
46d22c4
Make dbCollections parameter compatible to both string and json struc…
wayblink Jul 21, 2023
489ff38
[test]update testcase to support db (#171)
zhuwenxing Jul 21, 2023
df89556
Fix compatibility to old backup without database info
wayblink Jul 26, 2023
716de4b
[FIX]: Empty b.params.MinioCfg.RootPath handler (S3/Ceph) (#177)
punkerpunker Aug 17, 2023
3b2be90
Change some log level to avoid confusion (#180)
wayblink Aug 17, 2023
d8e29c5
support loading minio and milvus config from env (#178) (#182)
xushaoxiao Aug 21, 2023
9708f29
Fix load config bug
wayblink Aug 29, 2023
f4b295c
Support rename db,collection name when restore
wayblink Aug 28, 2023
2a836fc
Update version by goreleaser (#191)
zhuwenxing Sep 4, 2023
a29362d
Add homebrew (#192)
zhuwenxing Sep 5, 2023
6d4dbbf
Add check cmd (#194)
wayblink Sep 5, 2023
b616e60
Add force backup option (#195)
wayblink Sep 5, 2023
1b59441
[ci]Update image tag to 2.3.0-latest (#198)
zhuwenxing Sep 8, 2023
1e5ff5e
[test]enable multi partitions in br test (#200)
zhuwenxing Sep 11, 2023
69aebbf
Fix compatibility (#202)
wayblink Sep 13, 2023
be50b12
support auto name generation (#196)
Sep 13, 2023
0ca5567
Do some refine (#206)
wayblink Sep 18, 2023
793ce0e
Support 2.3, support cosine and scalar index (#186)
wayblink Sep 22, 2023
54d1ef8
update goreleaser to ignore linux_386 arch
zhuwenxing Sep 22, 2023
bcf173b
[test]Add test cases to L0 to make sure checked in ci (#207)
zhuwenxing Sep 27, 2023
364e5f8
Compatible to DescribeIndex error message update (#214)
wayblink Oct 7, 2023
4606296
[ci]Optimization of ci runtime (#211)
zhuwenxing Oct 8, 2023
1cee95c
Support azure (#212)
wayblink Oct 8, 2023
c9169fa
[ci]Add nightly to run all test on master, 2.3 and 2.2 milvus version…
zhuwenxing Oct 9, 2023
724804b
Alert for port conflicts (#218)
wayblink Oct 9, 2023
3089ba0
Add example for partition data (#210)
wayblink Oct 9, 2023
e73efd4
Refine getbackup log
wayblink Oct 11, 2023
1d19a9f
Support concurrent backup and restore (#219)
wayblink Oct 11, 2023
e02a36a
[ci]Refine ci (#221)
zhuwenxing Oct 12, 2023
c98810e
[test]Add more partitions in br test (#203)
zhuwenxing Oct 13, 2023
232f6f8
Bump version to 0.4.1 (#223)
wayblink Oct 13, 2023
a48aa59
fix default log level to info
yelusion2 Oct 16, 2023
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
311 changes: 287 additions & 24 deletions .github/workflows/main.yaml

Large diffs are not rendered by default.

127 changes: 127 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Nightly Test

on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'

jobs:
test-backup-restore-api:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
deploy_tools: [docker-compose]
milvus_mode: [standalone]
milvus_version: [master-latest, 2.3.0-latest, 2.2.0-latest]

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
cache: pip

- uses: actions/setup-go@v3
with:
go-version: '1.18.0'
cache: true

- name: Creating kind cluster
if: ${{ matrix.deploy_tools == 'helm' }}
uses: helm/kind-action@v1.2.0

- name: Build
timeout-minutes: 5
shell: bash
run: |
if [ ${{ matrix.deploy_tools }} == 'helm' ]; then
yq -i '.minio.bucketName = "milvus-bucket"' configs/backup.yaml
yq -i '.minio.backupBucketName = "milvus-bucket"' configs/backup.yaml
yq -i '.minio.rootPath = "file"' configs/backup.yaml
fi
yq -i '.log.level = "debug"' configs/backup.yaml
cat configs/backup.yaml || true
go get
go build
- name: Install dependency

timeout-minutes: 5
working-directory: tests
shell: bash
run: |
pip install -r requirements.txt --trusted-host https://test.pypi.org

- name: Milvus deploy

timeout-minutes: 15
shell: bash
working-directory: deployment/${{ matrix.milvus_mode }}
run: |
if [ ${{ matrix.deploy_tools }} == "helm" ]; then
helm repo add milvus https://milvus-io.github.io/milvus-helm
helm repo update
helm install --wait --timeout 600s milvus-backup milvus/milvus --set image.all.tag=${{ matrix.milvus_version }} -f values.yaml
kubectl get pods
kubectl port-forward service/milvus-backup 19530 >/dev/null 2>&1 &
kubectl port-forward service/milvus-backup-minio 9000 >/dev/null 2>&1 &
sleep 10
nc -vz 127.0.0.1 19530
nc -vz 127.0.0.1 9000
sleep 10
kubectl get pods -n default | grep milvus-backup
fi

if [ ${{ matrix.deploy_tools}} == "docker-compose" ]; then
yq -i '.services.standalone.image= "milvusdb/milvus:${{ matrix.milvus_version }}"' docker-compose.yml
cat docker-compose.yml
docker-compose up -d
bash ../../scripts/check_healthy.sh
docker-compose ps -a
fi

- name: Start server
timeout-minutes: 5
shell: bash
run: |
./milvus-backup server > server.log 2>&1 &

- name: Run test
timeout-minutes: 120
shell: bash
working-directory: tests
run: |
pytest -s -v --tags L0, L1, L2, L3

- name: Get Milvus status
shell: bash
working-directory: deployment/${{ matrix.milvus_mode }}
run: |
docker-compose ps -a || true
kubectl get pods -n default || true

- name: Export logs
if: ${{ always() }}
shell: bash
working-directory: deployment/${{ matrix.milvus_mode }}
run: |
if [ ${{ matrix.deploy_tools}} == "helm" ]; then
bash ../../scripts/export_log_k8s.sh default milvus-backup logs
fi

if [ ${{ matrix.deploy_tools}} == "docker-compose" ]; then
bash ../../scripts/export_log_docker.sh logs
fi

- name: Upload logs
if: ${{ ! success() }}
uses: actions/upload-artifact@v2
with:
name: logs-${{ matrix.deploy_tools }}-${{ matrix.milvus_mode }}
path: |
./logs
./server.log
/tmp/ci_logs
deployment/${{ matrix.milvus_mode }}/logs
125 changes: 125 additions & 0 deletions .github/workflows/perf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Perf Test

on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'

jobs:
test-backup-restore-api:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
deploy_tools: [docker-compose]
milvus_mode: [standalone]
milvus_version: [master-latest, 2.3.0-latest, 2.2.0-latest]

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
cache: pip

- uses: actions/setup-go@v3
with:
go-version: '1.18.0'
cache: true

- name: Creating kind cluster
if: ${{ matrix.deploy_tools == 'helm' }}
uses: helm/kind-action@v1.2.0

- name: Build
timeout-minutes: 5
shell: bash
run: |
if [ ${{ matrix.deploy_tools }} == 'helm' ]; then
yq -i '.minio.bucketName = "milvus-bucket"' configs/backup.yaml
yq -i '.minio.backupBucketName = "milvus-bucket"' configs/backup.yaml
yq -i '.minio.rootPath = "file"' configs/backup.yaml
fi
yq -i '.log.level = "debug"' configs/backup.yaml
cat configs/backup.yaml || true
go get
go build
- name: Install dependency

timeout-minutes: 5
working-directory: tests
shell: bash
run: |
pip install -r requirements.txt --trusted-host https://test.pypi.org

- name: Milvus deploy

timeout-minutes: 15
shell: bash
working-directory: deployment/${{ matrix.milvus_mode }}
run: |
if [ ${{ matrix.deploy_tools }} == "helm" ]; then
helm repo add milvus https://milvus-io.github.io/milvus-helm
helm repo update
helm install --wait --timeout 600s milvus-backup milvus/milvus --set image.all.tag=${{ matrix.milvus_version }} -f values.yaml
kubectl get pods
kubectl port-forward service/milvus-backup 19530 >/dev/null 2>&1 &
kubectl port-forward service/milvus-backup-minio 9000 >/dev/null 2>&1 &
sleep 10
nc -vz 127.0.0.1 19530
nc -vz 127.0.0.1 9000
sleep 10
kubectl get pods -n default | grep milvus-backup
fi

if [ ${{ matrix.deploy_tools}} == "docker-compose" ]; then
docker-compose up -d
bash ../../scripts/check_healthy.sh
docker-compose ps -a
fi

- name: Start server
timeout-minutes: 5
shell: bash
run: |
./milvus-backup server > server.log 2>&1 &

- name: Run test
timeout-minutes: 120
shell: bash
working-directory: tests
run: |
pytest -s -v --tags Perf

- name: Get Milvus status
shell: bash
working-directory: deployment/${{ matrix.milvus_mode }}
run: |
docker-compose ps -a || true
kubectl get pods -n default || true

- name: Export logs
if: ${{ always() }}
shell: bash
working-directory: deployment/${{ matrix.milvus_mode }}
run: |
if [ ${{ matrix.deploy_tools}} == "helm" ]; then
bash ../../scripts/export_log_k8s.sh default milvus-backup logs
fi

if [ ${{ matrix.deploy_tools}} == "docker-compose" ]; then
bash ../../scripts/export_log_docker.sh logs
fi

- name: Upload logs
if: ${{ ! success() }}
uses: actions/upload-artifact@v2
with:
name: logs-${{ matrix.deploy_tools }}-${{ matrix.milvus_mode }}
path: |
./logs
./server.log
/tmp/ci_logs
deployment/${{ matrix.milvus_mode }}/logs
3 changes: 2 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ jobs:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GITHUB_HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TOKEN }}
22 changes: 22 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ builds:
goos:
- linux
- darwin
goarch:
- amd64
- arm64
ldflags:
- -w -s
- -X main.version={{ .Version }}
- -X main.commit={{ .Commit }}
- -X main.date={{ .Date }}

archives:
- format: tar.gz
Expand All @@ -25,12 +33,26 @@ checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"

brews:
-
name: milvus-backup
folder: Formula
homepage: "https://github.com/zilliztech/milvus-backup"
repository:
owner: zilliztech
name: homebrew-tap
token: "{{ .Env.GITHUB_HOMEBREW_TOKEN }}"


changelog:
sort: asc
use: github
filters:
exclude:
- '^docs:'
- '^test:'
- Merge pull request

# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
Expand Down
41 changes: 35 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@

Milvus-Backup is a tool that allows users to backup and restore Milvus data. This tool can be utilized either through the command line or an API server.

In order to use Milvus-Backup effectively, access to Milvus proxy and Minio cluster is required. Configuration settings related to this access can be edited in `configs/backup.yaml`.
The Milvus-backup process has negligible impact on the performance of Milvus. Milvus cluster is fully functional and can operate normally while backup and restoration are in progress.

## Compatibility
| Milvus | Milvus-backup |
|:----------------:|:----------------:|
| v2.3.0 and above | v0.4.0 and above |
| v2.2.9 and above | v0.3.0 and above |
| v2.2.0 to v2.2.8 | v0.1.0 to v0.2.2 |

## Config
In order to use Milvus-Backup, access to Milvus proxy and Minio cluster is required. Configuration settings related to this access can be edited in `configs/backup.yaml`.

> **Note**
>
Expand All @@ -14,8 +24,6 @@ In order to use Milvus-Backup effectively, access to Milvus proxy and Minio clus
> |bucketName|a-bucket|milvus-bucket|
> |rootPath|files|file|

The Milvus-backup process has negligible impact on the performance of Milvus. Milvus cluster is fully functional and can operate normally while backup and restoration are in progress.

## Development

### Build
Expand Down Expand Up @@ -137,14 +145,14 @@ curl --location --request GET 'http://localhost:8080/api/v1/get_restore?id=test_
Milvus-backup establish CLI based on cobra. Use the following command to see the usage.

```
milvus-backup is a backup tool for milvus.
milvus-backup is a backup&restore tool for milvus.

Usage:
milvus-backup [flags]
milvus-backup [command]

Available Commands:
completion Generate the autocompletion script for the specified shell
check check if the connects is right.
create create subcommand create a backup.
delete delete subcommand delete backup by name.
get get subcommand get backup by name.
Expand All @@ -154,7 +162,8 @@ Available Commands:
server server subcommand start milvus-backup RESTAPI server.

Flags:
-h, --help help for milvus-backup
--config string config YAML file of milvus (default "backup.yaml")
-h, --help help for milvus-backup

Use "milvus-backup [command] --help" for more information about a command.
```
Expand All @@ -163,6 +172,26 @@ Use "milvus-backup [command] --help" for more information about a command.

To try this demo, you should have a functional Milvus server installed and have pymilvus library installed.

Step 0: Check the connections

First of all, we can use `check` command to check whether connections to milvus and storage is normal:

```
./milvus-backup check
```

normal output:

```shell
Succeed to connect to milvus and storage.
Milvus version: v2.3
Storage:
milvus-bucket: a-bucket
milvus-rootpath: files
backup-bucket: a-bucket
backup-rootpath: backup
```

Step 1: Prepare the Data

Create a collection in Milvus called `hello_milvus` and insert some data using the following command:
Expand Down
Loading
Loading