Replica Mongodb Set Does Not Connect

Asked

Viewed 109 times

0

I’ve climbed a cluster with Docker, and I’m having trouble connecting to the replicaset.

The Docker-Compose is on the github and the instructions that surround it in the readme.

Remembering that I can connect with separate instances (each one in a port) and replication is taking place, but I can’t connect using Replica Set Robo 3T.

rs.status():

{
        "set" : "replica-set",
        "date" : ISODate("2019-04-04T15:40:06.789Z"),
        "myState" : 1,
        "term" : NumberLong(5),
        "syncingTo" : "",
        "syncSourceHost" : "",
        "syncSourceId" : -1,
        "heartbeatIntervalMillis" : NumberLong(2000),
        "optimes" : {
                "lastCommittedOpTime" : {
                        "ts" : Timestamp(1554392406, 1),
                        "t" : NumberLong(5)
                },
                "readConcernMajorityOpTime" : {
                        "ts" : Timestamp(1554392406, 1),
                        "t" : NumberLong(5)
                },
                "appliedOpTime" : {
                        "ts" : Timestamp(1554392406, 1),
                        "t" : NumberLong(5)
                },
                "durableOpTime" : {
                        "ts" : Timestamp(1554392406, 1),
                        "t" : NumberLong(5)
                }
        },
        "lastStableCheckpointTimestamp" : Timestamp(1554392356, 1),
        "members" : [
                {
                        "_id" : 0,
                        "name" : "mongo-primary:27017",
                        "health" : 1,
                        "state" : 1,
                        "stateStr" : "PRIMARY",
                        "uptime" : 406,
                        "optime" : {
                                "ts" : Timestamp(1554392406, 1),
                                "t" : NumberLong(5)
                        },
                        "optimeDate" : ISODate("2019-04-04T15:40:06Z"),
                        "syncingTo" : "",
                        "syncSourceHost" : "",
                        "syncSourceId" : -1,
                        "infoMessage" : "",
                        "electionTime" : Timestamp(1554392015, 1),
                        "electionDate" : ISODate("2019-04-04T15:33:35Z"),
                        "configVersion" : 2,
                        "self" : true,
                        "lastHeartbeatMessage" : ""
                },
                {
                        "_id" : 1,
                        "name" : "mongo-worker-1:27017",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 401,
                        "optime" : {
                                "ts" : Timestamp(1554392396, 1),
                                "t" : NumberLong(5)
                        },
                        "optimeDurable" : {
                                "ts" : Timestamp(1554392396, 1),
                                "t" : NumberLong(5)
                        },
                        "optimeDate" : ISODate("2019-04-04T15:39:56Z"),
                        "optimeDurableDate" : ISODate("2019-04-04T15:39:56Z"),
                        "lastHeartbeat" : ISODate("2019-04-04T15:40:05.255Z"),
                        "lastHeartbeatRecv" : ISODate("2019-04-04T15:40:05.470Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "",
                        "syncingTo" : "mongo-primary:27017",
                        "syncSourceHost" : "mongo-primary:27017",
                        "syncSourceId" : 0,
                        "infoMessage" : "",
                        "configVersion" : 2
                },
                {
                        "_id" : 2,
                        "name" : "mongo-worker-2:27017",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 401,
                        "optime" : {
                                "ts" : Timestamp(1554392396, 1),
                                "t" : NumberLong(5)
                        },
                        "optimeDurable" : {
                                "ts" : Timestamp(1554392396, 1),
                                "t" : NumberLong(5)
                        },
                        "optimeDate" : ISODate("2019-04-04T15:39:56Z"),
                        "optimeDurableDate" : ISODate("2019-04-04T15:39:56Z"),
                        "lastHeartbeat" : ISODate("2019-04-04T15:40:05.255Z"),
                        "lastHeartbeatRecv" : ISODate("2019-04-04T15:40:05.409Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "",
                        "syncingTo" : "mongo-primary:27017",
                        "syncSourceHost" : "mongo-primary:27017",
                        "syncSourceId" : 0,
                        "infoMessage" : "",
                        "configVersion" : 2
                },
                {
                        "_id" : 3,
                        "name" : "mongo-worker-3:27017",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 401,
                        "optime" : {
                                "ts" : Timestamp(1554392396, 1),
                                "t" : NumberLong(5)
                        },
                        "optimeDurable" : {
                                "ts" : Timestamp(1554392396, 1),
                                "t" : NumberLong(5)
                        },
                        "optimeDate" : ISODate("2019-04-04T15:39:56Z"),
                        "optimeDurableDate" : ISODate("2019-04-04T15:39:56Z"),
                        "lastHeartbeat" : ISODate("2019-04-04T15:40:05.285Z"),
                        "lastHeartbeatRecv" : ISODate("2019-04-04T15:40:05.536Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "",
                        "syncingTo" : "mongo-primary:27017",
                        "syncSourceHost" : "mongo-primary:27017",
                        "syncSourceId" : 0,
                        "infoMessage" : "",
                        "configVersion" : 2
                }
        ],
        "ok" : 1,
        "operationTime" : Timestamp(1554392406, 1),
        "$clusterTime" : {
                "clusterTime" : Timestamp(1554392406, 1),
                "signature" : {
                        "hash" : BinData(0,"ofZZ5oaloCumdHUabvI0gqgvTdA="),
                        "keyId" : NumberLong("6675761178200768514")
                }
        }
}

Error I get when trying to connect by Robo 3T:

erro que recebo

1 answer

0

In the connection string of robo3T, put the name of the machine and not localhost: Mongo-Primary:27017 No type put replica-set.

Make sure to rotate.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.