Archive for the ‘NoSQL’ Category

MongoDB Learning Notes – Simulate automate failover

February 22, 2015 Leave a comment

To simulate automate failover I kill the primary node with Ctrl+C or use command db.shutdownServer(). When the primary killed, the secondary become primary because a majority of the original nodes (the arbiter and the secondary) are still able ping each other.

myapp:PRIMARY> db.shutdownServer()
shutdown command only works with the admin database; try 'use admin'
myapp:PRIMARY> use admin
switched to db admin
myapp:PRIMARY> db.shutdownServer()

And in secondary node log:

2015-02-22T13:58:33.558+0700 [rsHealthPoll] replSet member bluething-PC:20000 is now in state DOWN
2015-02-22T13:58:34.391+0700 [conn501] replSet info voting yea for bluething-PC:20001 (1)
2015-02-22T13:58:36.565+0700 [rsHealthPoll] warning: Failed to connect to, reason
: errno:10061 No connection could be made because the target machine actively refused it.
2015-02-22T13:58:36.565+0700 [rsHealthPoll] replset info bluething-PC:20000 heartbeat failed, retrying
2015-02-22T13:58:36.632+0700 [rsHealthPoll] replSet member bluething-PC:20001 is now in state PRIMARY

Connect to secondary and check status Read more…


MongoDB Learning Notes – Replication Overview and Setup replica set

February 22, 2015 Leave a comment

MongoDB provides two flavors of replication: master-slave replication and replica sets. For both, a single primary node receives all writes, and then all secondary nodes read and apply those write to themselves asynchronously. Replica sets additionally ensure automated failover: if the primary goes offline for any reason, then one of the secondary nodes will automatically be promoted to primary, if possible.

The minimum recommended replica sets configuration consists of three nodes. Two of these nodes serve as first-class, persistent mongod instance. Either can act as the replica set primary, and both have a full copy of the data. The third node in the set is an arbiter, which doesn’t replicate data, but merely acts as a kind of neutral observer, when failover is required, the arbiter helps to elect a new primary node.

1. Creating a data directory
I’m using windows and data directory is C:\data

mkdir C:\data\node1
mkdir C:\data\node2
mkdir C:\data\arbiter

2. Start each node as separate mongod (in separate terminal) Read more…

Categories: MongoDB, NoSQL Tags: , ,

Install Mongodb & Apache Cassandra

September 28, 2012 1 comment

Intall mongodb di Fedora 17 (saya menggunakan metode ekstract file):

Siapkan file mongodb terbaru, bisa didownload di sini.

Ekstract file dan pindahkan ke direktori /opt Read more…

Categories: NoSQL