-
-
Save edgarcosta/9360ae676cfc929752c377ed4927e204 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Python 2.7.11 (default, Dec 26 2015, 17:47:15) | |
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from pymongo import * | |
>>> from time import sleep | |
>>> print version | |
3.2.2 | |
>>> C = MongoClient("m0.lmfdb.xyz", replicaSet = "lmfdb0", read_preference = read_preferences.Secondary()) | |
>>> sleep(1) | |
>>> print C.address | |
(u'warwick.lmfdb.xyz', 37010) | |
>>> print C.primary | |
(u'warwick.lmfdb.xyz', 37010) | |
>>> print C.is_primary | |
True | |
>>> print C.read_preference | |
Secondary(tag_sets=None) | |
>>> print C.secondaries | |
set([(u'm1.lmfdb.xyz', 27017), ('m0.lmfdb.xyz', 27017)]) | |
>>> print C.is_mongos | |
False | |
>>> print C.nodes | |
frozenset([(u'm1.lmfdb.xyz', 27017), (u'warwick.lmfdb.xyz', 37010), ('m0.lmfdb.xyz', 27017)]) | |
>>> print C.server_selection_timeout | |
30 | |
>>> sleep(30) | |
>>> print C.address | |
(u'warwick.lmfdb.xyz', 37010) | |
>>> print C.primary | |
(u'warwick.lmfdb.xyz', 37010) | |
>>> print C.is_primary | |
True | |
>>> print C.read_preference | |
Secondary(tag_sets=None) | |
>>> print C.secondaries | |
set([(u'm1.lmfdb.xyz', 27017), ('m0.lmfdb.xyz', 27017)]) | |
>>> print C.is_mongos | |
False | |
>>> print C.nodes | |
frozenset([(u'm1.lmfdb.xyz', 27017), (u'warwick.lmfdb.xyz', 37010), ('m0.lmfdb.xyz', 27017)]) | |
>>> print C.server_selection_timeout | |
30 | |
>>> C = MongoClient("m0.lmfdb.xyz", replicaSet = "lmfdb0", read_preference = read_preferences.Secondary(tag_sets=[{'dc':'us-central'}])) | |
>>> sleep(1) | |
>>> print C.address | |
(u'warwick.lmfdb.xyz', 37010) | |
>>> print C.primary | |
(u'warwick.lmfdb.xyz', 37010) | |
>>> print C.is_primary | |
True | |
>>> print C.read_preference | |
Secondary(tag_sets=[{'dc': 'us-central'}]) | |
>>> print C.secondaries | |
set([(u'm1.lmfdb.xyz', 27017), ('m0.lmfdb.xyz', 27017)]) | |
>>> print C.is_mongos | |
False | |
>>> print C.nodes | |
frozenset([(u'm1.lmfdb.xyz', 27017), (u'warwick.lmfdb.xyz', 37010), ('m0.lmfdb.xyz', 27017)]) | |
>>> print C.server_selection_timeout | |
30 | |
>>> sleep(30) | |
>>> print C.address | |
(u'warwick.lmfdb.xyz', 37010) | |
>>> print C.primary | |
(u'warwick.lmfdb.xyz', 37010) | |
>>> print C.is_primary | |
True | |
>>> print C.read_preference | |
Secondary(tag_sets=[{'dc': 'us-central'}]) | |
>>> print C.secondaries | |
set([(u'm1.lmfdb.xyz', 27017), ('m0.lmfdb.xyz', 27017)]) | |
>>> print C.is_mongos | |
False | |
>>> print C.nodes | |
frozenset([(u'm1.lmfdb.xyz', 27017), (u'warwick.lmfdb.xyz', 37010), ('m0.lmfdb.xyz', 27017)]) | |
>>> print C.server_selection_timeout | |
30 | |
>>> C = MongoReplicaSetClient("m0.lmfdb.xyz", replicaSet = "lmfdb0", read_preference = read_preferences.Secondary(tag_sets=[{'dc':'us-central'}])) | |
>>> sleep(1) | |
>>> print C.address | |
(u'warwick.lmfdb.xyz', 37010) | |
>>> print C.primary | |
(u'warwick.lmfdb.xyz', 37010) | |
>>> print C.is_primary | |
True | |
>>> print C.read_preference | |
Secondary(tag_sets=[{'dc': 'us-central'}]) | |
>>> print C.secondaries | |
set([(u'm1.lmfdb.xyz', 27017), ('m0.lmfdb.xyz', 27017)]) | |
>>> print C.is_mongos | |
False | |
>>> print C.nodes | |
frozenset([(u'm1.lmfdb.xyz', 27017), (u'warwick.lmfdb.xyz', 37010), ('m0.lmfdb.xyz', 27017)]) | |
>>> print C.server_selection_timeout | |
30 | |
>>> sleep(30) | |
>>> print C.address | |
(u'warwick.lmfdb.xyz', 37010) | |
>>> print C.primary | |
(u'warwick.lmfdb.xyz', 37010) | |
>>> print C.is_primary | |
True | |
>>> print C.read_preference | |
Secondary(tag_sets=[{'dc': 'us-central'}]) | |
>>> print C.secondaries | |
set([(u'm1.lmfdb.xyz', 27017), ('m0.lmfdb.xyz', 27017)]) | |
>>> print C.is_mongos | |
False | |
>>> print C.nodes | |
frozenset([(u'm1.lmfdb.xyz', 27017), (u'warwick.lmfdb.xyz', 37010), ('m0.lmfdb.xyz', 27017)]) | |
>>> print C.server_selection_timeout | |
30 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment