Skip to main content

Quick Start

This guide will walk you through the process of downloading and using Mycelite with the SQLite command line program. At the end of this guide, you'll have a working writer and reader instance of Mycelite that are synchronized.

Prerequisites

You'll need a version of SQLite that allows using extensions.

brew install sqlite

IMPORTANT: follow the instructions to add the SQLite binary to your path then restart your terminal or source your profile.

Download the extension

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

Configuring the writer

Start the SQLite command line program

sqlite3

Load the extension

.load ./libmycelite mycelite_writer

Open a new database as a writer

.open writer.db

Configure Mycelite

The first time you use Mycelite, you'll need to load the configuration extension and configure Mycelite, subsequently, you can skip this step.

.load ./libmycelite mycelite_config

Signup for a free account on the hub and retrieve your user name and secret.

Configure Mycelite by running the following insert statement. The domain is a slug-like unique name of your choosing. The client_id is your user name and the secret is obtained from the hub.

insert into mycelite_config values 
('domain', '<domain>/<db-name>'),
('client_id', '<your-hub-username>'),
('secret', '<secret-from-hub>');

You can verify the config with the following SQL statement.

select * from mycelite_config;

Configuring the reader

Start the SQLite command line program

sqlite3

Load the extension

.load ./libmycelite mycelite_reader

Open a new database as a reader

.open reader.db

Configure Mycelite

The first time you use Mycelite, you'll need to load the configuration extension and configure Mycelite, subsequently, you can skip this step.

.load ./libmycelite mycelite_config

Configure Mycelite by running the following insert statement. The domain is a slug-like unique name of your choosing. The client_id is your user name and the secret is obtained from the hub.

insert into mycelite_config values 
('domain', '<domain>/<db-name>'),
('client_id', '<your-hub-username>'),
('secret', '<secret-from-hub>');

You can verify the config with the following SQL statement.

select * from mycelite_config;

Observing Synchronization

In the writer instance, create a table and then insert a row in the writer instance.

create table test(number integer);
insert into test(number) values (42);

Now in the reader instance, you will see the new table and you can query it.

.tables
select * from test;