SECONDARY> show collections; 说明从节点不能进行读写Thu Aug 9 17:42:12 uncaught exception: error: { "$err" : "not master and slaveok=false", "code" : 13435 }解决:SECONDARY>db.getMongo().setSlaveOk() 这样就可以了
查看数据文件:
SECONDARY> show dbslocal 1.203125GBtest (empty)SECONDARY> show dbslocal 1.203125GBtest (empty)SECONDARY> use localswitched to db localSECONDARY> show collections;meoplog.rs 数据语句是先存储在该文件中的,100ms写入磁盘replset.minvalidsystem.indexessystem.replsetSECONDARY>
If true, this member will participate in vote but receive no data.
1.6
buildIndexes
true
When false, prevent secondary indexes from being created on this member. This is typically used on machines that are pure "backup" machines that are never queried. By not having the secondary indexes, the member performs less works on writes and requires less ram. Note the _id index is still created. Can only be set to false if priority:0. It is rare to use this option.
1.6
hidden
false
If true, do not advertise the member's existence to clients in isMaster command responses. Hidden replicas makes sense for replicas of data which have very different use patterns (reporting, integration, backup, etc.) than the main set of replicas; this option allows you to keep from sending normal non-primary queries to the node.
1.7
priority
1.0
Priority of the server for elections. Higher priority servers will be preferred as primary. (more information)
1.6, 1.9
tags
{}
An document representing the location of this server. Tags can be used for location-aware write guarantees and read locality, see Data Center Awareness
1.9.1
slaveDelay
0
Number of seconds to remain behind the primary. A value of 0 implies "as up-to-date as possible". Used to recover from human errors (e.g.: accidentally dropping a database). Can only be set on members with priority 0. Slave delay members are a great way to keep a rolling backup from a certain amount of time in the past.
1.6.3
votes
1
Number of votes this member has in an election. Generally you should not change this. (more information)
1.6
七、移除节点:
rs.remove("IP:27017")rs.remove("IP")
八、replica的成员级别类型:
prority 优先级;Delayed 同步间隔;Hidden 隐藏
You must send the rs.reconfig() command to a set member that can become primary. In the above example, if you issue the rs.reconfig() operation to the member with the _id of 0, the operation will fail.这个是隐藏的解释,其它的就不用说了。
Perform a full resync. If you stop the failedmongod, delete all data in the dbpath (including subdirectories), and restart it, it will automatically resynchronize itself.Obviously it would be better/safer to back up the data first. If disk space is adequate, simply move it to a backup location on the machine if appropriate.Resyncing may take a long time if the database is huge or the network slow – even idealized one terabyte of data would require three hours to transmit over gigabit ethernet.Copy data from another member: You can copy all the data files from another member of the set IF you have a snapshot of that member's data file's. This can be done in a number of ways. The simplest is to stopmongodon the source member, copy all its files, and then restartmongodon both nodes. The Mongofsync and lockfeature is another way to achieve this if you are using EBS or a SAN. On a slow network, snapshotting all the datafiles from another (inactive) member to a gziped tarball is a good solution. Also similar strategies work well when using SANs and services such as Amazon Elastic Block Service snapshots.Find a member with older data:Note: this is only possible (and occurs automatically) in v1.8+. If another member of the replica set has a large enough oplog or is far enough behind that the stale member can sync from it, the stale member can bootstrap itself from this member.
十四、限制说明:
A set can contain·最多有12个成员·最多只能在7个成员中进行选举
补充点:节点的类型
·Primary - Can be thought of as "master" although which server is primary can vary over time. Only 1 server is primary at a given point in time.·Secondary - Can be thought of as a slave in the cluster; varies over time.·Recovering - getting back in sync before entering Secondary mode.