ReadySet Installation Guide for MySQL
This guide walks you through how to run ReadySet using Docker, connecting to an existing 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.
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.
--replication-tablesflag in Step 3.
To download the ReadySet Docker image from DockerHub, run the following command in your terminal:
docker pull readysettech/readyset
First, find your primary database's connection string.
It should look something like this:
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:
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:
Now, you're ready to start ReadySet. In your terminal, run the following command:
docker run -d -p 5433:5433 -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:5433 \ readysettech/readyset:latest
As you can see above, ReadySet is exposing two ports: 5433 and 6034. The ReadySet
process will listen for query traffic on port 5433 and emits telemetry on port 6034 via
/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
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,
Now ReadySet is ready to start caching queries.