Cluster Management#

Monitor and manage your Antfly cluster's health and status.

Cluster Health#

The cluster health endpoint provides real-time status of all stores and shards:

  • healthy: All nodes and shards operational
  • degraded: Some shards unavailable but cluster functional
  • unhealthy: Critical failures affecting availability
  • error: Cluster-wide failures

Monitoring#

  • Health check endpoint: GET /healthz
  • Prometheus metrics: GET /metrics on port 4200

Use these endpoints to integrate with monitoring systems and alerting infrastructure.

Common questions about this section
  • How do I check if my cluster is healthy?
  • What do the different health statuses mean?
  • How do I integrate Antfly with Prometheus?

Get cluster status#

GET/status

Returns the current health and status of all stores and shards in the cluster

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Code Examples#

curl -X GET "/api/v1/status" \
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "health": "unknown",
  "message": "string",
  "auth_enabled": true,
  "swarm_mode": true
}

List secrets status#

GET/secrets

List all configured secret names and their status (keystore, env var, or both). Never returns secret values — only names and configuration status.

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Code Examples#

curl -X GET "/api/v1/secrets" \
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "secrets": [
    {
      "key": "string",
      "status": "configured_keystore",
      "env_var": "string",
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
  ]
}

Store a secret#

PUT/secrets/{key}

Store a secret in the keystore. Only available in swarm (single-node) mode. Returns 503 in multi-node mode.

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Request Body#

Example:

{
    "value": "string"
}

Code Examples#

curl -X PUT "/api/v1/secrets/{key}" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "value": "string"
}'

Responses#

{
  "key": "string",
  "status": "configured_keystore",
  "env_var": "string",
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z"
}

Delete a secret#

DELETE/secrets/{key}

Remove a secret from the keystore. Only available in swarm (single-node) mode. Returns 503 in multi-node mode.

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Code Examples#

curl -X DELETE "/api/v1/secrets/{key}" \
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

No response body

Backup all tables or selected tables#

POST/backup

Creates a backup of all tables or specified tables. Each table's backup includes:

  • Table metadata (schema, indexes, shard configuration)
  • All shard data (compressed with zstd)

The backup creates a cluster-level manifest that tracks all included tables and their individual backup locations.

Storage Locations:

  • Local filesystem: file:///path/to/backup
  • Amazon S3: s3://bucket-name/path/to/backup

Backup Structure:

{location}/
├── {backup_id}-cluster-metadata.json   (cluster manifest)
├── {table1}-{backup_id}-metadata.json  (table metadata)
├── shard-1-{table1}-{backup_id}.tar.zst
├── shard-2-{table1}-{backup_id}.tar.zst
├── {table2}-{backup_id}-metadata.json
└── ...

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Request Body#

Example:

{
    "backup_id": "cluster-backup-2025-01-15",
    "location": "s3://mybucket/antfly-backups/cluster/2025-01-15",
    "table_names": [
        "users",
        "products"
    ]
}

Code Examples#

curl -X POST "/api/v1/backup" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "backup_id": "cluster-backup-2025-01-15",
    "location": "s3://mybucket/antfly-backups/cluster/2025-01-15",
    "table_names": [
        "users",
        "products"
    ]
}'

Responses#

{
  "backup_id": "cluster-backup-2025-01-15",
  "tables": [
    {
      "name": "users",
      "status": "completed",
      "error": "string"
    }
  ],
  "status": "completed"
}

Restore multiple tables from a backup#

POST/restore

Restores tables from a cluster backup. Can restore all tables or a subset.

Restore Modes:

  • fail_if_exists: Abort if any target table already exists (default)
  • skip_if_exists: Skip existing tables and restore the rest
  • overwrite: Drop existing tables and restore from backup

The restore is asynchronous - this endpoint triggers the restore process and returns immediately. The actual data restoration happens via the reconciliation loop as shards are started.

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Request Body#

Example:

{
    "backup_id": "cluster-backup-2025-01-15",
    "location": "s3://mybucket/antfly-backups/cluster/2025-01-15",
    "table_names": [
        "users",
        "products"
    ],
    "restore_mode": "skip_if_exists"
}

Code Examples#

curl -X POST "/api/v1/restore" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "backup_id": "cluster-backup-2025-01-15",
    "location": "s3://mybucket/antfly-backups/cluster/2025-01-15",
    "table_names": [
        "users",
        "products"
    ],
    "restore_mode": "skip_if_exists"
}'

Responses#

{
  "tables": [
    {
      "name": "users",
      "status": "triggered",
      "error": "string"
    }
  ],
  "status": "triggered"
}

List available backups#

GET/backups

Lists all cluster-level backups available at the specified location. Returns metadata about each backup including the tables included, timestamp, and Antfly version.

Security#

Provide your bearer token in the Authorization header when making requests to protected resources.

Example: Authorization: Bearer YOUR_API_KEY

Parameters#

NameTypeLocationRequiredDescription
locationstringqueryYesStorage location to search for backups.
  • Local filesystem: file:///path/to/backup
  • Amazon S3: s3://bucket-name/path/to/backup |

Code Examples#

curl -X GET "/api/v1/backups?location=s3://mybucket/antfly-backups/" \
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "backups": [
    {
      "backup_id": "cluster-backup-2025-01-15",
      "timestamp": "2025-01-15T10:30:00Z",
      "tables": [
        "users",
        "products"
      ],
      "location": "s3://mybucket/antfly-backups/cluster/2025-01-15",
      "antfly_version": "v1.0.0"
    }
  ]
}