ReadySet Installation Guide for MySQL

This guide walks you through how to run ReadySet using Docker, connecting to an existing primary database.

0. Make sure you can connect to your primary database.

ReadySet needs to be installed on a machine that can communicate with your primary database. To check to make sure that it can, you can run the following on that instance:

mysql -u <username> -p -h <database host>

If you are able to successfully make the connection, you are ready to move onto the next steps.

1. Ensure you have sufficient disk space and memory for ReadySet

Any tables referenced by queries that you would like to cache need to be pulled into ReadySet. Before installing ReadySet, ensure that the machine that you are installing it on has sufficient disk space and memory to replicate the base tables and cache queries.

Note that by default, ReadySet will pull in all tables from your database. If you only want to pull in specific tables, you will need to set the --replication-tables flag in Step 3.

2. Download the ReadySet Docker image

To download the ReadySet Docker image from DockerHub, run the following command in your terminal:

docker pull readysettech/readyset

3. Run ReadySet

First, find your primary database's connection string.

It should look something like this:

mysql://<username>:<password>@<host>:<port>/<db_name>

By default, ReadySet will import all tables. If you'd like to import all database tables, you can skip defining a REPLICATION_TABLES environment variable. If, however, you'd only like to import a a subset of your database, then you need to define the list of tables you want to pull into ReadySet as a comma-separated list: <schema>.<table>, <schema>.<table2>. Note, this is optional - you can import all tables too by ignoring this command line flag. If you'd like to import all of the tables in a given schema, you can specify everything as follows: <schema name>.*.

Now, you're ready to start ReadySet. In your terminal, run the following command:

docker run -d -p 3307:3307 -p 6034:6034         \
--name readyset                                 \
-e UPSTREAM_DB_URL=<database connection string> \
-e REPLICATION_TABLES=<specific tables or omit> \
-e LISTEN_ADDRESS=0.0.0.0:3307                  \
readysettech/readyset:latest

As you can see above, ReadySet is exposing two ports: 3307 and 6034. The ReadySet process will listen for query traffic on port 3307 and emits telemetry on port 6034 via a /metrics endpoint. All -e environment variables can be placed into a file and referenced via Docker's --env-file flag if you'd rather simply your command line experience.

If your database is running locally, you'll need to use host.docker.internal rather than localhost.
If you're running our current docker image on a Mac, you'll see a warning: WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested. You can ignore this; alternatively, you can pass the --platform linux/amd64 flag to the docker run command to suppress the warning.

ReadySet will then connect to your database and replicate specified tables (i.e. all or the explictly defined ones). Depending on how large these tables are and the network connection between ReadySet and your database, this could take between seconds and hours.

To check whether the tables have been imported, run the following:

docker logs readyset

While the snapshot is ongoing, you will see many log messages related to snapshotting progress.

Once you see:

INFO replicators::noria_adapter: Streaming replication started

ReadySet is ready to start caching queries.

Alternatively, you can log into the ReadySet shell and run

SHOW READYSET STATUS;

Look at the Snapshot Status column. If snapshotthing successfully completed, it'll report Completed.

Now ReadySet is ready to start caching queries.

Next Steps

As a next step, you can connect to ReadySet from a database shell or connect from your application.