MySQL FULLTEXT too slow?
MygramDB delivers sub-millisecond queries with in-memory indexing. No more timeout errors.
In-memory search engine with MySQL / MariaDB binlog replication
MySQL requires GTID mode and a replication user:
SET GLOBAL enforce_gtid_consistency = ON;
SET GLOBAL gtid_mode = OFF_PERMISSIVE;
SET GLOBAL gtid_mode = ON_PERMISSIVE;
SET GLOBAL gtid_mode = ON;
CREATE USER 'repl_user'@'%' IDENTIFIED BY 'your_password';
-- SELECT: for initial snapshot of search target tables
GRANT REPLICATION SLAVE, REPLICATION CLIENT, SELECT ON mydb.* TO 'repl_user'@'%';docker run -d --name mygramdb \
-p 11016:11016 -p 8080:8080 \
-e MYSQL_HOST=your-mysql-host \
-e MYSQL_USER=repl_user \
-e MYSQL_PASSWORD=your_password \
-e MYSQL_DATABASE=mydb \
-e TABLE_NAME=articles \
-e TABLE_PRIMARY_KEY=id \
-e TABLE_TEXT_COLUMN=content \
-e TABLE_NGRAM_SIZE=2 \
-e REPLICATION_SERVER_ID=12345 \
-e NETWORK_ALLOW_CIDRS=0.0.0.0/0 \
ghcr.io/libraz/mygram-db:latestWARNING
NETWORK_ALLOW_CIDRS=0.0.0.0/0 allows connections from any IP. For production, restrict to specific ranges (e.g., 10.0.0.0/8,172.16.0.0/12).
docker exec mygramdb mygram-cli -p 11016 SYNC articles
echo "SEARCH articles hello world" | nc localhost 11016See Official Clients for full Node.js, Python, and Go usage.
npm install mygramdb-clientyarn add mygramdb-clientbun add mygramdb-clientimport { createMygramClient } from 'mygramdb-client'
const client = createMygramClient({ host: 'localhost', port: 11016 })
await client.connect()
const results = await client.search('app_db.articles', 'hello world', {
limit: 10
})go get github.com/libraz/go-mygram-clientimport mygram "github.com/libraz/go-mygram-client"
client := mygram.NewClient("localhost:11016")
defer client.Close()
client.Connect()
resp, _ := client.Search("app_db.articles", "hello world", mygram.SearchOptions{
Limit: 10,
})pip install mygramdb-clientfrom mygramdb_client import MygramClient, ClientConfig, SearchOptions
async with MygramClient(ClientConfig(host='localhost', port=11016)) as client:
results = await client.search(
'app_db.articles',
'hello world',
SearchOptions(limit=10),
)python-mygramdb-client on GitHub