ElasticSearch: Validation Failed: 1: script or doc is missing
While dealing with ELastic Search documents, you faced this issue while updating…
September 06, 2019
This post is about hosting MongoDB replica set cluster with dockerised images.
I have tested this on Mongo image version 4.
docker pull mongo:4
docker network create mongo-cluster-dev
Give any name of network you want. But, this will be referenced later. Keep its name.
docker run -d --net mongo-cluster-dev -p 27017:27017 --name mongoset1 mongo:4 mongod --replSet mongodb-replicaset --port 27017
docker run -d --net mongo-cluster-dev -p 27018:27018 --name mongoset2 mongo:4 mongod --replSet mongodb-replicaset --port 27018
docker run -d --net mongo-cluster-dev -p 27019:27019 --name mongoset3 mongo:4 mongod --replSet mongodb-replicaset --port 27019
We are just running three containers in same network we created above.
Open /etc/hosts
Append in the end of file:
127.0.0.1 mongoset1 mongoset2 mongoset3
Need to login to one container, and run command.
docker exec -it mongoset1 mongo
It will open up mongo shell in first container. Copy following, and paste it to that shell.
db = (new Mongo('localhost:27017')).getDB('test')
config={"_id":"mongodb-replicaset","members":[{"_id":0,"host":"mongoset1:27017"},{"_id":1,"host":"mongoset2:27018"},{"_id":2,"host":"mongoset3:27019"}]}
rs.initiate(config)
This will give some output, something like this:
{
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1567674525, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
},
"operationTime" : Timestamp(1567674525, 1)
}
Note the status: “ok” above.
mongodb://<hostname>:27017,<hostname>:27018,<hostname>:27019/<Your database name>?replicaSet=mongodb-replicaset
While dealing with ELastic Search documents, you faced this issue while updating…
Introduction You already have a content type with one or more fields in it…
I use drupal-7 in my website. I used to write articles and put images in that…
Introduction I had to create many repositories in an Github organization. I…
I have a custom content type, and there are around 2000 number of nodes in my…
This post some useful tips of using strings, and some issues while dealing with…
Introduction In this post we will see following: How to schedule a job on cron…
Introduction There are some cases, where I need another git repository while…
Introduction In this post, we will see how to fetch multiple credentials and…
Introduction I have an automation script, that I want to run on different…
Introduction I had to write a CICD system for one of our project. I had to…
Introduction Java log4j has many ways to initialize and append the desired…