Mycelite is an open-source SQLite extension that allows you to replicate a SQLite database from a source to a destination. Used in conjunction with Mycelial, Mycelite allows you to fully replicate a SQLite database from a read/write source to a read-only destination.
Download the appropriate build to the computer with the source database
Mac Arm
curl -L https://github.com/mycelial/mycelite/releases/latest/download/aarch64-apple-darwin.tgz --output aarch64-apple-darwin.tgz
tar -xvzf aarch64-apple-darwin.tgz
Mac x86
curl -L https://github.com/mycelial/mycelite/releases/latest/download/x86_64-apple-darwin.tgz --output x86_64-apple-darwin.tgz
tar -xvzf x86_64-apple-darwin.tgz
Linux Arm 32
curl -L https://github.com/mycelial/mycelite/releases/latest/download/arm-unknown-linux-gnueabihf.tgz --output arm-unknown-linux-gnueabihf.tgz
tar -xvzf arm-unknown-linux-gnueabihf.tgz
Linux Arm 64
curl -L https://github.com/mycelial/mycelite/releases/latest/download/aarch64-unknown-linux-gnu.tgz --output arm-unknown-linux-gnueabihf.tgz
tar -xvzf arm-unknown-linux-gnueabihf.tgz
Linux x86 gnu
curl -L https://github.com/mycelial/mycelite/releases/latest/download/x86_64-unknown-linux-gnu.tgz --output x86_64-unknown-linux-gnu.tgz
tar -xvzf x86_64-unknown-linux-gnu.tgz
Linux x86 musl
curl -L https://github.com/mycelial/mycelite/releases/latest/download/x86_64-unknown-linux-musl.tgz --output x86_64-unknown-linux-musl.tgz
tar -xvzf x86_64-unknown-linux-musl.tgz
Windows x86 gnu
curl.exe -L https://github.com/mycelial/mycelite/releases/latest/download/x86_64-pc-windows-gnu.zip --output x86_64-pc-windows-gnu.zip
tar.exe -xvzf x86_64-pc-windows-gnu.zip
Windows x86 msvc
curl.exe -L https://github.com/mycelial/mycelite/releases/latest/download/x86_64-pc-windows-msvc.zip --output x86_64-pc-windows-msvc.zip
tar.exe -xvzf x86_64-pc-windows-msvc.zip
After you've downloaded and unzipped the extension, you'll need to load the
extension and open your SQLite database. When the extension is loaded and the
SQLite database is opened, it will create a Mycelite journal file, which is a
sibling file to the SQLite database file. Make a note of the journal
filename
as it will need to be referenced when setting up your pipeline
specification in Mycelial.
Command Line
# You must load the extension every time you open the SQLite database
sqlite3
.load ./libmycelite mycelite_writer
.open writer.db
Node.js
npm install better-sqlite3
import Database from 'better-sqlite3';
let db = new Database(':memory:');
db.loadExtension('./libmycelite', 'mycelite_writer');
db = new Database('writer.db');
Python
import sqlite3
connection = sqlite3.connect(":memory:")
connection.enable_load_extension(True)
connection.execute("select load_extension('./libmycelite', 'mycelite_writer')")
db = sqlite3.connect("writer.db")
Follow the Setup guide instructions for setting up the Mycelial client. Reference the Client Config document when configuring the client.
After configuring the Mycelial client, open the server console and perform the following steps.
- Drag and drop your source node onto the canvas.
- Drag and drop the Mycelial Server node onto the canvas.
- Drag and drop your destination node onto the canvas.
- Connect the source and destination nodes, via the Mycelial Server node
- Publish your configuration
After performing the above steps, your source SQLite database is replicated in near real-time to the destination SQLite database.
If you prefer to set up your data pipelines with an API call, do the following:
Create the pipeline by making a POST
specification API calls to
/api/pipe
with the following payloads:
{
"configs": [
{
"id": 0,
"pipe": [
{
"name": "sqlite_physical_replication_source",
"label": "sqlite_physical_replication_source node",
"client": "{client name}",
"type": "sqlite_physical_replication",
"display_name": "{display name}",
"journal_path": "{path and filename of source journal"
},
{
"name": "mycelial_server_destination",
"label": "mycelial_server node",
"type": "mycelial_server",
"display_name": "Mycelial Server",
"endpoint": "http://{host or ip}:7777/ingestion",
"token": "{security token}",
"topic": "{unique topic id}"
}
]
}
]
}
{
"configs": [
{
"id": 0,
"pipe": [
{
"name": "mycelial_server_source",
"label": "mycelial_server node",
"type": "mycelial_server",
"display_name": "Mycelial Server",
"endpoint": "http://{host or ip}:7777/ingestion",
"token": "token",
"topic": "{topic id}"
},
{
"name": "sqlite_physical_replication_destination",
"label": "sqlite_physical_replication_destination node",
"client": "dev",
"type": "sqlite_physical_replication",
"display_name": "{display name}",
"journal_path": "{path and filename of destination journal}",
"database_path": "{path and filename of destination database"
}
]
}
]
}