go-mysql-elasticsearch
最后更新于
最后更新于
将MySQL数据同步到elasticsearch中
Install Go (1.9+) and set your GOPATH, yum install -y go
查看版本 go version
go get github.com/siddontang/go-mysql-elasticsearch
忽略控制台的消息
cd $GOPATH/src/github.com/siddontang/go-mysql-elasticsearch
这里$GOPATH
可以通过go env GOPATH
得知
make
本来我想做成RPM包,那样就可以rpm安装,但是弄了1天还没弄出来,放弃了,如果有谁知道怎么制作,请联系我
复制 go-mysql-elasticsearch 整个目录到 /usr/local/
下
vim /usr/lib/systemd/system/go-mysql-elasticsearch.service
后面就可以用 systemctl start|reload|stop go-mysql-elasticsearch
启动了
MySQL supported version < 8.0
ES supported version < 6.0
binlog format must be row.
binlog row image must be full for MySQL, you may lost some field data if you update PK data in MySQL with minimal or noblob binlog row image. MariaDB only supports full row image.
Can not alter table format at runtime.
MySQL table which will be synced should have a PK(primary key), multi columns PK is allowed now, e,g, if the PKs is (a, b), we will use "a:b" as the key. The PK data will be used as "id" in Elasticsearch. And you can also config the id's constituent part with other column.
You should create the associated mappings in Elasticsearch first, I don't think using the default mapping is a wise decision, you must know how to search accurately.
mysqldump must exist in the same node with go-mysql-elasticsearch, if not, go-mysql-elasticsearch will try to sync binlog only.
Don't change too many rows at same time in one SQL.
master.info
这个文件的目录没有自定义