SQLite extension to create local read replicas from HA database.
Download ha-sync extension from the releases page. Here's a great article that explains how to install the SQLite extension.
- Go 1.25+ and CGO_ENABLED=1 is required.
go build -ldflags="-s -w" -buildmode=c-shared -o ha-sync.so- Use .so extension for Linux, .dylib for MacOS and .dll for Windows
sqlite3
# Load the extension
.load ./ha-sync
# check version (optional)
SELECT ha_info();CREATE VIRTUAL TABLE temp.ha USING HA(servers='nats://localhost:4222', timeout=5000, logger='file:ha-sync.log');
-- Insert the subject name into the created virtual table to start replication
INSERT INTO temp.ha(subject, durable) VALUES('ha_replication.ha_db', 'my_instance');DELETE FROM temp.ha WHERE durable = 'my_instance';
INSERT INTO temp.ha(subject, durable, policy) VALUES('ha_replication.ha_db', 'my_instance', 'by_start_sequence=42');