etc/river.toml

# MySQL address, user and password
# user must have replication privilege in MySQL.
my_addr = "127.0.0.1:3306"
my_user = "root"
my_pass = "数据库密码"

# Elasticsearch address
es_addr = "Elasticsearch的IP地址:9200"

# Path to store data, like master.info, and dump MySQL data 
data_dir = "./var"

# Inner Http status address
stat_addr = "127.0.0.1:12800"

# pseudo server id like a slave 
<span style="color: #ff0000;">server_id = 1001        #此ID必须与上面的server_id一致</span>

# mysql or mariadb
flavor = "mysql"

# mysqldump execution path
# if not set or empty, ignore mysqldump.
mysqldump = "mysqldump"

# MySQL data source
[[source]]
schema = "torrent"      #数据库名

# Only below tables will be synced into Elasticsearch.
# "test_river_[0-9]{4}" is a wildcard table format, you can use it if you have many sub tables, like table_0000 - table_1023
# I don't think it is necessary to sync all tables in a database.
# 这里就是需要添加索引的表
tables = ["torrent[0-9]{1}","torrenta","torrentb","torrentc","torrentd","torrente","torrentf"]

# Below is for special rule mapping
[[rule]]
schema = "torrent"         # 数据库名
table = "torrent[0-9]{1}"  # 表名
index = "torrent"          # 索引名,跟之前程序创立的一致即可

[[rule]]
schema = "torrent"
table = "torrenta"
index = "torrent"

[[rule]]
schema = "torrent"
table = "torrentb"
index = "torrent"

[[rule]]
schema = "torrent"
table = "torrentc"
index = "torrent"

[[rule]]
schema = "torrent"
table = "torrentd"
index = "torrent"

[[rule]]
schema = "torrent"
table = "torrente"
index = "torrent"

[[rule]]
schema = "torrent"
table = "torrentf"
index = "torrent"

 ./bin/go-mysql-elasticsearch -config=./etc/river.toml

posted @ 2017-10-27 15:45  王东波  阅读(87)  评论(0编辑  收藏  举报