Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

Milvus-backup

license license

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.

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

Always use the latest release of milvus-backup, which is backward-compatible with Milvus v2.2 and above.

The backup tool is designed to automatically adapt to version differences in Milvus.
Using the latest version ensures best compatibility, performance, and bug fixes.

The table below shows which Milvus versions can restore backups created from other versions:

Backup From ↓ \ Restore To →2.42.52.6
2.2
2.3
2.4
2.5
2.6

✅ = Supported  ❌ = Not supported

Rules:

  • Backup is supported from Milvus 2.2+
  • Restore is supported to Milvus 2.4+
  • A backup can only be restored to the same or newer Milvus versions
  • For example, backups created in Milvus 2.5 cannot be restored to 2.4

Installation

  • Download binary from release page. Usually the latest is recommended.

  • Use homebrew to install on Mac

    brew install zilliztech/tap/milvus-backup

Usage

Milvus-backup provides command line and API server for usage.

Configuration

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 backup.yaml.

[!NOTE]

Please ensure that the configuration settings for Minio are accurate. There may be variations in the default value of Minio's configuration depending on how Milvus is deployed, either by docker-compose or k8s.

fielddocker-composehelm
bucketNamea-bucketmilvus-bucket
rootPathfilesfile

[!NOTE]

There is also an option to override values in backup.yaml using environment variables. Please refer env_variables.md to know more.

Command Line

Milvus-backup establish CLI based on cobra. Use the following command to see all the usage.

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

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

Available Commands:
  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.
  help        Help about any command
  list        list subcommand shows all backup in the cluster.
  restore     restore subcommand restore a backup.
  server      server subcommand start milvus-backup RESTAPI server.

Flags:
      --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.

Here is a demo for a complete backup and restore process.

API Server

To start the RESTAPI server, use the following command after building:

./milvus-backup server

The server will listen on port 8080 by default. However, you can change it by using the -p parameter as shown below:

./milvus-backup server -p 443

We offer a demo of the key APIs; however, please refer to the Swagger UI for the most up-to-date usage details, as the demo may occasionally become outdated.

swagger UI

We offer access to our Swagger UI, which displays comprehensive information for our APIs. To view it, simply go to

http://localhost:8080/api/v1/docs/index.html

Backup.yaml Configurations

Below is a summary of the configurations supported in backup.yaml:

SectionFieldDescriptionDefault/Example
loglevelLogging level. Supported: debug, info, warn, error, panic, fatal.info
consoleWhether to print logs to the console.true
file.rootPathPath to the log file.logs/backup.log
httpenabledWhether to enable the HTTP server.true
debugModeWhether to enable Gin debug mode.false
swaggerBasePathOverride the Swagger UI base path. Useful when running behind a reverse proxy with a path prefix.(empty)
milvusaddressMilvus proxy address.localhost
portMilvus proxy port.19530
userUsername for Milvus.root
passwordPassword for Milvus.Milvus
tlsModeTLS mode (0: none, 1: one-way, 2: two-way/mtls).0
caCertPathPath to your ca certificate file/path/to/certificate
serverName Server namelocalhost
mtlsCertPathPath to your mtls certificate file/path/to/certificate
mtlsKeyPath Path to your mtls key file/path/to/key
miniostorageTypeStorage type for Milvus (e.g., local, minio, s3, aws, gcp, ali(aliyun), azure, tc(tencent), gcpnative). Use gcpnative for the Google Cloud Platform provider.minio
addressMinIO/S3 address.localhost
portMinIO/S3 port.9000
accessKeyIDMinIO/S3 access key ID.minioadmin
secretAccessKeyMinIO/S3 secret access key.minioadmin
gcpCredentialJSONPath to your GCP credential JSON key file. Used only for the "gcpnative" cloud provider./path/to/json-key-file
useSSLWhether to use SSL for MinIO/S3.false
bucketNameBucket name in MinIO/S3.a-bucket
rootPathStorage root path in MinIO/S3.files
minio (backup)backupStorageTypeBackup storage type (e.g., local, minio, s3, aws, gcp, ali(aliyun), azure, tc(tencent), gcpnative). Use gcpnative for the Google Cloud Platform provider.minio
backupAddressAddress of backup storagße.localhost
backupPortPort of backup storage.9000
backupUseSSLWhether to use SSL for backup storage.false
backupAccessKeyIDBackup storage access key ID.minioadmin
backupSecretAccessKeyBackup storage secret access key.minioadmin
backupGcpCredentialJSONPath to your GCP credential JSON key file. Used only for the "gcpnative" cloud provider./path/to/json-key-file
backupBucketNameBucket name for backups.a-bucket
backupRootPathRoot path to store backup data.backup
crossStorageEnable cross-storage backups (e.g., MinIO to AWS S3).false
backupmaxSegmentGroupSizeMaximum segment group size for backups.2G
parallelism.backupCollectionCollection-level parallelism for backup.4
parallelism.copydataThread pool size for copying data.128
parallelism.restoreCollectionCollection-level parallelism for restore.2
keepTempFilesWhether to keep temporary files during restore (for debugging).false
gcPause.enablePause Milvus garbage collection during backup.true
gcPause.secondsDuration to pause garbage collection (in seconds).7200
gcPause.addressAddress for Milvus garbage collection API.http://localhost:9091

For more details, refer to the backup.yaml configuration file.

Advanced feature

  1. Cross Storage Backup: Data is read from the source storage and written to a different storage through the Milvus-backup service. Such as, S3 -> local, S3 a -> S3 b.

  2. RBAC Backup&Restore: Enable backup and restore RBAC meta with extra parameter.

  3. Segment Merging Restore: In segment merging restore mode (v2 restore), multiple segments are grouped into a single job and restored together. This significantly improves restore performance, especially in scenarios with many small segments.

Examples

Syncing Minio Backups to an AWS S3 Bucket

NOTE: The following configuration is an example only. Replace the placeholders with your actual AWS and Minio settings.

To back up Milvus data to an AWS S3 bucket, you need to configure the backup.yaml file with the following settings:

# Backup storage configs: Configure the storage where you want to save the backup data backupStorageType: "aws" # Specifies the storage type as AWS S3 backupAddress: s3.{your-aws-region}.amazonaws.com # Address of AWS S3 (replace {your-aws-region} with your bucket's region) backupPort: 443 # Default port for AWS S3 backupAccessKeyID: <your-access-key-id> # Access key ID for your AWS S3 backupSecretAccessKey: <your-secret-key> # Secret access key for AWS S3 backupGcpCredentialJSON: "/path/to/file" # Path to your GCP credential JSON key file. Used only for the "gcpnative" cloud provider. backupBucketName: "your-bucket-name" # Bucket name where the backups will be stored backupRootPath: "backups" # Root path inside the bucket to store backups backupUseSSL: true # Use SSL for secure connections (Required) crossStorage: "true" # Required for minio to S3 backups

FAQ

Development

Build

For developers, Milvus-backup is easy to contribute to.

Execute make all will generate an executable binary milvus-backup in the {project_path}/bin directory.

Test

Developers can also test it using an IDE. You can test it using the command line interface:

make test

License

milvus-backup is licensed under the Apache License, Version 2.0.

关于 About

Backup and restore tool for Milvus

语言 Languages

Go61.3%
Python37.9%
Shell0.7%
Makefile0.1%
Dockerfile0.0%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
283
Total Commits
峰值: 13次/周
Less
More

核心贡献者 Contributors