日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > 数据库 >内容正文

数据库

elasticsearch mongodb mysql_Elasticsearch 与 Mongodb 数据同步问题

發(fā)布時(shí)間:2023/12/20 数据库 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 elasticsearch mongodb mysql_Elasticsearch 与 Mongodb 数据同步问题 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

1、mongo-connector工具

首先安裝python環(huán)境

wget http://www.python.org/ftp/python/3.0.1/Python-3.0.1.tgz

tar -zxvf Python-3.0.1.tgz

cd Python-3.0.1

./configure

make all

make install

看來(lái)新裝的版本生效了,做個(gè)軟連接應(yīng)該就OK。

ln -s /usr/local/bin/python3.0 /usr/bin/python

python -V

安裝pip

$ wget https://bootstrap.pypa.io/get-pip.py

$ python get-pip.py

$ pip -V  #查看pip版本

安裝mongo-connector

如果是 Elasticsearch 5.x

pip install 'mongo-connector[elastic5]'

[Reference]?https://github.com/mongodb-labs/mongo-connector

執(zhí)行命令:

mongo-connector -m 192.9.8.204:27017 -t 192.9.8.223:9200 -d elastic2_doc_manager -n wymlib.ym_literature

-m :mongodb地址,-t:目的地址,-d :?Used to specify the path to each doc manager file that will be used.? ? -n:指定數(shù)據(jù)庫(kù)

2、elasticsearch-river-mongodb

該工具只支持 elasticsearch?1.7.3 及以下版本

bin/plugin --install com.github.richardwilly98.elasticsearch/elasticsearch-river-mongodb/2.0.9

mongodb-river同步信息屬性配置完整版:

1 $ curl -XPUT "localhost:9200/_river/${es.river.name}/_meta" -d '2 {3 "type": "mongodb",4 "mongodb": {5 "servers":6 [7 { "host": ${mongo.instance1.host}, "port": ${mongo.instance1.port} },8 { "host": ${mongo.instance2.host}, "port": ${mongo.instance2.port} }9 ],10 "options": {11 "secondary_read_preference" : true,12 "drop_collection": ${mongo.drop.collection},13 "exclude_fields": ${mongo.exclude.fields},14 "include_fields": ${mongo.include.fields},15 "include_collection": ${mongo.include.collection},16 "import_all_collections": ${mongo.import.all.collections},17 "initial_timestamp": {18 "script_type": ${mongo.initial.timestamp.script.type},19 "script": ${mongo.initial.timestamp.script}20 },21 "skip_initial_import" : ${mongo.skip.initial.import},22 "store_statistics": ${mongo.store.statistics},23 },24 "credentials":25 [26 { "db": "local", "user": ${mongo.local.user}, "password": ${mongo.local.password} },27 { "db": "admin", "user": ${mongo.db.user}, "password": ${mongo.db.password} }28 ],29 "db": ${mongo.db.name},30 "collection": ${mongo.collection.name},31 "gridfs": ${mongo.is.gridfs.collection},32 "filter": ${mongo.filter}33 },34 "index": {35 "name": ${es.index.name},36 "throttle_size": ${es.throttle.size},37 "bulk_size": ${es.bulk.size},38 "type": ${es.type.name}39 "bulk": {40 "actions": ${es.bulk.actions},41 "size": ${es.bulk.size},42 "concurrent_requests": ${es.bulk.concurrent.requests},43 "flush_interval": ${es.bulk.flush.interval}44 }45 }46 }'

[Reference]?https://github.com/richardwilly98/elasticsearch-river-mongodb

總結(jié)

以上是生活随笔為你收集整理的elasticsearch mongodb mysql_Elasticsearch 与 Mongodb 数据同步问题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。