mogodb 同步数据到 ElasticSearch

发布时间 2023-04-08 12:41:54作者: 程序bug生

1、需安装:mogodb  ElasticSearch monstache

2、mogodb创建副本集

主副主开启副本集设置:

replication:
replSetName: "S1"

副机关闭防火墙,设置

net:
port: 27017
bindIp: 0.0.0.0

"C:\Program Files\MongoDB\Server\4.4\bin\mongo.exe" 127.0.0.1:27017

配置:

rs.initiate( {

... _id : "S1",
... members: [
... { _id: 0, host: "192.168.1.239:27017" },
... { _id: 1, host: "192.168.1.253:27017" }, ]
... })

 

提示成功:{

"ok" : 0,
"errmsg" : "Our set name did not match that of the request target, requestTarget:192.168.1.253:27017",
"code" : 103,
"codeName" : "NewReplicaSetConfigurationIncompatible"
}