go-mysql-org / go-mysql-elasticsearch

Sync MySQL data into elasticsearch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

第一次怎么全量把数据同步到es

vperson opened this issue · comments

第一次服务启动的时候怎么才能在不修改数据表的时候,全量跑一次数据,这张表可能已经使用了很久,binlog的位置只保留了最近时间的,无法通过设置binlog位置来定位。

commented

我刚提了issue,目前好像没什么太好的解决办法,我是直接全清全删重置了从头同步一遍所有的表,但是有新表加进来又要从头再来一次:

kill -9 XXX // 停go-mysql-elasticsearch
curl -X DELETE XXX // ES业务index全删
curl -X PUT XXX // 新建索引,设_mapping

echo "" > 。。。go-mysql-elasticsearch。。。/var/master.info // 清除master.info

service mysqld stop
rm -rf /var/lib/mysql/mysql-bin.* // 清除logbin相关
service mysqld start

./bin/go-mysql-elasticsearch -config=./etc/river.toml // 改好river.toml,启动go-mysql-elasticsearch

mysqldmup试一下,应该可以解决

这个插件介绍是,第一次执行会全量同步

亲测第一次执行时就会自动全量导入ES,亲测70万条数据导入无误差