localvectordb_server.cli package

LocalVectorDB Server Command-Line Interface

This module provides a comprehensive command-line interface for managing and interacting with LocalVectorDB vector databases. It includes commands for starting the server, managing configuration, and performing database operations.

Main Components:

  • serve: Start the LocalVectorDB server

  • config: View and modify server configuration

  • list: List available databases

  • create: Create a new vector database

  • delete: Delete an existing database

  • rename: Rename a database

  • db: Commands for interacting with a specific database

  • backup: Backup and restore operations (create, list, restore, verify, cleanup, pitr)

  • migrate: Database migration and schema evolution (status, apply, rollback, create, list)

Examples

Start the server:

$ lvdb serve --host 0.0.0.0 --port 8000

Initialize configuration:

$ lvdb config init --format toml

View configuration:

$ lvdb config show

List available databases:

$ lvdb list

Create a database:

$ lvdb create mydatabase --embedding-model nomic-embed-text --chunk-size 500

Add documents to a database:

$ lvdb db mydatabase add document.txt
$ lvdb db mydatabase add "documents/*.py"
$ cat document.txt | lvdb db mydatabase add -

Search documents:

$ lvdb db mydatabase search "query text" --limit 5
$ lvdb db mydatabase search "query text" --search-type hybrid --metadata-filter '{"author":"Smith"}'

Get document by ID:

$ lvdb db mydatabase get doc_1

Manage database interactively:

$ lvdb db mydatabase shell

Create and manage backups:

$ lvdb backup create mydatabase --type full
$ lvdb backup list --database mydatabase
$ lvdb backup restore backup-id --to-location ./restored
$ lvdb backup pitr "2024-01-15 14:30:00" --to-location ./pitr-restored

Manage database migrations:

$ lvdb migrate status mydatabase
$ lvdb migrate create "add new field" --version 1.2.0
$ lvdb migrate apply mydatabase --to-version 1.2.0
$ lvdb migrate rollback mydatabase 1.1.0

Notes

  • Database configuration is stored in a configuration file (default: .lvdb-config.toml)

  • The location of the configuration file can be specified with –config or the LVDB_SERVER_CONFIG environment variable

  • Database files are stored in the directory specified by DB_ROOT_DIR in the configuration

  • Authentication can be enabled with the auth commands