React JS router not working on Nginx docker container
Problem Statement I developed a simple ReactJS application where I have used…
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
Problem Statement I developed a simple ReactJS application where I have used…
Being a drupal user from last around 5 years, I used to know small codes for…
Agenda I will cover following in this post: Prepare Docker image for Next.js app…
Note: I have public URLs of these images, which I want to save. return…
Introduction If you working on a github project in a team. Consider you have…
Its good to write unit tests cases, and this part is mostly forgotten by…
Introduction This post has the complete code to send email through smtp server…
Introduction In a normal email sending code from python, I’m getting following…
Introduction In one of my app, I was using to talk to . I have used some event…
Introduction So you have a Django project, and want to run it using docker image…
Introduction It is very important to introduce few process so that your code and…
Introduction In this post, we will see a sample Jenkin Pipeline Groovy script…