Chapter 3 Deploy a Sharded Cluster error adding sharing

when i changed mongos.conf and I got that:


Immediately,i connect to the server.When I try to add sharing cluster i got that:

sh.addShard("shard1/localhost:27001")
{
        "ok" : 0,
        "errmsg" : "no such command: 'addShard'",
        "code" : 59,
        "codeName" : "CommandNotFound"
}

Most likely you are connected to mongod rather than mongos.

Share mongos.conf and how you connected.

I edited mongos.conf with this configuration

sharding:
  configDB: shard1/localhost:27004,localhost:27005,localhost:27006
security:
  keyFile: /var/mongodb/pki/m103-keyfile
net:
  bindIp: localhost
  port: 26000
systemLog:
  destination: file
  path: /var/mongodb/logs/mongos.log
  logAppend: true
processManagement:
  fork: true

I connected to mongo with the port 27004 to try to add sharing.
5ad424820f099bbaca8873bf1475142ce3267f9a975e45f4616de72a53b5beb3_1

You have to connect with port 26000.Thst is where mongos would be running

2 Likes