Description:
sharding not enabled for db error while sharding on the collection .
Steps to Reproduce:
sh.enableSharding(“shardemo1”)
db.createCollection(“movies”)
var shardKey = { “title”: “hashed” }
db.movies.createIndex(shardKey)
sh.shardCollection( “shardemo1.movies”, shardKey)
mongos> sh.shardCollection( “shardemo1.movies”, shardKey)
{
“ok” : 0,
“errmsg” : “sharding not enabled for db shardemo1”,
“code” : 20,
“codeName” : “IllegalOperation”,
“$clusterTime” : {
“clusterTime” : Timestamp(1701864038, 9),
“signature” : {
“hash” : BinData(0,“AAAAAAAAAAAAAAAAAAAAAAAAAAA=”),
“keyId” : NumberLong(0)
}
},
“operationTime” : Timestamp(1701864038, 5)
Version:
db-version-6.0.9-7
operator version - crVersion: 1.15.0
Logs:
{“t”:{“$date”:“2023-12-06T12:00:44.398+00:00”},“s”:“D1”, “c”:“SHARDING”, “id”:22772, “ctx”:“conn296204”,“msg”:“Exception thrown while processing command”,“attr”:{“db”:“admin”,“head
erId”:3,“error”:“ClientDisconnect: operation was interrupted”}}
{“t”:{“$date”:“2023-12-06T12:00:44.398+00:00”},“s”:“I”, “c”:“COMMAND”, “id”:51803, “ctx”:“conn296204”,“msg”:“Slow query”,“attr”:{“type”:“command”,“ns”:“admin.$cmd”,“command”:{“he
llo”:1,“helloOk”:true,“topologyVersion”:{“processId”:{“$oid”:“656f256910f846fbd896cc2c”},“counter”:0},“maxAwaitTimeMS”:10000,“$db”:“admin”},“numYields”:0,“ok”:0,“errMsg”:“operation w
as interrupted”,“errName”:“ClientDisconnect”,“errCode”:279,“reslen”:242,“remote”:“127.0.0.1:50974”,“protocol”:“op_msg”,“durationMillis”:0}}
{“t”:{“$date”:“2023-12-06T12:00:44.398+00:00”},“s”:“D2”, “c”:“QUERY”, “id”:22783, “ctx”:“conn296204”,“msg”:“Received interrupt request for unknown op”,“attr”:{“opId”:833802,“kno
wnOps”:}}
{“t”:{“$date”:“2023-12-06T12:00:44.398+00:00”},“s”:“D1”, “c”:“ASSERT”, “id”:23074, “ctx”:“conn296204”,“msg”:“User assertion”,“attr”:{“error”:“HostUnreachable: Connection closed b
y peer”,“file”:“src/mongo/transport/service_state_machine.cpp”,“line”:299}}
{“t”:{“$date”:“2023-12-06T12:00:44.398+00:00”},“s”:“D1”, “c”:“ASSERT”, “id”:23074, “ctx”:“conn296204”,“msg”:“User assertion”,“attr”:{“error”:“HostUnreachable: Connection closed b
y peer”,“file”:“src/mongo/transport/service_state_machine.cpp”,“line”:444}}
{“t”:{“$date”:“2023-12-06T12:00:44.398+00:00”},“s”:“I”, “c”:“NETWORK”, “id”:22944, “ctx”:“conn296204”,“msg”:“Connection ended”,“attr”:{“remote”:“127.0.0.1:50974”,“uuid”:“a8bdc188
-28fa-4c74-8a5f-fd256c947af5”,“connectionId”:296204,“connectionCount”:3}}
{“t”:{“$date”:“2023-12-06T12:00:44.982+00:00”},“s”:“D1”, “c”:“-”, “id”:4333221, “ctx”:“ReplicaSetMonitor-TaskExecutor”,“msg”:“RSM received successful hello”,“attr”:{“host”:“my
-cluster-name-rs0-1.my-cluster-name-rs0.psmdb-operator.svc.cluster.local:27017”,“replicaSet”:“rs0”,“helloReply”:{“topologyVersion”:{“processId”:{“$oid”:“656f254402f345c3da28a89f”},“c
ounter”:6},“hosts”:[“my-cluster-name-rs0-0.my-cluster-name-rs0.psmdb-operator.svc.cluster.local:27017”,“my-cluster-name-rs0-1.my-cluster-name-rs0.psmdb-operator.svc.cluster.local:270
17”,“my-cluster-name-rs0-2.my-cluster-name-rs0.psmdb-operator.svc.cluster.local:27017”],“setName”:“rs0”,“setVersion”:8,“isWritablePrimary”:true,“secondary”:false,“primary”:“my-cluste
r-name-rs0-1.my-cluster-name-rs0.psmdb-operator.svc.cluster.local:27017”,“tags”:{“podName”:“my-cluster-name-rs0-1”,“serviceName”:“my-cluster-name”},“me”:“my-cluster-name-rs0-1.my-clu
ster-name-rs0.psmdb-operator.svc.cluster.local:27017”,“electionId”:{“$oid”:“7fffffff0000000000000034”},“lastWrite”:{“opTime”:{“ts”:{“$timestamp”:{“t”:1701864038,“i”:7}},“t”:52},“last
WriteDate”:{“$date”:“2023-12-06T12:00:38.000Z”},“majorityOpTime”:{“ts”:{“$timestamp”:{“t”:1701864038,“i”:7}},“t”:52},“majorityWriteDate”:{“$date”:“2023-12-06T12:00:38.000Z”}},“isImpl
icitDefaultMajorityWC”:true,“maxBsonObjectSize”:16777216,“maxMessageSizeBytes”:48000000,“maxWriteBatchSize”:100000,“localTime”:{“$date”:“2023-12-06T12:00:44.981Z”},“logicalSessionTim
eoutMinutes”:30,“connectionId”:127,“minWireVersion”:17,“maxWireVersion”:17,“readOnly”:false,“compression”:[“snappy”,“zstd”,“zlib”],“ok”:1,“lastCommittedOpTime”:{“$timestamp”:{“t”:170
1864038,“i”:7}},“$clusterTime”:{“clusterTime”:{“$timestamp”:{“t”:1701864043,“i”:1}},“signature”:{“hash”:{“$binary”:{“base64”:“AAAAAAAAAAAAAAAAAAAAAAAAAAA=”,“subType”:“0”}},“keyId”:0}
},“$configTime”:{“$timestamp”:{“t”:1701864043,“i”:1}},“$topologyTime”:{“$timestamp”:{“t”:1701090629,“i”:6}},“operationTime”:{“$timestamp”:{“t”:1701864038,“i”:7}}}}}
{“t”:{“$date”:“2023-12-06T12:00:45.308+00:00”},“s”:“I”, “c”:“NETWORK”, “id”:22943, “ctx”:“listener”,“msg”:“Connection accepted”,“attr”:{“remote”:“127.0.0.1:51012”,“uuid”:“bae4b4f
1-88d6-40f7-abd6-8ac7051e9c41”,“connectionId”:296207,“connectionCount”:4}}
Additional Information:
Attached the yaml file