[SERVER-6424] How can I check is 'mongos' transfer query to secondary or not Created: 12/Jul/12  Updated: 11/Jul/16  Resolved: 23/Jul/12

Status: Closed
Project: Core Server
Component/s: Replication, Sharding
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Azat Khuzhin Assignee: Michael O'Brien
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File mongos-logLevel-5.log    
Participants:

 Description   

I'v configure replicaSet for one shard.
And it seems that it not use my SECONDARY

On secondary I run 'mongostat', and it always show 0 'query'
I connect to mongo throw PHP driver ( setSlaveOkay() )

And run 3 concurrent scripts, that connect to mongos

I'v also see log from SECONDARY at number of connections is not grows



 Comments   
Comment by Azat Khuzhin [ 19/Jul/12 ]

Thanks. For helping. Seems that all fine.

Comment by Randolph Tan [ 19/Jul/12 ]

The workaround is to:

1. Shutdown all mongos.
2. For every config servers, do this:
2.1 Connect via mongo shell
2.2 Do this:

use config
db.shards.update({ _id: "shard0000" }, { $set: { host: "replSetString" }})
// replace "replSetString" with the right replica set connection string where node1.mongo.backend:27018 belongs
db.shards.update({ _id: "shard0001" }, { $set: { host: "replSetString2" }})
// replace "replSetString2" with the right replica set connection string where node6.mongo.backend:27018 belonged

3. Start mongos.
4. Use mongos shell to connect to mongos and do printShardStatus() to confirm that the change was properly reflected

Comment by Azat Khuzhin [ 19/Jul/12 ]

But, how can I change now my configuration?
Is current config db can be reused for new configuration that I must create?

Comment by Randolph Tan [ 19/Jul/12 ]

It looks like the shards were added as stand alone shards and not as a replica set. The correct way of adding a replica set to a shard is to use the replica set connection string when calling the addShard command. You can check out the more detailed explanation here:

http://www.mongodb.org/display/DOCS/Configuring+Sharding#ConfiguringSharding-Addingshards

Comment by Azat Khuzhin [ 19/Jul/12 ]

MongoDB shell version: 2.1.3-pre-
connecting to: test
--- Sharding Status --- 
  sharding version: { "_id" : 1, "version" : 3 }
  shards:
	{  "_id" : "shard0000",  "host" : "node1.mongo.backend:27018" }
	{  "_id" : "shard0001",  "host" : "node6.mongo.backend:27018" }
  databases:
	{  "_id" : "admin",  "partitioned" : false,  "primary" : "config" }
	{  "_id" : "data_db",  "partitioned" : true,  "primary" : "shard0000" }
		data_db.top_daily chunks:
			
 

Comment by Randolph Tan [ 19/Jul/12 ]

Can you post the result of running this in the mongo shell connected to mongos?

printShardingStatus();

Comment by Azat Khuzhin [ 19/Jul/12 ]

I think that, it because of "SERVER-4464"

Comment by Azat Khuzhin [ 19/Jul/12 ]

I also tried to restart "mongos", and all shards (mongod processes) - didn't help

Comment by Azat Khuzhin [ 19/Jul/12 ]

Some more information: I don't use "keyFile"
Also I attach mongos log, with

{logLevel:5}
Comment by Azat Khuzhin [ 19/Jul/12 ]

seems like it the same as #SERVER-5405

Comment by Azat Khuzhin [ 19/Jul/12 ]

Can anybody explain why "mongos" not use my secondaries for querying ?

Comment by Azat Khuzhin [ 16/Jul/12 ]

"mongostat --discover" shows it
but "mongos" doesn't send to SECONDARY queries

                                        insert  query update delete getmore command flushes mapped  vsize    res faults             locked db idx miss %     qr|qw   ar|aw  netIn netOut  conn                    set repl       time 
                       localhost            65     67     67      0       0       1                 11.6g  11.2g      0                                                       30k    67k    62                         RTR   04:16:02 
node1.backend:27018           114    114    115      0     223       2       0   240g   481g  7.99g      9  project_db:8.1%          0       0|0     0|0    62k   155k    71 backend-ad-data  PRI   04:16:02 
node4.backend:27018           *64     *0    *66     *0       0     2|0       0   238g   478g  41.8g      1  project_db:1.3%          0       0|0     0|0   234b     2k     5 backend-ad-data  SEC   04:16:02 
node5.backend:27018            *0     *0     *0     *0       0     2|0       1   136g   273g  6.46g      0  project_db:0.0%          0       0|0     0|0   239b     2k     4 backend-reports-stat  SEC   04:16:02 
node6.backend:27018             0      0      0      0       1       2       0   136g   273g  17.5g      0            local:0.0%          0       0|0     0|0   286b     2k    70 backend-reports-stat  PRI   04:16:02 
 
                       localhost            64     64     64      0       0       1                 11.6g  11.2g      0                                                       29k    59k    62                         RTR   04:16:03 
node1.backend:27018            65     67     68      0     124       3       0   240g   481g  7.99g      1 project_db:12.1%          0       0|0     0|0    36k    99k    71 backend-ad-data  PRI   04:16:03 
node4.backend:27018           *65     *0    *65     *0       0     2|0       0   238g   478g  41.8g      1  project_db:1.2%          0       0|0     0|0   234b     2k     5 backend-ad-data  SEC   04:16:03 
node5.backend:27018            *0     *0     *0     *0       0     2|0       0   136g   273g  6.46g      0  project_db:0.0%          0       0|0     0|0   239b     2k     4 backend-reports-stat  SEC   04:16:03 
node6.backend:27018             0      0      0      0       0       3       0   136g   273g  17.5g      0            local:0.0%          0       0|0     1|0   297b     2k    70 backend-reports-stat  PRI   04:16:03 
 
                       localhost            60     62     64      0       0       1                 11.6g  11.2g      0                                                       28k    60k    62                         RTR   04:16:04 
node1.backend:27018            64     64     65      0     136       2       0   240g   481g  7.99g      1  project_db:2.9%          0       0|0     0|0    35k    91k    71 backend-ad-data  PRI   04:16:04 
node4.backend:27018           *60     *0    *64     *0       0     2|0       1   238g   478g  41.8g      0           local:43.3%          0       0|0     0|0   234b     2k     5 backend-ad-data  SEC   04:16:04 
node5.backend:27018            *0     *0     *0     *0       0     2|0       0   136g   273g  6.46g      0  project_db:0.0%          0       0|0     0|0   239b     2k     4 backend-reports-stat  SEC   04:16:04 
node6.backend:27018             0      0      0      0       0       2       0   136g   273g  17.5g      0            local:0.0%          0       0|0     0|0   239b     2k    70 backend-reports-stat  PRI   04:16:04 
 
                       localhost            66     67     66      0       0       1                 11.6g  11.2g      0                                                       30k    60k    62                         RTR   04:16:05 
node1.backend:27018            66     68     67      0     140       2       0   240g   481g  7.99g      3  project_db:3.9%          0       0|0     0|0    37k    93k    71 backend-ad-data  PRI   04:16:05 
node4.backend:27018           *66     *0    *66     *0       0     2|0       0   238g   478g  41.8g      0  project_db:1.3%          0       0|0     0|0   234b     2k     5 backend-ad-data  SEC   04:16:05 
node5.backend:27018            *0     *0     *0     *0       0     2|0       0   136g   273g  6.46g      0  project_db:0.0%          0       0|0     0|0   239b     2k     4 backend-reports-stat  SEC   04:16:05 
node6.backend:27018             0      0      0      0       1       2       0   136g   273g  17.5g      0            local:0.0%          0       0|0     0|0   286b     2k    70 backend-reports-stat  PRI   04:16:05 
 
                       localhost            92     93     92      0       0       1                 11.6g  11.2g      0                                                       41k    83k    62                         RTR   04:16:06 
node1.backend:27018            92     91     93      0     186       2       0   240g   481g  7.99g      2  project_db:4.8%          0       0|0     0|0    50k   126k    71 backend-ad-data  PRI   04:16:06 
node4.backend:27018           *92     *0    *92     *0       0     2|0       0   238g   478g  41.8g      0  project_db:1.6%          0       0|0     0|0   234b     2k     5 backend-ad-data  SEC   04:16:06 
node5.backend:27018            *0     *0     *0     *0       0     2|0       0   136g   273g  6.46g      0  project_db:0.0%          0       0|0     0|0   239b     2k     4 backend-reports-stat  SEC   04:16:06 
node6.backend:27018             0      0      0      0       0       2       0   136g   273g  17.5g      0            local:0.0%          0       0|0     0|0   239b     2k    70 backend-reports-stat  PRI   04:16:06 
 
                                        insert  query update delete getmore command flushes mapped  vsize    res faults             locked db idx miss %     qr|qw   ar|aw  netIn netOut  conn                    set repl       time 
                       localhost            67     67     67      0       0       1                 11.6g  11.2g      0                                                       30k    66k    62                         RTR   04:16:07 
node1.backend:27018            67     68     68      0     132       2       0   240g   481g  7.99g      2  project_db:3.6%          0       0|0     0|0    36k    98k    71 backend-ad-data  PRI   04:16:07 
node4.backend:27018           *67     *0    *67     *0       0     2|0       0   238g   478g  41.8g      0  project_db:1.2%          0       0|0     0|0   234b     2k     5 backend-ad-data  SEC   04:16:07 
node5.backend:27018            *0     *0     *0     *0       0     2|0       0   136g   273g  6.46g      0  project_db:0.0%          0       0|0     0|0   239b     2k     4 backend-reports-stat  SEC   04:16:07 
node6.backend:27018             0      0      0      0       0       2       0   136g   273g  17.5g      0            local:0.0%          0       0|0     0|0   239b     2k    70 backend-reports-stat  PRI   04:16:07 
 
                       localhost            59     59     59      0       0       1                 11.6g  11.2g      0                                                       26k    54k    62                         RTR   04:16:08 
node1.backend:27018            59     58     60      0     129       2       0   240g   481g  7.99g      4  project_db:3.6%          0       0|0     0|0    33k    83k    71 backend-ad-data  PRI   04:16:08 
node4.backend:27018           *59     *0    *59     *0       0     2|0       0   238g   478g  41.8g      0  project_db:1.2%          0       0|0     0|0   234b     2k     5 backend-ad-data  SEC   04:16:08 
node5.backend:27018            *0     *0     *0     *0       0     2|0       0   136g   273g  6.46g      0  project_db:0.0%          0       0|0     0|0   239b     2k     4 backend-reports-stat  SEC   04:16:08 
node6.backend:27018             0      0      0      0       1       2       0   136g   273g  17.5g      0            local:0.0%          0       0|0     0|0   286b     2k    70 backend-reports-stat  PRI   04:16:08 
 
                       localhost            86     86     86      0       0       1                 11.6g  11.2g      0                                                       39k    82k    62                         RTR   04:16:09 
node1.backend:27018            86     86     87      0     176       3       0   240g   481g  7.99g      3  project_db:7.7%          0       0|0     0|0    47k   123k    71 backend-ad-data  PRI   04:16:09 
node4.backend:27018           *86     *0    *86     *0       0     2|0       0   238g   478g  41.8g      0  project_db:1.6%          0       0|0     0|0   234b     2k     5 backend-ad-data  SEC   04:16:09 
node5.backend:27018            *0     *0     *0     *0       0     2|0       0   136g   273g  6.46g      0  project_db:0.0%          0       0|0     0|0   239b     2k     4 backend-reports-stat  SEC   04:16:09 
node6.backend:27018             0      0      0      0       0       3       0   136g   273g  17.5g      0            local:0.0%          0       0|0     0|0   297b     2k    70 backend-reports-stat  PRI   04:16:09 
 
                       localhost            85     85     85      0       0       1                 11.6g  11.2g      0                                                       39k    79k    62                         RTR   04:16:10 
node1.backend:27018            85     85     86      0     189       2       0   240g   481g  7.99g      1  project_db:3.4%          0       0|0     0|0    48k   121k    71 backend-ad-data  PRI   04:16:10 
node4.backend:27018           *86     *0    *84     *0       0     2|0       0   238g   478g  41.8g      1  project_db:1.8%          0       0|0     0|0   234b     2k     5 backend-ad-data  SEC   04:16:10 
node5.backend:27018            *0     *0     *0     *0       0     5|0       0   136g   273g  6.46g      0            local:0.0%          0       0|0     0|0   422b     5k     5 backend-reports-stat  SEC   04:16:10 
node6.backend:27018             0      0      0      0       1       2       0   136g   273g  17.5g      0            local:0.0%          0       0|0     0|0   286b     2k    70 backend-reports-stat  PRI   04:16:10 
 
                       localhost            76     76     76      0       0       1                 11.6g  11.2g      0                                                       34k    69k    62                         RTR   04:16:11 
node1.backend:27018            77     77     78      0     152       2       0   240g   481g  7.99g      3  project_db:6.1%          0       0|0     0|0    42k   108k    71 backend-ad-data  PRI   04:16:11 
node4.backend:27018           *77     *0    *75     *0       0     2|0       0   238g   478g  41.8g      0  project_db:1.4%          0       0|0     0|0   234b     2k     5 backend-ad-data  SEC   04:16:11 
node5.backend:27018            *0     *0     *0     *0       0     5|0       0   136g   273g  6.46g      0  project_db:0.0%          0       0|0     0|0   429b     3k     4 backend-reports-stat  SEC   04:16:11 
node6.backend:27018             0      0      0      0       0       2       0   136g   273g  17.5g      0            local:0.0%          0       0|0     0|0   239b     2k    70 backend-reports-stat  PRI   04:16:11 
 
                                        insert  query update delete getmore command flushes mapped  vsize    res faults             locked db idx miss %     qr|qw   ar|aw  netIn netOut  conn                    set repl       time 
                       localhost            67     67     67      0       0       1                 11.6g  11.2g      0                                                       30k    61k    62                         RTR   04:16:12 
node1.backend:27018            66     66     67      0     130       2       0   240g   481g  7.99g      1  project_db:2.9%          0       0|0     0|0    36k    93k    71 backend-ad-data  PRI   04:16:12 
node4.backend:27018           *68     *0    *66     *0       0     2|0       0   238g   478g  41.8g      0  project_db:1.3%          0       0|0     0|0   234b     2k     5 backend-ad-data  SEC   04:16:12 
node5.backend:27018            *0     *0     *0     *0       0     2|0       0   136g   273g  6.46g      0  project_db:0.0%          0       0|0     0|0   239b     2k     4 backend-reports-stat  SEC   04:16:12 
node6.backend:27018             0      0      0      0       1       2       0   136g   273g  17.5g      0            local:0.0%          0       0|0     0|0   286b     2k    70 backend-reports-stat  PRI   04:16:12 
 

Comment by Azat Khuzhin [ 12/Jul/12 ]

Thanks. It show my SECONDARY there.
I'l try to send queries to it, throw mongos later.

Comment by Azat Khuzhin [ 12/Jul/12 ]

latest (build from sources)

Comment by Scott Hernandez (Inactive) [ 12/Jul/12 ]

You can run mongostat --discover mongos.host.name and it will show stats for all members so you can see if there are any queries on your secondaries.

What version of MongoDB are you using?

Generated at Thu Feb 08 03:11:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.