Sunday, February 24, 2019

Replica Set in MongoDB


  • Replica Set  in MongoDB ensure high availability and redundancy.
  • Replica Set is  basically set of different  mongod processes which can run on different machines or on same machine. Typically in a prod environment, these should run on different machines/nodes.
  • All members of replica set contains same data.
  • There can be only 1  read-write member which is called primary member.
  • All others members are read only members called secondary members.
  • Data is replicated from read-write member to read only members asynchronously.
  • Optionally, there can be arbiter which does not require dedicated hardware. Arbiter is not data bearing node. It just participates is elections to obtain majority.
  • It is recommended to have add number of nodes in Mongo replica set. We typically add a arbiter to make odd number of nodes in replica set.
  • When primary node fails, or does not communicate with other nodes in replica set( for by default 10 sec), an election happens. The purpose of elections is to choose a primary in mongo replica set, so that normal operations can be resumed (write can also happen now). Election can also happen in certain other circumstances.


Saturday, April 28, 2018

Oracle listener spawning child process


Recently, faced an issue in one of our oracle databases running on 12.1, that the listener was spawning a child process every few minutes. Also, we could observe high listener latency of ~5000ms.

At first, stopped the listener and started it again, but it did not help at all. 
Then, checked the listener log and saw connection coming to the order of 100times the normal connections.  Got the application bounced. It helped temporarily and after sometime, got the same problem back.

Finally we got the root cause -the sqlnet.ora was somehow renamed to sqlnet.or and this was causing connections. Once the file was renamed to sqlnet.ora, everything went fine

Sunday, December 17, 2017

How to set up EC2 instance in AWS Cloud

Today, I am going to show how to set up EC2 instance on  AWS cloud.


Login to AWS console and go to Services> Compute >EC2


Next, choose the  OS/platform you want to select. I selected Ubuntu which is also free tier eligible.

Next, choose the hardware type-cpu, memory, storage etc


Next, choose other details, like security groups, choose a new key pair if you haven't created.Download your private key here -this is important.It will be in .pem format. Add tags etc and finally review the configuration


Finally, launch the instance. It will take a while-couple of minutes and then instance will come up


Finally your instance us up! and you can get the details-public dns, public IP and other details. 

Now before connect to this instance using putty, Use puttykeygen to convert .pem into .ppk. 
Load . pem and save the private key-.ppk.  Now connect to putty using 
ubuntu@"Public DNS" as give above, remember to give the above .ppk in Connection >SSH >Auth in putty.