Skip to content

Sync libSQL embedded replica using message-triggered updates.

License

Notifications You must be signed in to change notification settings

hahnavi/libsql-syncd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libsql-syncd

libsql-syncd is a tool that synchronizes your libSQL embedded replica with a primary database using Redis Pub/Sub to trigger synchronization. This keeps your embedded replica up-to-date efficiently and provides an easy way to maintain synchronization without the need for constant polling.

Getting Started

To run libsql-syncd, follow these steps:

  1. Build the Project:

    cargo build --release
  2. Set Environment Variables:

    If you prefer, you can set environment variables manually or use .env file.

    • Copy the .env.example file to a new file named .env.
    • Edit the .env file and replace placeholders with your actual values.
      • LIBSQL_SYNC_URL: URL of the primary.
      • LIBSQL_AUTH_TOKEN: Authentication token.
      • LIBSQL_DB_PATH: Location of the embedded replica file.
      • REDIS_URL: URL of the Redis server.
      • REDIS_CHANNEL: Channel name of the Redis Pub/Sub.
      • HOST_ID: ID of the host. If the value matches the message from Redis Pub/Sub, sync will be skipped.
  3. Run the App:

    • After building the project, navigate to the target/release directory.

    • Run the generated binary file:

      ./libsql-syncd

Trigger Synchronization

To trigger synchronization, send a message to the Redis Pub/Sub channel specified in the environment variable (REDIS_CHANNEL). The payload is the host ID that triggers the synchronization. libsql-syncd will skip the sync if the payload matches the HOST_ID from the environment variable.

About

Sync libSQL embedded replica using message-triggered updates.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages