ASQL docs / How-to guides

Copy a database into ASQL

Copy a MySQL or MariaDB database into ASQL once, without replication. The copy reads from one consistent snapshot of the source.

The store must not be open, so stop the service first:

sudo systemctl stop aios-compute
sudo -u aios /opt/aios/bin/aios --root /opt/aios/root sql copy \
  host=db.example.com user=copy pass_file=/root/db.pass db=store
sudo systemctl start aios-compute
ArgumentMeaning
host=host name, or a path for a Unix socket
port=default 3306
user=, pass_file=the source login; the file's first line is the password
db=the database to copy
tables=t1,t2 or tables=@fileonly these tables
replace=1overwrite tables that already exist in ASQL

Tables are copied one after another, then views are recreated. If the connection drops, a table with a single-column primary key carries on from the last row it copied; other tables start again.

To keep the copy in step with the source afterwards, set up a mirror instead.