Getting Started
This guide installs the package, loads existing MySQL rows, and runs a first search. Your application keeps writing to MySQL; MygramDB follows the binlog and answers search queries.
Using Docker?
The Quick Start on the home page runs the image with environment variables, and the Docker Deployment Guide covers the required container settings. Steps 1 and 2 below apply to Docker as well.
1. Check the Prerequisites
| Requirement | Supported |
|---|---|
| Source database | MySQL 8.4, 9.7, or 26.x with GTID enabled; MariaDB 10.11+, 11.x, or 12.x |
| Host OS for the packages | RHEL/AlmaLinux/Rocky Linux 9 or 10; Ubuntu 22.04 or 24.04 |
| Replication account | SELECT on the searchable tables, plus REPLICATION SLAVE and REPLICATION CLIENT |
What is a GTID?
A GTID identifies a transaction in the MySQL or MariaDB replication stream. MygramDB records the applied GTID so it can resume from the correct position after a restart.
2. Prepare the MySQL Source
MygramDB refuses to start against a source that does not meet its binlog requirements. Check these settings on the source:
log_bin=ONandbinlog_format=ROWgtid_mode=ONon MySQL (MariaDB GTIDs need no setting)binlog_row_image=FULLandbinlog_row_metadata=FULLbinlog_checksum=CRC32- Binlog event compression off
MySQL Replication lists every requirement with the query that checks it and the error code a missing setting produces. Then create the replication account:
CREATE USER 'repl_user'@'%' IDENTIFIED BY 'your_password';
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'repl_user'@'%';
GRANT SELECT ON myapp.articles TO 'repl_user'@'%';3. Install the Package
Download the package for your operating system and architecture from GitHub Releases. On RHEL, AlmaLinux, or Rocky Linux, install the MySQL 8.4 client libraries from the MySQL repository first, then install with dnf, which resolves the package's dependencies:
sudo dnf install -y https://dev.mysql.com/get/mysql84-community-release-el$(rpm -E %rhel)-1.noarch.rpm
sudo dnf module disable -y mysql
sudo dnf install -y ./mygramdb-*.el9.x86_64.rpmsudo apt install ./mygramdb_*_amd64.debUse the .el10 package on EL10, and the aarch64 (RPM) or arm64 (DEB) package on ARM. The Installation Guide covers every package, the Docker image, and source builds.
4. Configure MygramDB
The package installs an example configuration but does not create the active configuration. Copy it and edit the MySQL credentials, database, and table settings:
sudo cp /etc/mygramdb/config.yaml.example /etc/mygramdb/config.yaml
sudoedit /etc/mygramdb/config.yamlUse a configuration like this, replacing the example connection and table values:
mysql:
host: "127.0.0.1"
port: 3306
user: "repl_user"
password: "your_password"
database: "myapp"
tables:
- name: "articles"
text_source:
column: "content"
primary_key: "id"
replication:
server_id: 83917
network:
allow_cidrs:
- "127.0.0.1/32"| Key | What to set |
|---|---|
replication.server_id | A value unique among the MySQL replicas and MygramDB instances connected to the same source |
network.allow_cidrs | Required. Add only the client addresses that need access; an empty list denies all connections |
To check the file before starting, run mygramdb -c /etc/mygramdb/config.yaml -t. Use --check-source in place of -t to also connect to the source once and run the startup source and table checks from step 2.
5. Start the Service
sudo systemctl enable --now mygramdb
sudo systemctl status mygramdbPackage installations create a dedicated non-root service user. MygramDB refuses to run as root.
If the service stops right after start, read the log with sudo journalctl -u mygramdb. A configuration error exits with status 78, and the shipped unit does not restart it.
The listeners open before any data is loaded. A table without data rejects reads with error 6029 (HTTP 503), so an open port does not mean the server can answer queries yet.
6. Load the Existing Rows
Connect to the local TCP API and start the initial load:
mygram-cli -h 127.0.0.1 -p 11016127.0.0.1:11016> SYNC articles
OK SYNC STARTED table=articles
127.0.0.1:11016> SYNC STATUS
OK SYNC_STATUS
table=articles status=IN_PROGRESS progress=<done>/<total> rows (<percent>%) rate=<rows_per_second> rows/s
ENDSYNC runs the initial snapshot: it reads the table's existing rows from MySQL and builds the index. Afterward, binlog replication keeps the index current. Run SYNC STATUS until the table reports status=COMPLETED. Once every table has data, INFO reports readiness: ready; until then it reports readiness: not_ready with a readiness_reason line.
Load automatically at startup
With replication.auto_initial_snapshot: true, the server loads the tables itself after start, one at a time in configuration order. Wait for readiness before querying, with mygram-cli --wait-ready INFO or GET /health/ready; see Startup and Readiness.
7. Run the First Search
127.0.0.1:11016> SEARCH articles hello world
OK RESULTS 3 101 205 387OK RESULTS is followed by the total match count and the primary keys of the returned rows.
If a search returns no results, confirm that synchronization completed, the source table contains the term, and text_source.column names the intended column. With multiple configured databases, qualify the table as SEARCH app_db.articles hello world.
Next Steps
- Installation Guide - Package, Docker, and source installation
- Configuration - All configuration options
- MySQL Replication - Source server requirements and account grants
- Query Guide - Search syntax and examples