Migration from MongoDB to Elasticsearch
Created by Seokje Park at 2020.02.21
keyword
mongodb to elasticsearchmigratino
We will sync mongoDB with Elasticsearch
MongoDB upgrade 3.6 to 4.0
I followed this instructions.
If you come out as below, you have succeeded.
$ mongo
rs0:PRIMARY> db.version()
4.0.16Setup Replica set on a single machine
Referenced here.
$
$ sudo mongod --fork --logpath /var/log/mongod0.log --port 27017 --dbpath /var/lib/mongo --replSet rs0 # Start a mongod instance
$ sudo mkdir -p /var/lib/mongodb1/ # Start another mongod instance
$ sudo mongod --fork --logpath /var/log/mongod1.log --port 27018 --dbpath /var/lib/mongo1 --replSet rs0
$ mongo
$ > rs.initiate()
$ > rs.add('localhost:27018') # { "ok"" 1 }
$ > rs.status()sudo killall -15 mongod: Kill all mongod process. (Use it if you want to upgrade or restart mongod)--fork --logpath /var/log/mongod0.log: Commands to Run mongod as Daemons.ps -edaf | grep mongo | grep -v grep: Command to check the running mongod process.
Install Golang-go
Download Monstache & upzip
Export your path to the .profile
Add the following lines
Test
Setup monstache config
More options can be found here.
{Any path}/config.toml
The above config needs futher investigation.
Start Synchronize MonogoDB to Elasticsearch using monstache
Security
When you apply Elasticsearch basic authentication later, you must make the following changes.
See more about elasticsearch security Setting Elaticsearch and Kibana.
Reference site
Last updated
Was this helpful?