Getting started¶
This guide runs meilisync against PostgreSQL and a local Meilisearch.
From zero to a live index¶
Install the package, write config.yml, start CDC. PostgreSQL is the example source — MySQL and MongoDB work the same way once extras are installed.
Checklist¶
- Install
meilisync[postgres](or the extra for your source) - Copy
config.example.ymltoconfig.ymland fill in credentials - Run
meilisync startand watch the first full sync, then CDC - Use
meilisync checkto compare source counts with Meilisearch
Prerequisites¶
- Python 3.10+ or Docker
- A Meilisearch instance
- A source database (this example uses PostgreSQL)
PostgreSQL must have logical replication enabled and the wal2json plugin installed. See PostgreSQL.
Install¶
Or with uv:
Write config.yml¶
debug: false
progress:
type: file
path: progress.json
source:
type: postgres
host: 127.0.0.1
port: 5432
user: postgres
password: postgres
database: app
meilisearch:
api_url: http://127.0.0.1:7700
api_key: MASTER_KEY
insert_size: 1000
insert_interval: 5
sync:
- table: products
index: products
pk: id
full: true
fields:
id:
name:
description:
Place the file in the working directory, or pass -c /path/to/config.yml.
Start¶
On first start, tables with full: true are copied if the Meilisearch index does not exist. Incremental replication then follows WAL changes.
Useful commands¶
| Command | What it does |
|---|---|
meilisync start |
Full sync (if needed) + incremental CDC |
meilisync refresh -t products |
Rebuild an index via a tmp index + swap |
meilisync check -t products |
Compare source row count vs Meilisearch |
meilisync version |
Print the installed version |
Stop CDC before refresh
Run refresh only while start is stopped, otherwise writes can race the swap.
Next: configuration reference and CLI.