Skip to content

Instantly share code, notes, and snippets.

@cuibonobo
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save cuibonobo/9934094 to your computer and use it in GitHub Desktop.

Select an option

Save cuibonobo/9934094 to your computer and use it in GitHub Desktop.
Creating a replica set in MongoDB and getting ElasticSearch to work

Stop the mongod instance first. Use launchctl list | grep mongo to find the job name and then do launchctl stop jobname.

Getting replica sets to work: http://stackoverflow.com/questions/19368875/getting-the-following-error-13279cant-find-self-in-the-replset-config-when-co

where my config is (in addition to the default homebrew config):

fork = true
bind_ip = 127.0.0.1
port = 27017
replSet = rs0

Restart MongoDB, go into the shell, and type:

var rsconfig = {"_id":"rs0","members":[{"_id":1,"host":"127.0.0.1:27017"}]}
rs.initiate(rsconfig)

Install the attachments plugin for elasticsearch by navigating to the elasticsearch directory (in brew's Cellar) and running:

bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/2.0.0

Restart elasticsearch and then run the mongo river plugin:

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

Restart elasticsearch again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment