Error in seed list

I’ve got a setting wrong here, but can’t figure out where. If I connect to my node at port 27001 and run rs.isMaster() then I get back:

MongoDB Enterprise m103-repl:PRIMARY> rs.isMaster()
{
        "hosts" : [
                "m103:27001",
                "192.168.103.100:27002",
                "192.168.103.100:27003"
        ],
        "setName" : "m103-repl",
       ...

If I connect the port 26000 and try to add the shard with sh.addShard("m103-repl/192.168.103.100:27001")

Then I get back:

MongoDB Enterprise mongos> sh.addShard("m103-repl/192.168.103.100:27001")                           
{                                                                                                   
        "ok" : 0,                                                                                   
        "errmsg" : "in seed list m103-repl/192.168.103.100:27001, host 192.168.103.100:27001 does no
t belong to replica set m103-repl; found { hosts: [ \"m103:27001\", \"192.168.103.100:27002\", \"192
.168.103.100:27003\" ], setName: \"m103-repl\", setVersion: 4, ismaster: true, secondary: false, pri
mary: \"192.168.103.100:27002\", me: \"192.168.103.100:27002\", electionId: ObjectId('7fffffff000000

I’ve tried different shard names like m103-repl, m103-repl:27001 etc. Just not sure the fix here, I messed myself up by adding the example lecture replication set to this shard

Let’s see the rs.isMaster() or rs.status() for your config server replica set, confirm the primary node of your m103-repl replica set and I’ll advise.

Ok, so connecting to:

vagrant@m103:~/sharding$ mongo --host "m103-csrs/192.168.103.100:26001" -u "m103-admin" -p "m103-pa ss" --authenticationDatabase "admin"
MongoDB Enterprise m103-csrs:PRIMARY> rs.isMaster()                                
{                                                                                  
        "hosts" : [                                                                
                "192.168.103.100:26001",                                           
                "192.168.103.100:26002",                                           
                "192.168.103.100:26003"                                            
        ],                                                                         
        "setName" : "m103-csrs",                                                   
        "setVersion" : 3,                                                          
        "ismaster" : true,                                                         
        "secondary" : false,                                                       
        "primary" : "192.168.103.100:26001",                                       
        "me" : "192.168.103.100:26001",                                            
        "electionId" : ObjectId("7fffffff0000000000000001"),                       
        "lastWrite" : {                                                            
                "opTime" : {                                                       
                        "ts" : Timestamp(1583107618, 1),                           
                        "t" : NumberLong(1)                                        
                },                                                                 
                "lastWriteDate" : ISODate("2020-03-02T00:06:58Z"),                 
                "majorityOpTime" : {                                               
                        "ts" : Timestamp(1583107618, 1),                           
                        "t" : NumberLong(1)                                        
                },                                                                 
                "majorityWriteDate" : ISODate("2020-03-02T00:06:58Z")              
        },                                                                         
        "configsvr" : 2,                                                           
        "maxBsonObjectSize" : 16777216,                                            
        "maxMessageSizeBytes" : 48000000,                                          
        "maxWriteBatchSize" : 100000,                                              
        "localTime" : ISODate("2020-03-02T00:06:58.667Z"),                         
        "logicalSessionTimeoutMinutes" : 30,                                       
        "minWireVersion" : 0,                                                      
        "maxWireVersion" : 6,                                                      
        "readOnly" : false,                                                        
        "ok" : 1,                                                                  
        "operationTime" : Timestamp(1583107618, 1),                                
        "$gleStats" : {                                                            
                "lastOpTime" : Timestamp(0, 0),                                    
                "electionId" : ObjectId("7fffffff0000000000000001")                
        },                                                                         
        "$clusterTime" : {                                                         
                "clusterTime" : Timestamp(1583107618, 1),                          
                "signature" : {                                                    
                        "hash" : BinData(0,"v9LOXARlD8DO9cBoRUg+eJ8HsHI="),        
                        "keyId" : NumberLong("6799366115026796571")                
                }                                                                  
        }                                                                          
}                                                                                  

And connecting to the m103-repl with:

vagrant@m103:~/sharding$ mongo --host "m103-repl/192.168.103.100:27001" -u "m103-admin" -p "m103-pass" --authenticationDatabase "admin"
MongoDB Enterprise m103-repl:PRIMARY> rs.status()
{
        "set" : "m103-repl",
        "date" : ISODate("2020-03-02T00:09:36.157Z"),
        "myState" : 1,
        "term" : NumberLong(6),
        "syncingTo" : "",
        "syncSourceHost" : "",
        "syncSourceId" : -1,
        "heartbeatIntervalMillis" : NumberLong(2000),
        "optimes" : {
                "lastCommittedOpTime" : {
                        "ts" : Timestamp(1583107775, 1),
                        "t" : NumberLong(6)
                },
                "readConcernMajorityOpTime" : {
                        "ts" : Timestamp(1583107775, 1),
                        "t" : NumberLong(6)
                },
                "appliedOpTime" : {
                        "ts" : Timestamp(1583107775, 1),
                        "t" : NumberLong(6)
                },
                "durableOpTime" : {
                        "ts" : Timestamp(1583107775, 1),
                        "t" : NumberLong(6)
                }
        },
        "members" : [
                {
                        "_id" : 0,
                        "name" : "m103:27001",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 5153,
                        "optime" : {
                                "ts" : Timestamp(1583107775, 1),
                                "t" : NumberLong(6)
                        },
                        "optimeDurable" : {
                                "ts" : Timestamp(1583107775, 1),
                                "t" : NumberLong(6)
                        },
                        "optimeDate" : ISODate("2020-03-02T00:09:35Z"),
                        "optimeDurableDate" : ISODate("2020-03-02T00:09:35Z"),
                        "lastHeartbeat" : ISODate("2020-03-02T00:09:35.488Z"),
                        "lastHeartbeatRecv" : ISODate("2020-03-02T00:09:35.157Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "",
                        "syncingTo" : "192.168.103.100:27002",
                        "syncSourceHost" : "192.168.103.100:27002",
                        "syncSourceId" : 1,
                        "infoMessage" : "",
                        "configVersion" : 4
                },
                {
                        "_id" : 1,
                        "name" : "192.168.103.100:27002",
                        "health" : 1,
                        "state" : 1,
                        "stateStr" : "PRIMARY",
                        "uptime" : 5157,
                        "optime" : {
                                "ts" : Timestamp(1583107775, 1),
                                "t" : NumberLong(6)
                        },
                        "optimeDate" : ISODate("2020-03-02T00:09:35Z"),
                        "syncingTo" : "",
                        "syncSourceHost" : "",
                        "syncSourceId" : -1,
                        "infoMessage" : "",
                        "electionTime" : Timestamp(1583102633, 1),
                        "electionDate" : ISODate("2020-03-01T22:43:53Z"),
                        "configVersion" : 4,
                        "self" : true,
                        "lastHeartbeatMessage" : ""
                },
                {
                        "_id" : 2,
                        "name" : "192.168.103.100:27003",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 5148,
                        "optime" : {
                                "ts" : Timestamp(1583107775, 1),
                                "t" : NumberLong(6)
                        },
                        "optimeDurable" : {
                                "ts" : Timestamp(1583107775, 1),
                                "t" : NumberLong(6)
                        },
                        "optimeDate" : ISODate("2020-03-02T00:09:35Z"),
                        "optimeDurableDate" : ISODate("2020-03-02T00:09:35Z"),
                        "lastHeartbeat" : ISODate("2020-03-02T00:09:35.488Z"),
                        "lastHeartbeatRecv" : ISODate("2020-03-02T00:09:35.154Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "",
                        "syncingTo" : "192.168.103.100:27002",
                        "syncSourceHost" : "192.168.103.100:27002",
                        "syncSourceId" : 1,
                        "infoMessage" : "",
                        "configVersion" : 4
                }
        ],
        "ok" : 1,
        "operationTime" : Timestamp(1583107775, 1),
        "$gleStats" : {
                "lastOpTime" : Timestamp(0, 0),
                "electionId" : ObjectId("7fffffff0000000000000006")
        },
        "$configServerState" : {
                "opTime" : {
                        "ts" : Timestamp(1583107752, 1),
                        "t" : NumberLong(1)
                }
        },
        "$clusterTime" : {
                "clusterTime" : Timestamp(1583107775, 1),
                "signature" : {
                        "hash" : BinData(0,"ensNWsYf0yvwNdtAms3Q41X8gJw="),
                        "keyId" : NumberLong("6799366115026796571")
                }
        }

Good thing that your primary for the m103-repl replica set is 27002, you’ll have less work to do to resolve the issue:

  1. Remove the m103:27001 node from the m103-repl replica set
  2. Add it back but using the IP address (not the hostname)
  3. Check that all the servers are up and running by using this Linux command
    ps -ef | grep [m]ongo
  4. Now you should be able to add the m103-repl shard and I’d suggest you include all the nodes for better discoverability:
    sh.addShard("m103-repl/192.168.103.100:27001,192.168.103.100:27002,192.168.103.100:27003")

Thanks, I am getting this error now though: "errmsg" : "E11000 duplicate key error collection: admin.system.version index: _id_ dup key: { : \"shardIdentity\" }",

Can you share a screenshot of the command and the full error message.

sure,

vagrant@m103:~/sharding$ mongo --port 26000 --username m103-admin --password m103-pass --authentica tionDatabase admin
MongoDB shell version v3.6.17
connecting to: mongodb://127.0.0.1:26000/?authSource=admin&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("d203c41b-2282-4ff1-803a-18e07a7d7721") }
MongoDB server version: 3.6.17
MongoDB Enterprise mongos> sh.addShard("m103-repl/192.168.103.100:27001,192.168.103.100:27002,192.168.103.100:27003")
{
        "ok" : 0,
        "errmsg" : "E11000 duplicate key error collection: admin.system.version index: _id_ dup key: { : \"shardIdentity\" }",
        "code" : 11000,
        "codeName" : "DuplicateKey",
        "operationTime" : Timestamp(1583108773, 2),
        "$clusterTime" : {
                "clusterTime" : Timestamp(1583108773, 2),
                "signature" : {
                        "hash" : BinData(0,"aF5xQzlS9moGfR5gjjJI3ZIavW0="),
                        "keyId" : NumberLong("6799366115026796571")
                }
        }
}

This is sh.status()

MongoDB Enterprise mongos> sh.status()
--- Sharding Status ---
  sharding version: {
        "_id" : 1,
        "minCompatibleVersion" : 5,
        "currentVersion" : 6,
        "clusterId" : ObjectId("5e5c3375f5493bdc2e83028a")
  }
  shards:
  active mongoses:
        "3.6.17" : 1
  autosplit:
        Currently enabled: yes
  balancer:
        Currently enabled:  yes
        Currently running:  no
        Failed balancer rounds in last 5 attempts:  0
        Migration Results for the last 24 hours:
                No recent migrations
  databases:
        {  "_id" : "config",  "primary" : "config",  "partitioned" : true }

Let’s see the following:

  1. use config
    db.shards.find().pretty()
    db.collections.find().pretty()
    … of mongos
  2. rs.status and rs.config() of m103-repl
  3. ps -ef | grep [m]ongo

Appreciate your help here:

vagrant@m103:~/sharding$ mongo --port 26000 --username m103-admin --password m103-pass --authentica tionDatabase admin
MongoDB shell version v3.6.17
connecting to: mongodb://127.0.0.1:26000/?authSource=admin&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("b4154725-5505-463c-a268-fe9b8ddc1db0") }
MongoDB server version: 3.6.17
MongoDB Enterprise mongos> db.collections.find().pretty()
MongoDB Enterprise mongos> show dbs
admin   0.000GB
config  0.000GB
MongoDB Enterprise mongos> use config
switched to db config
MongoDB Enterprise mongos> db.shards.find().pretty()
MongoDB Enterprise mongos> show collections
chunks
lockpings
locks
migrations
mongos
shards
tags
transactions
version
MongoDB Enterprise mongos> db.collections.find().pretty()
MongoDB Enterprise mongos>

rs.status of m103-repl:


vagrant@m103:~/sharding$ mongo --host "m103-repl/192.168.103.100:27001" -u "m103-admin" -p "m103-pa ss" --authenticationDatabase "admin"
MongoDB shell version v3.6.17
connecting to: mongodb://192.168.103.100:27001/?authSource=admin&gssapiServiceName=mongodb&replicaSet=m103-repl
2020-03-02T00:47:58.850+0000 I NETWORK  [thread1] Starting new replica set monitor for m103-repl/192.168.103.100:27001
2020-03-02T00:47:58.851+0000 I NETWORK  [thread1] Successfully connected to 192.168.103.100:27001 (1 connections now open to 192.168.103.100:27001 with a 5 second timeout)
2020-03-02T00:47:58.852+0000 I NETWORK  [thread1] Successfully connected to 192.168.103.100:27002 (1 connections now open to 192.168.103.100:27002 with a 5 second timeout)
2020-03-02T00:47:58.853+0000 I NETWORK  [thread1] changing hosts to m103-repl/192.168.103.100:27001,192.168.103.100:27002,192.168.103.100:27003 from m103-repl/192.168.103.100:27001
2020-03-02T00:47:58.855+0000 I NETWORK  [ReplicaSetMonitor-TaskExecutor-0] Successfully connected to 192.168.103.100:27003 (1 connections now open to 192.168.103.100:27003 with a 5 second timeout)
Implicit session: session { "id" : UUID("1042b454-1bd6-4352-8112-2cd364ac3c31") }
MongoDB server version: 3.6.17
Server has startup warnings:
2020-03-01T22:43:39.661+0000 I STORAGE  [initandlisten]
2020-03-01T22:43:39.661+0000 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2020-03-01T22:43:39.661+0000 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
MongoDB Enterprise m103-repl:PRIMARY> rs.status()
{
        "set" : "m103-repl",
        "date" : ISODate("2020-03-02T00:48:04.270Z"),
        "myState" : 1,
        "term" : NumberLong(6),
        "syncingTo" : "",
        "syncSourceHost" : "",
        "syncSourceId" : -1,
        "heartbeatIntervalMillis" : NumberLong(2000),
        "optimes" : {
                "lastCommittedOpTime" : {
                        "ts" : Timestamp(1583110075, 1),
                        "t" : NumberLong(6)
                },
                "readConcernMajorityOpTime" : {
                        "ts" : Timestamp(1583110075, 1),
                        "t" : NumberLong(6)
                },
                "appliedOpTime" : {
                        "ts" : Timestamp(1583110075, 1),
                        "t" : NumberLong(6)
                },
                "durableOpTime" : {
                        "ts" : Timestamp(1583110075, 1),
                        "t" : NumberLong(6)
                }
        },
        "members" : [
                {
                        "_id" : 1,
                        "name" : "192.168.103.100:27002",
                        "health" : 1,
                        "state" : 1,
                        "stateStr" : "PRIMARY",
                        "uptime" : 7465,
                        "optime" : {
                                "ts" : Timestamp(1583110075, 1),
                                "t" : NumberLong(6)
                        },
                        "optimeDate" : ISODate("2020-03-02T00:47:55Z"),
                        "syncingTo" : "",
                        "syncSourceHost" : "",
                        "syncSourceId" : -1,
                        "infoMessage" : "",
                        "electionTime" : Timestamp(1583102633, 1),
                        "electionDate" : ISODate("2020-03-01T22:43:53Z"),
                        "configVersion" : 6,
                        "self" : true,
                        "lastHeartbeatMessage" : ""
                },
                {
                        "_id" : 2,
                        "name" : "192.168.103.100:27003",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 7456,
                        "optime" : {
                                "ts" : Timestamp(1583110075, 1),
                                "t" : NumberLong(6)
                        },
                        "optimeDurable" : {
                                "ts" : Timestamp(1583110075, 1),
                                "t" : NumberLong(6)
                        },
                        "optimeDate" : ISODate("2020-03-02T00:47:55Z"),
                        "optimeDurableDate" : ISODate("2020-03-02T00:47:55Z"),
                        "lastHeartbeat" : ISODate("2020-03-02T00:48:03.732Z"),
                        "lastHeartbeatRecv" : ISODate("2020-03-02T00:48:03.915Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "",
                        "syncingTo" : "192.168.103.100:27002",
                        "syncSourceHost" : "192.168.103.100:27002",
                        "syncSourceId" : 1,
                        "infoMessage" : "",
                        "configVersion" : 6
                },
                {
                        "_id" : 3,
                        "name" : "192.168.103.100:27001",
                        "health" : 1,
                        "state" : 2,
                        "stateStr" : "SECONDARY",
                        "uptime" : 1538,
                        "optime" : {
                                "ts" : Timestamp(1583110075, 1),
                                "t" : NumberLong(6)
                        },
                        "optimeDurable" : {
                                "ts" : Timestamp(1583110075, 1),
                                "t" : NumberLong(6)
                        },
                        "optimeDate" : ISODate("2020-03-02T00:47:55Z"),
                        "optimeDurableDate" : ISODate("2020-03-02T00:47:55Z"),
                        "lastHeartbeat" : ISODate("2020-03-02T00:48:03.730Z"),
                        "lastHeartbeatRecv" : ISODate("2020-03-02T00:48:04.034Z"),
                        "pingMs" : NumberLong(0),
                        "lastHeartbeatMessage" : "",
                        "syncingTo" : "192.168.103.100:27002",
                        "syncSourceHost" : "192.168.103.100:27002",
                        "syncSourceId" : 1,
                        "infoMessage" : "",
                        "configVersion" : 6
                }
        ],
        "ok" : 1,
        "operationTime" : Timestamp(1583110075, 1),
        "$gleStats" : {
                "lastOpTime" : Timestamp(0, 0),
                "electionId" : ObjectId("7fffffff0000000000000006")
        },
        "$configServerState" : {
                "opTime" : {
                        "ts" : Timestamp(1583110063, 1),
                        "t" : NumberLong(1)
                }
        },
        "$clusterTime" : {
                "clusterTime" : Timestamp(1583110075, 1),
                "signature" : {
                        "hash" : BinData(0,"CYABhIpsIj8BsJpkHgFmeWvJC3w="),
                        "keyId" : NumberLong("6799366115026796571")
                }
        }

rs.config

{
        "_id" : "m103-repl",
        "version" : 6,
        "protocolVersion" : NumberLong(1),
        "members" : [
                {
                        "_id" : 1,
                        "host" : "192.168.103.100:27002",
                        "arbiterOnly" : false,
                        "buildIndexes" : true,
                        "hidden" : false,
                        "priority" : 1,
                        "tags" : {

                        },
                        "slaveDelay" : NumberLong(0),
                        "votes" : 1
                },
                {
                        "_id" : 2,
                        "host" : "192.168.103.100:27003",
                        "arbiterOnly" : false,
                        "buildIndexes" : true,
                        "hidden" : false,
                        "priority" : 1,
                        "tags" : {

                        },
                        "slaveDelay" : NumberLong(0),
                        "votes" : 1
                },
                {
                        "_id" : 3,
                        "host" : "192.168.103.100:27001",
                        "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("5e5ad60d2f93a85c0a370d1f")
        }

vagrant@m103:~/sharding$ ps -ef | grep [m]ongo
vagrant  29043  6465  0 Mar01 pts/1    00:00:00 nano ../mongod-repl-2.conf
vagrant  30846     1  1 Mar01 ?        00:02:16 mongod -f csrs_1.conf
vagrant  30882     1  1 Mar01 ?        00:02:24 mongod -f csrs_2.conf
vagrant  30919     1  1 Mar01 ?        00:02:41 mongod -f csrs_3.conf
vagrant  31233     1  0 Mar01 ?        00:00:25 mongos -f lab_mongo.conf
vagrant  31497  6465  0 Mar01 pts/1    00:00:00 nano cd ../mongod-repl-3.conf
vagrant  31575     1  1 Mar01 ?        00:01:42 mongod --config ../mongod-repl-1.conf
vagrant  31667     1  1 Mar01 ?        00:01:37 mongod --config ../mongod-repl-2.conf
vagrant  31769     1  1 Mar01 ?        00:01:41 mongod --config ../mongod-repl-3.conf

No problem @Jonathon_93506!

Ok, so it appears that this replica set is already part of a config server already. Run the following on m103-repl:
use admin
db.system.version.find().pretty()

Yeah, I had the m103-repl set up correctly I believe, but I’d done the lecture and my shard also had the lecture shard in there too. But here is the output

MongoDB Enterprise m103-repl:PRIMARY> db.system.version.find().pretty()                             
{ "_id" : "featureCompatibilityVersion", "version" : "3.6" }                                        
{ "_id" : "authSchema", "currentVersion" : 5 }                                                      
{                                                                                                   
        "_id" : "shardIdentity",                                                                    
        "clusterId" : ObjectId("5e5bf92acf58d3c64d5ecfde"),                                         
        "shardName" : "m103-repl",                                                                  
        "configsvrConnectionString" : "m103-csrs/192.168.103.100:26001,192.168.103.100:26002,192.168
.103.100:26003"                                                                                     
}                                                                                                   

What’s happened is that when you re-configured the replica set from the other “draining a shard” thread, the settings still remained on the m103-repl replica set. So what you can do is:

  1. Shutdown all three m103-repl nodes
  2. Delete all the data files
  3. Restart all the nodes
  4. Connect to the mongos and add the shard
1 Like

Thanks so much man!

Hi, I am also running into the same issue (“errmsg” : "in seed list m103-repl/192.168.103.100:27012,), i found the solution from this discussion.
My question about - point 2.Delete all the data files
my dbPath: /var/mongodb/db/node1, node2 and node3.
I deleted all the files from node1, node2, and node3. restarted all the nodes and while adding the shard, getting the same error. Please help me.

“errmsg” : "in seed list m103-repl/192.168.103.100:27012, host 192.168.103.100:27012 does not belong to replica set m103-repl; found { hosts: [ “192.168.103.100:27011”, “m103:27012”, “m103:27013” ], setName: “m103-repl”, setVersion: 3, ismaster: true, secondary: false, primary: “192.168.103.100:27011”, me: “192.168.103.100:27011”, e

What is the title of the lab or lecture that you’re working on?

i am working on Chapter 3: Sharding --Setting Up a Sharded Cluster, lecture.

—status of Replica set
My replica set name is -m103-repl,

rs.stauts()

** “_id” : 0,**
** “name” : “192.168.103.100:27011”,**
** “health” : 1,**
** “state” : 1,**
** “stateStr” : “PRIMARY”,**

** “_id” : 1,**
** “name” : “m103:27012”,**
** “health” : 1,**
** “state” : 2,**
** “stateStr” : “SECONDARY”,**

** “_id” : 2,**
** “name” : “m103:27013”,**
** “health” : 1,**
** “state” : 2,**
** “stateStr” : “SECONDARY”,**
-------------------------

MongoDB Enterprise m103-repl:PRIMARY> rs.isMaster()

{
** “hosts” : [**
** “192.168.103.100:27011”,**
** “m103:27012”,**
** “m103:27013”**
** ],**
** “setName” : “m103-repl”,**
--------------
MongoDB Enterprise mongos> sh.status()
— Sharding Status —
** sharding version: {**
** “_id” : 1,**
** “minCompatibleVersion” : 5,**
** “currentVersion” : 6,**
** “clusterId” : ObjectId(“5e63ddfb0b745846c1adc524”)**
** }**
** shards:**
** active mongoses:**
** “3.6.17” : 1**
** autosplit:**
** Currently enabled: yes**
** balancer:**
** Currently enabled: yes**
** Currently running: no**
** Failed balancer rounds in last 5 attempts: 0**
** Migration Results for the last 24 hours:**
** No recent migrations**
** databases:**
** { “_id” : “config”, “primary” : “config”, “partitioned” : true }**

Running into issue when adding the replica set to the shard

MongoDB Enterprise mongos> sh.addShard(“m103-repl/192.168.103.100:27012”)
{
** “ok” : 0,**
** “errmsg” : "in seed list m103-repl/192.168.103.100:27012, host 192.168.103.100:27012 does not belong to replica set m103-repl; found { hosts: [ “192.168.103.100:27011”, “m103:27012”, “m103:27013” ], setName: “m103-repl”, setVersion: 3, ismaster: true, secondary: false, primary: “192.168.103.100:27011”, me: “192.168.103.100:27011”, e**

Don’t use mixed hostnames like you have above. It’s either all your nodes use 192.168.103.100 or m103.

Enter a comma separated list of all nodes in the sh.addShard() command.

Thank you so much for the quick turn around. your solution worked.

Following is the command is used.

sh.addShard(“m103-repl/192.168.103.100:27011”,“m103-repl/192.168.103.100:27012”,“m103-repl/192.168.103.100:27013”)

{
** “shardAdded” : “m103-repl”,**
** “ok” : 1,**
** “operationTime” : Timestamp(1583807957, 10),**
** “$clusterTime” : {**
** “clusterTime” : Timestamp(1583807957, 10),**
** “signature” : {**
** “hash” : BinData(0,“gBjCpH6Yte253zLyLZ3zLyW8qsY=”),**
** “keyId” : NumberLong(“6801523932366110746”)**
** }**
** }**
}
---------------------

MongoDB Enterprise mongos> sh.status()
— Sharding Status —
** sharding version: {**
** “_id” : 1,**
** “minCompatibleVersion” : 5,**
** “currentVersion” : 6,**
** “clusterId” : ObjectId(“5e63ddfb0b745846c1adc524”)**
** }**
** shards:**
** { “_id” : “m103-repl”, “host” : “m103-repl/192.168.103.100:27011,m103:27012,m103:27013”, “state” : 1 }**
** active mongoses:**
** “3.6.17” : 1**
** autosplit:**
** Currently enabled: yes**
** balancer:**
** Currently enabled: yes**
** Currently running: no**
** Failed balancer rounds in last 5 attempts: 0**
** Migration Results for the last 24 hours:**
** No recent migrations**
** databases:**
** { “_id” : “config”, “primary” : “config”, “partitioned” : true }**

---------------
once again thanks.

Good job! However, the correct format is this:
sh.addShard("m103-repl/192.168.103.100:27011,m103:27012,m103:27013")

In your incorrect format, it was able to figure it out because 27011 is the primary and the first item listed.

1 Like

Thanks for correcting.