Mongo_uri set correctly I think but graylog says ERROR [cluster] Expecting replica set member from set

Hey @log

First, thanks for making me smile today, PRIMARYGUY :laughing:

Your settings look correct, I see you using Differen port for each mondoDb, but did you configure each Mongo node with those ports?

vi /etc/mongod.conf
net:
  port: 27017
  bindIp: PRIMARYGUY
replication:
  replicaSetName: mongoReplicaSet
net:
  port: 27021
  bindIp: SECONDARY1
replication:
  replicaSetName: mongoReplicaSet
net:
  port: 27022
  bindIp: SECONDARY2
replication:
  replicaSetName: mongoReplicaSet

Second, when you execute this mongo shell command , what do you see?

mongoReplicaSet:PRIMARYGUY> rs.config()
mongoReplicaSet:PRIMARYGUY> rs.status()
Here is my config output
{
        "_id" : "mongoReplicaSet",
        "version" : 3,
        "protocolVersion" : NumberLong(1),
        "writeConcernMajorityJournalDefault" : true,
        "members" : [
                {
                        "_id" : 0,
                        "host" : "mongo-node-1.domain.com:27017",
                        "arbiterOnly" : false,
                        "buildIndexes" : true,
                        "hidden" : false,
                        "priority" : 1,
                        "tags" : {

                        },
                        "slaveDelay" : NumberLong(0),
                        "votes" : 1
                },
                {
                        "_id" : 1,
                        "host" : "mongo-node-2.domain.com:27017",
                        "arbiterOnly" : false,
                        "buildIndexes" : true,
                        "hidden" : false,
                        "priority" : 1,
                        "tags" : {

                        },
                        "slaveDelay" : NumberLong(0),
                        "votes" : 1
                },
                {
                        "_id" : 2,
                        "host" : "mongo-node-3.domain.com:27017",
                        "arbiterOnly" : false,
                        "buildIndexes" : true,
                        "hidden" : false,
                        "priority" : 1,
                        "tags" : {

                        },
                        "slaveDelay" : NumberLong(0),
                        "votes" : 1
                }
        ],
        "settings" : {
                "chainingAllowed" : true,
                "heartbeatIntervalMillis" : 2000,
                "heartbeatTimeoutSecs" : 10,
                "electionTimeoutMillis" : 10000,
                "catchUpTimeoutMillis" : -1,
                "catchUpTakeoverDelayMillis" : 30000,
                "getLastErrorModes" : {

                },
                "getLastErrorDefaults" : {
                        "w" : 1,
                        "wtimeout" : 0
                },
                "replicaSetId" : ObjectId("5d1e36618481a2906eb97171")
        }
}
Here is my Status output
# Example output
mongoReplicaSet:PRIMARY> rs.status()
{
        "set" : "mongoReplicaSet",
        "date" : ISODate("2019-07-10T21:58:51.943Z"),
        "myState" : 1,
        "term" : NumberLong(11),
        "syncingTo" : "",
        "syncSourceHost" : "",
        "syncSourceId" : -1,
        "heartbeatIntervalMillis" : NumberLong(2000),
        "optimes" : {
                "lastCommittedOpTime" : {
                        "ts" : Timestamp(1562795931, 2),
                        "t" : NumberLong(11)
                },
                "readConcernMajorityOpTime" : {
                        "ts" : Timestamp(1562795931, 2),
                        "t" : NumberLong(11)
                },
                "appliedOpTime" : {
                        "ts" : Timestamp(1562795931, 2),
                        "t" : NumberLong(11)
                },
                "durableOpTime" : {
                        "ts" : Timestamp(1562795931, 2),
                        "t" : NumberLong(11)
                }
        },
        "lastStableCheckpointTimestamp" : Timestamp(1562795908, 3),
        "members" : [
                {
                        "_id" : 0,
                        "name" : "mongo1.domain.net:27017",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 5542,
                        "optime" : {
                                "ts" : Timestamp(1562795931, 1),
                                "t" : NumberLong(11)
                        },
                        "optimeDurable" : {
                                "ts" : Timestamp(1562795931, 1),
                                "t" : NumberLong(11)
                        },
                        "optimeDate" : ISODate("2019-07-10T21:58:51Z"),
                        "optimeDurableDate" : ISODate("2019-07-10T21:58:51Z"),
                        "lastHeartbeat" : ISODate("2019-07-10T21:58:51.622Z"),
                        "lastHeartbeatRecv" : ISODate("2019-07-10T21:58:50.303Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "",
                        "syncingTo" : "gl-mongo2.domain.com:27017",
                        "syncSourceHost" : "gl-mongo2.domain.com:27017",
                        "syncSourceId" : 1,
                        "infoMessage" : "",
                        "configVersion" : 3
                },
                {
                        "_id" : 1,
                        "name" : "mongo2.domain.net:27017",
                        "health" : 1,
                        "state" : 1,
                        "stateStr" : "PRIMARY",
                        "uptime" : 5669,
                        "optime" : {
                                "ts" : Timestamp(1562795931, 2),
                                "t" : NumberLong(11)
                        },
                        "optimeDate" : ISODate("2019-07-10T21:58:51Z"),
                        "syncingTo" : "",
                        "syncSourceHost" : "",
                        "syncSourceId" : -1,
                        "infoMessage" : "",
                        "electionTime" : Timestamp(1562790394, 1),
                        "electionDate" : ISODate("2019-07-10T20:26:34Z"),
                        "configVersion" : 3,
                        "self" : true,
                        "lastHeartbeatMessage" : ""
                },
                {
                        "_id" : 2,
                        "name" : "mongo3.domain.net:27017",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 5511,
                        "optime" : {
                                "ts" : Timestamp(1562795931, 1),
                                "t" : NumberLong(11)
                        },
                        "optimeDurable" : {
                                "ts" : Timestamp(1562795931, 1),
                                "t" : NumberLong(11)
                        },
                        "optimeDate" : ISODate("2019-07-10T21:58:51Z"),
                        "optimeDurableDate" : ISODate("2019-07-10T21:58:51Z"),
                        "lastHeartbeat" : ISODate("2019-07-10T21:58:51.686Z"),
                        "lastHeartbeatRecv" : ISODate("2019-07-10T21:58:50.938Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "",
                        "syncingTo" : "mongo2.enseva-labs.net:27017",
                        "syncSourceHost" : "mongo2.domain.com:27017",
                        "syncSourceId" : 1,
                        "infoMessage" : "",
                        "configVersion" : 3
                }
        ],
        "ok" : 1,
        "operationTime" : Timestamp(1562795931, 2),
        "$clusterTime" : {
                "clusterTime" : Timestamp(1562795931, 2),
                "signature" : {
                        "hash" : BinData(0,"K2p6/W2VrP3eycBcW9xzneDo9Gc="),
                        "keyId" : NumberLong("6709860293658279938")
                }
        }
}

EDIT:
I forgot to ask , when you created Mongo cluster did you go through Mongo shell
Example, this is from my PRIMARYGUY.

# Enter the following command to create the replica set.
> rs.initiate()

# Enter the following command to add other nodes, where the other node is named, 
# for example, "mongo-node-2" and the domain is domain.com.
> rs.add("mongo-node-2.domain.com")
> rs.initiate()
# Enter the following command to add other nodes, where the other node is named, 
# for example, "mongo-node-3" and the domain is domain.com.
> rs.add("mongo-node-3.domain.com")

1 Like