Skip to content

Instantly share code, notes, and snippets.

@binhqd
Last active January 19, 2018 06:46
Show Gist options
  • Save binhqd/34c2d04f44b0934e4975255f59629bd9 to your computer and use it in GitHub Desktop.
Save binhqd/34c2d04f44b0934e4975255f59629bd9 to your computer and use it in GitHub Desktop.
Setup mongo to elasticsearch connector
yum install java-1.8.0-openjdk
apt-get install python-pip
pip install 'elastic2-doc-manager[elastic5]'
# install mongodb
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update
sudo apt-get install -y mongodb-org
# update /etc/elasticsearch/elasticsearch.yml, action.auto_create_index: true
echo 'action.auto_create_index: true` > /etc/elasticsearch/elasticsearch.yml
#Bổ sung
replication:
replSetName: "repl-danangtrade"
#Restart lai mongo
service mongod restart
# Initiate replication set
$ mongo
> rs.initiate()
# Connect mongo to elasticsearch
mongo-connector -m localhost:27017 -t localhost:9200 -d elastic2_doc_manager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment