[SERVER-44648] Sharded Cluster not working when one of the shard goes down Created: 15/Nov/19 Updated: 19/Nov/19 Resolved: 19/Nov/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 4.0.13 |
| Fix Version/s: | None |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | Vivek Vishwakarma | Assignee: | Carl Champain (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
I setup a testing environment to test the availability of sharded Mongo cluster. Below is my setup: 1. All the Mongo components are running on my local machine in windows After the above setup is done, a db and a collection of the db are enabled with sharding. Shared collection is then populated with some data. By checking shard status, it is confirmed that both shards carry data in the sharded collection. Then the following steps are taken for the sharded cluster availability test. 4. Shut down primary node of Shard A. Query for selecting and inserting was happening in mongos server but query is giving error
These all my setup command which is used shard1
shard2
shard3
config server
mongo --port 57040
mongos server
mongo
as per Mongo documentation, it is not the expected behavior. Can you point out if there is anything wrong in my setup/steps above? |
| Comments |
| Comment by Carl Champain (Inactive) [ 19/Nov/19 ] |
|
I successfully tested your example and the described behavior is expected. When you run a find query, mongos sends it to each shard in your cluster which can take read operations (depending on your read preference settings). if one of the replica set shards is down, then mongos can't communicate with any of the members in this replica set. So it will return an error and abort the operation, even though there are other replica set shards available in the cluster. That said, the SERVER project is for bugs and feature suggestions for the MongoDB server. As this ticket does not appear to be a bug, I will now close it. If you need further assistance troubleshooting, I encourage you to ask our community by posting on the mongodb-user group or on Stack Overflow with the mongodb tag. Kind regards, |
| Comment by Vivek Vishwakarma [ 15/Nov/19 ] |
|
after stopped all the nodes from shard A i am trying to do query on mongos like show dbs or use commands so i am getting that error in that case i have not stop and restart the MongoS |
| Comment by Kaloian Manassiev [ 15/Nov/19 ] |
|
So, just to be clear - after you have stopped all the nodes from shardA, you stop and restart MongoS? Or are you running some query, which needs to access/write data that falls on ShardA? Can you please write the exact steps that you are doing and the exact queries/inserts that you are running? |
| Comment by Vivek Vishwakarma [ 15/Nov/19 ] |
|
Kaloian Manassiev what i am trying to do i have 3 shard with 3 replication one primary and 2 secondary all is running and my shard collections data is distributed within the 3 shard but i have closed mongod server for shard one with replication primary and 2 secondary and after that when i am trying to connect mongos server that time mongos server is not connectiong and it is giving me this error { } |
| Comment by Vivek Vishwakarma [ 15/Nov/19 ] |
|
@Ryan Chipman. Yes the questions about the MongoDB itself but i am not getting solutions where i am wrong to created the sharded cluster if one shard goes down so why whole sharded cluster goes down can you correct me it is important. |
| Comment by Kaloian Manassiev [ 15/Nov/19 ] |
|
vvishwakarma123@gmail.com, what do you mean by "query for selecting and inserting"? If you are issuing a find operation, and that operation needs to return data, which is located on the shard whose nodes you brought down, then the returned error is appropriate. Can you please elaborate a little bit on the placement of data that you have in that cluster and on what exactly find and insert operations are you running? -Kal. |
| Comment by Ryan Chipman [ 15/Nov/19 ] |
|
Moving to the SERVER project, since this is a question about MongoDB itself, not the Tools |