Skip to main content

Realtime sync data from MySQL/PostgreSQL/MongoDB to meilisearch

Project description

meilisync

image image image image

Introduction

Realtime sync data from MySQL/PostgreSQL/MongoDB to meilisearch.

Install

Just install from pypi:

pip install meilisync

Use docker (Recommended)

You can use docker to run meilisync:

version: '3'
services:
  meilisync:
    image: long2ice/meilisync
    volumes:
      - ./config.yml:/meilisync/config.yml
    restart: always

Quick Start

If you run meilisync without any arguments, it will try to load the configuration from config.yml in the current directory.

```shell
> meilisync
2023-03-03 15:31:26.222 | INFO     | meilisync.main:cli:44 - Full data sync for table "beauty.collection" done! 803 documents added.
2023-03-03 15:31:26.413 | INFO     | meilisync.main:cli:44 - Full data sync for table "beauty.picture" done! 10612 documents added.
2023-03-03 15:31:26.413 | INFO     | meilisync.main:cli:53 - Start increment sync data from "mysql" to MeiliSearch...

Configuration

Here is an example configuration file:

debug: true
progress:
  type: file
source:
  type: mysql
  host: 192.168.123.205
  port: 3306
  user: root
  password: '123456'
  database: beauty
meilisearch:
  api_url: http://192.168.123.205:7700
  api_key:
sync:
  - table: collection
    index: beauty-collections
    full: true
    fields:
      id:
      title:
      description:
      category:
  - table: picture
    index: beauty-pictures
    full: true
    fields:
      id:
      description:
      category:
sentry:
  dsn: ''
  environment: 'production'

debug

Enable debug mode, default is false, if you want to see more logs, you can set it to true.

progress

The progress is used to record the last sync position, such as binlog position for MySQL.

  • type: file or redis, if set to file, another option path is required.
  • path: the file path to store the progress, default is progress.json.
  • key: the redis key to store the progress, default is meilisync:progress.
  • dsn: the redis dsn, default is redis://localhost:6379/0.

source

Source database configuration, currently only support MySQL and PostgreSQL and MongoDB.

  • type: mysql or postgres or mongo.
  • server_id: the server id for MySQL binlog, default is 1.
  • other keys: the database connection arguments, MySQL see asyncmy, PostgreSQL see psycopg2, MongoDB see motor.

meilisearch

MeiliSearch configuration.

  • api_url: the MeiliSearch API URL.
  • api_key: the MeiliSearch API key.

sync

The sync configuration, you can add multiple sync tasks.

  • table: the database table name or collection name.
  • index: the MeiliSearch index name, if not set, it will use the table name.
  • full: whether to do a full sync, default is false.
  • fields: the fields to sync, if not set, it will sync all fields. The key is table field name, the value is the MeiliSearch field name, if not set, it will use the table field name.

sentry

Sentry configuration.

  • dsn: the sentry dsn.
  • environment: the sentry environment, default is production.

License

This project is licensed under the Apache-2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

meilisync-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

meilisync-0.1.0-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file meilisync-0.1.0.tar.gz.

File metadata

  • Download URL: meilisync-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for meilisync-0.1.0.tar.gz
Algorithm Hash digest
SHA256 477fa08de7130075cd97bc00f8c695e34d270e3de8f411eef8311d0b1a69481f
MD5 5daee29581b7b6f5817626931debc04b
BLAKE2b-256 28b96255cba9c6d80953faf8e60f05f8d38f2836dcc50f4ac381828e08ced660

See more details on using hashes here.

File details

Details for the file meilisync-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: meilisync-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for meilisync-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e16636ee927e0378cce3712c7d6fe8982ff5ac1877f7de203e30b65ff3228bb8
MD5 8008ffa61cfb8c4ab9969fa83b41dcf3
BLAKE2b-256 5771612b33bd9addca2b2debd2836ae2a2e35b68aee56098995e2290fad8844b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page