MongoDB knowledge point notes
MongoDB knowledge point notes
1. How to read data from the backup Node
The default value is not allowed. The following error is reported:
testReplSet:SECONDARY> show dbs2016-07-19T10:25:03.196+0800 E QUERY [thread1] Error: listDatabases failed:{ "ok" : 0, "errmsg" : "not master and slaveOk=false", "code" : 13435 }
To allow the backup node to read data, run the following command:
db.getMongo().setSlaveOk()
2. About backup Sets
1> all operations performed by the client on a single server can be sent to the master node for execution (read, write, Execute Command, create index, etc)
2> the client cannot perform write operations on the backup node.
3> by default, the client cannot read data from the backup node unless the setSlaveOk operation is performed explicitly.
4> a single server cannot be converted to a replica set. Unless the off service is reinitialized, we recommend that you configure the replica set even if there is only one server, in this way, you do not need to stop the service after adding nodes.
5> a very important concept of replica set is "majority": it is up to the majority to select the master node. The master node can continue to serve as the master node only when the majority of support is obtained, this write operation is performed when the write operation is copied to most members.
It is safe.
3. How to view the command line parameters of the server
Db. server‑lineopts ()
4. too logs chunks to print, use verbose if you want to force print
You can run the following command to view
PrintShardingStatus (db. getSisterDB ("config"), 1 );
For more MongoDB tutorials, see the following:
CentOS compilation and installation of php extensions for MongoDB and mongoDB
CentOS 6 install MongoDB and server configuration using yum
Install MongoDB2.4.3 in Ubuntu 13.04
MongoDB beginners must read (both concepts and practices)
MongoDB Installation Guide for Ubunu 14.04
MongoDB authoritative Guide (The Definitive Guide) in English [PDF]
Nagios monitoring MongoDB sharded cluster service practice
Build MongoDB Service Based on CentOS 6.5 Operating System
MongoDB details: click here
MongoDB: click here
This article permanently updates the link address: