1. How to read data from a backup node
Default is not allowed, the following error will be reported:
Testreplset:secondary> Show dbs- -19t10:03.196+0800 E QUERY "OK"0"errmsg" " Not master and Slaveok=false""code"13435
If you want to allow the backup node to read data, you need to execute the following command
Db.getmongo (). Setslaveok ()
2. About Backup Sets
1> the actions that the client performs on a stand-alone server can be sent to the master node for execution (read, write, execute commands, create indexes, etc.)
2> clients cannot perform write operations on backup nodes
3> By default, clients cannot read data from backup nodes unless the Setslaveok operation is explicitly performed.
4> cannot convert a stand-alone server to a replica set, unless the service is reinitialized, it is recommended that, even if there is only one server, it is configured as a replica set, so that subsequent additions to the node do not require a service outage.
A very important concept in the 5> replica set is "most": Selecting the primary node is the majority decision, and the master node can continue to be the primary node only if most of the support is available, and the write operation is copied to most members
is safe.
3. How to view command line parameters for a server
Db.servercmdlineopts ()
4. Too many chunks to print, use verbose if you want to force print
You can view it by executing the following command
Printshardingstatus (Db.getsisterdb ("config"), 1);
MongoDB Broken Read