MongoDB replication errors and Handling Methods
Run rs. status () on the master node to view the corresponding errormsg.
The specific solution is as follows:
1. Error creating index 13111 field not found, expected type 16
This error occurs when you execute mongorestore to import data. The command used is
./Mongorestore-h localhost: 27100/data/backup/mongodb
Solution:
Change
./Mongorestore -- port 27100/data/backup/mongodb
2. error RS102 too stale to catch up
The RS102 error is returned when rs. status () is executed during master-slave synchronization. Because -- oplogSize = 128 is specified at startup (the oplog Log Size of the master node, measured in M, changes the oplog size and deletes the local. *, and then add -- oplogSize = * to restart, * to indicate the size.) When you insert big data into the master database, it may be too late to synchronize data to the slave database.
Solution:
Stop the Master/Slave database, copy the data of the master database to the slave database, and restart the service.
Reference
Http://www.mongodb.org/display/DOCS/Resyncing+a+Very+Stale+Replica+Set+Member
3. Command 'listdatabases' failed: need to login (response: {"errmsg": "need to login", "OK": 0 })
After the Master/Slave database is configured, it is found that only the local database can be connected, and other machines cannot connect.
Solution:
Remove -- keyFile at startup.
4. pymongo. errors. AutoReconnect: cocould not find master/primary
The MongoDB service may be suspended abnormally. Solution: delete mongod. lock and restart mongdb.
5. pymongo. errors. AutoReconnect: master has changed
This error occurs when python connects to the database through pymongo.
Solution:
Switch the connection code. Bigtb_corpus = pymongo. Connection ("lifeba.org", 27100)
Servers = "mongodb: // lifeba.org: 27100 /? Slaveok = true "bigtb_corpus = pymongo. Connection (servers)
6. Connection reset by peer
This error occurs during stress testing when Python is connected to MongoDB. When the number of connections is full, the connection is reset. Later, it was found that the reason was that the mongodb driver version was inconsistent. MongoDB is deployed in version 2.0.1. The driver installed on a machine connected to MongoDB is version 2.2.
As a result, each access connection increases without being released.
7. Replica Set master is not synchronized (RECOVERING, still syncing, not yet to minValid optime)
Use db. printSlaveReplicationInfo () and db. printReplicationInfo () to view the latest master-slave synchronization status.
Stop the slave database, delete all the database data, and restart the slave database. The slave database automatically synchronizes data from the master database.
8. Add a new slave machine to the existing master and slave nodes.
Copy the database of the host machine to the slave machine, start the slave database, and add the slave machine to the host machine: rs. add ("192.168.0.149: 27100 ")
9. Remove the master and slave nodes from MongoDB.
Stop the mongo service of all machines, delete the local. * file, delete the journal folder, remove -- replSet = rs in the startup command, and restart.
10. HOSTNAME Problems
ReplSet exception loading our local replset configuration object: 0 assertion src/mongo/db/repl/.../../db/../util/net/hostandport. h: 120
The default hostname is localhost. If this parameter is set to another name, an error is returned.
Master has changed exception
After the MongoDB Master/Slave database is configured, an Intranet ip address will also be used for connection. The solution is to use the hostname for connection.
11. initial sync need a member to be primary or secondary to do our initial sync
Synchronization in progress. data has not been synchronized yet. Wait for a while and check again.
MongoDB 3.0 official version released and downloaded
CentOS compilation and installation of MongoDB
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: