go-mysql-elasticsearch同期

go-mysql-elasticsearch同期


git clone https://github.com/siddontang/go-mysql-elasticsearch.git
次に、modを直接更新し ます
。gomodtidy

次に
、etc / river.goの構成ファイルをコンパイルして変更し、直接
./bin/go-mysql-elasticsearch ./etc/river.toml
を起動します。バックグラウンドで起動する必要がある場合は、。/ bin / go -mysql-elasticsearchをnohupします。 /etc/river.toml&
このように、コンテナを終了しても、追加、削除、変更を行うと自動的に同期されます。サポートされているバージョン番号はelasticsearch 6.0未満であるとの関係者によると、気にしないでください。プロテスト7.8.1も同期できます。

構成ファイルは、公式のガベージドキュメントではなく、自分で作成します。

# MySQL address, user and password
    # user must have replication privilege in MySQL.
    my_addr = "IP:3306"
    my_user = "root"
    my_pass = "123456"
    #my_charset = "utf8"
    
    # Set true when elasticsearch use https
    es_https = false
    # Elasticsearch address
    es_addr = "IP:9200"
    # Elasticsearch user and password, maybe set by shield, nginx, or x-pack
    es_user = ""
    es_pass = ""
    
    # Path to store data, like master.info, if not set or empty,
    # we must use this to support breakpoint resume syncing.
    # TODO: support other storage, like etcd.
    data_dir = "./var"
    
    # Inner Http status address
    stat_addr = "127.0.0.1:12800"
    stat_path = "/metrics"
    
    # pseudo server id like a slave
    server_id = 1001
    
    # mysql or mariadb
    flavor = "mysql"
    
    # mysqldump execution path
    # if not set or empty, ignore mysqldump.
    mysqldump = "mysqldump"
    
    # if we have no privilege to use mysqldump with --master-data,
    # we must skip it.
    #skip_master_data = false
    
    # minimal items to be inserted in one bulk
    bulk_size = 128
    
    # force flush the pending requests if we don't have enough items >= bulk_size
    flush_bulk_time = "200ms"
    
    # Ignore table without primary key
    skip_no_pk_table = false
    
    # MySQL data source
    [[source]]
    schema = "official-website"
    tables = ["xc_cases"]
    [[rule]]
    schema = "official-website"
    table = "xc_cases"
    index = "xc_cases"
    type = "buildingtype"

おすすめ

転載: blog.csdn.net/XiaoAnGeGe/article/details/107958250