Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

I want to know how to connect my mongo client to my replication set

$
0
0

I realized that the data oplog.rs is different from my client oplog.rs. Is the connection supposed to automatic once I initiated the replication set ? Or is there a step I missed in the process.

I was following this tutorial http://www.acemyskills.com/replica-sets-in-mongodb/

config = {
    _id:"acemyskillsrepsets", 
    members: [
        {_id: 0, host: "localhost:27017"},
        {_id: 1, host: "localhost:27018"},
        {_id: 2, host: "localhost:27019"}
    ]
};

acemyskillsrepsets:SECONDARY> rs.status()
{
        "set" : "acemyskillsrepsets",
        "date" : ISODate("2016-07-23T15:59:37.656Z"),
        "myState" : 2,
        "term" : NumberLong(16),
        "heartbeatIntervalMillis" : NumberLong(2000),
        "members" : [
                {
                        "_id" : 0,
                        "name" : "localhost:27017",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 23,
                        "optime" : {
                                "ts" : Timestamp(1469287537, 2),
                                "t" : NumberLong(16)
                        },
                        "optimeDate" : ISODate("2016-07-23T15:25:37Z"),
                        "configVersion" : 2,
                        "self" : true
                },
                {
                        "_id" : 1,
                        "name" : "localhost:27018",
                        "health" : 0,
                        "state" : 8,
                        "stateStr" : "(not reachable/healthy)",
                        "uptime" : 0,
                        "optime" : {
                                "ts" : Timestamp(0, 0),
                                "t" : NumberLong(-1)
                        },
                        "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
                        "lastHeartbeat" : ISODate("2016-07-23T15:59:35.045Z"),
                        "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "No connection could be made be
cause the target machine actively refused it.",
                        "configVersion" : -1
                },
                {
                        "_id" : 2,
                        "name" : "localhost:27019",
                        "health" : 0,
                        "state" : 8,
                        "stateStr" : "(not reachable/healthy)",
                        "uptime" : 0,
                        "optime" : {
                                "ts" : Timestamp(0, 0),
                                "t" : NumberLong(-1)
                        },
                        "optimeDate" : ISODate("1970-01-01T00:00:00Z"),
                        "lastHeartbeat" : ISODate("2016-07-23T15:59:35.043Z"),
                        "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "No connection could be made be
cause the target machine actively refused it.",
                        "configVersion" : -1
                }
        ],
        "ok" : 1
}

Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>