Skip to main content

REST - /v1/backups

LICENSE Weaviate on Stackoverflow badge Weaviate issues on Github badge Weaviate version badge Weaviate total Docker pulls badge Go Report Card

Introduction

See the Backups page for a general introduction, configuration, and tech background of Backups.

API

Create Backup

Once the modules are enabled and the configuration is provided, you can start a backup on any running instance with a single HTTP request.

Method and URL

POST /v1/backups/{backend}

Parameters

URL Parameters
nametyperequireddescription
backendstringyesThe name of the backup provider module without the backup- prefix, for example s3, gcp, or filesystem.
Request Body

The request takes a json object with the following properties:

nametyperequireddescription
idstring (lowercase letters, numbers, underscore, minus)yesThe id of the backup. This string must be provided on all future requests, such as status checking or restoration.
includelist of stringsnoAn optional list of class names to be included in the backup. If not set, all classes are included.
excludelist of stringsnoAn optional list of class names to be excluded from the backup. If not set, no classes are excluded.

Note: You cannot set include and exclude at the same time. Set none or exactly one of those.

import weaviate

client = weaviate.Client("http://localhost:8080")

result = client.backup.create(
backup_id="my-very-first-backup",
backend="filesystem",
include_classes=["Article", "Publication"],
wait_for_completion=True,
)

print(result)

While you are waiting for a backup to complete, Weaviate stays fully usable.

Asynchronous Status Checking

All client implentations have a "wait for completion" option which will poll the backup status in the background and only return once the backup has completed (successfully or unsuccessfully).

If you set the "wait for completion" option to false, you can also check the status yourself using the Backup Creation Status API.

GET /v1/backups/{backend}/{backup_id}
Parameters
URL Parameters
nametyperequireddescription
backendstringyesThe name of the backup provider module without the backup- prefix, for example s3, gcp, or filesystem.
backup_idstringyesThe user-provided backup identifier that was used when sending the request to create the backup.

The response contains a "status" field. If the status is SUCCESS, the backup is complete. If the status is FAILED, an additional error is provided.

import weaviate

client = weaviate.Client("http://localhost:8080")

result = client.backup.get_create_status(
backup_id="my-very-first-backup",
backend="filesystem",
)

print(result)

Restore Backup

You can restore any backup to any machine as long as the number of nodes between source and target are identical. The backup does not need to be created on the same instance. Once a backup backend is configured, you can restore a backup with a single HTTP request.

Note that a restore fails if any of the classes already exist on this instance.

Method and URL

POST /v1/backups/{backend}/{backup_id}/restore

Parameters

URL Parameters
nametyperequireddescription
backendstringyesThe name of the backup provider module without the backup- prefix, for example s3, gcp, or filesystem.
backup_idstringyesThe user-provided backup identifier that was used when sending the request to create the backup.
Request Body

The request takes a json object with the following properties:

nametyperequireddescription
includelist of stringsnoAn optional list of class names to be included in the backup. If not set, all classes are included.
excludelist of stringsnoAn optional list of class names to be excluded from the backup. If not set, no classes are excluded.

Note 1: You cannot set include and exclude at the same time. Set none or exactly one of those.

Note 2: include and exclude is relative to the classes contained in the backup. The restore process does not know which classes existed on the source machine if they were not part of the backup.

import weaviate

client = weaviate.Client("http://localhost:8080")

result = client.backup.restore(
backup_id="my-very-first-backup",
backend="filesystem",
exclude_classes="Article",
wait_for_completion=True,
)

print(result)

Asynchronous Status Checking

All client implentations have a "wait for completion" option which will poll the backup status in the background and only return once the backup has completed (successfully or unsuccessfully).

If you set the "wait for completion" option to false, you can also check the status yourself using the Backup Restore Status API.

GET /v1/backups/{backend}/{backup_id}/restore

Parameters

URL Parameters
nametyperequireddescription
backendstringyesThe name of the backup provider module without the backup- prefix, for example s3, gcp, or filesystem.
backup_idstringyesThe user-provided backup identifier that was used when sending the requests to create and restore the backup.

The response contains a "status" field. If the status is SUCCESS, the restore is complete. If the status is FAILED, an additional error is provided.

import weaviate

client = weaviate.Client("http://localhost:8080")

result = client.backup.get_restore_status(
backup_id="my-very-first-backup",
backend="filesystem",
)

print(result)

Learn more about Backups

Discover more about Backups Configuration, inlcuding Backups to S3 or GCS, Technical Considerations of Backups, as well as additional use cases.