-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
It seems like the {:is master=>1} result doesn't cached correctly in my configuration. May I ask why?
Console log
MOPED: 175.41.145.x:35517 COMMAND database=admin command={:ismaster=>1} (153.1031ms) MOPED: 54.251.34.x:35517 COMMAND database=admin command={:ismaster=>1} (242.2690ms) MOPED: 1.53.224.x:35517 COMMAND database=admin command={:ismaster=>1} (6.0682ms) MOPED: 1.53.224.x:35517 QUERY database=xxx collection=users selector={"$query"=>{"status"=>{"$ne"=>"DELETED"}, "fb_id"=>"1588324421"}, "$orderby"=>{:_id=>1}} flags=[:slave_ok] limit=-1 skip=0 fields=nil (3.7329ms) MOPED: 54.251.34.x:35517 QUERY database=xxx collection=stores selector={"$query"=>{"status"=>{"$ne"=>"DELETED"}, "fb_id"=>"317324138357272"}, "$orderby"=>{:_id=>1}} flags=[:slave_ok] limit=-1 skip=0 fields=nil (125.6838ms) MOPED: 1.53.224.x:35517 QUERY database=xxx collection=categories selector={"$query"=>{"status"=>{"$ne"=>"DELETED"}, "store_id"=>"509e8072e4b0e451a1a86b4c"}, "$orderby"=>{"position"=>-1}} flags=[:slave_ok] limit=0 skip=0 fields=nil (4.5540ms)
Mongoid.yml (I tried both :safe true/false and with/without :refresh_interval
development: # Configure available database sessions. (required) sessions: # Defines the default session. (required) default: # Defines the name of the default database that Mongoid can connect to. # (required). # refresh_interval: 100000 database: xxx username: xxx password: xxx # Provides the hosts the default session can connect to. Must be an array # of host:port pairs. (required) hosts: - s1.xxx.vn:35517 - s2.xxx.vn:35517 - s3.xxx.vn:35517 options: # Change whether the session persists in safe mode by default. # (default: false) safe: false # Change the default consistency model to :eventual or :strong. # :eventual will send reads to secondaries, :strong sends everything # to master. (default: :eventual) consistency: :eventual options: allow_dynamic_fields: false identity_map_enabled: true raise_not_found_error: false scope_overwrite_exception: true
Gemfile.lock
mongoid (3.0.13) activemodel (~> 3.1) moped (~> 1.1) origin (~> 1.0) tzinfo (~> 0.3.22)
While working with repset, I don't know how moped chooses which secondary to query against? It doesn't look like ping-based or round-robin to me, quite arbitrary actually.