← All posts

Why I prefer binlog-based sync over dual writes

Keeping MySQL and Elasticsearch consistent without making every write path care about search.

The problem

A search index has to follow the source database. Dual writes from the application look simple, but a partial failure leaves the two stores silently out of sync.

Principles I lean on

Trade-offs

Decision Option A Option B
Sync method Dual write: simple, can drift Binlog CDC: consistent, more infrastructure
Permissions Filter at index time: fast queries Filter at query time: always current