mongodb-Frequently Asked Questions

Source: Internet
Author: User
Tags server port

Objective

MongoDB the version of the database is 3.0.7. Record in the use of MongoDB database encountered a variety of problems, is currently encountered a collation, no classification, and so many times, sorting out a bit.

1. Authentication fails when you connect using the visualizer, Authorization failed

validation fails when you use Mongovue or Robomongo to connect to the database.

Workaround :

(1) First, shut down the cluster server and start the cluster with non-authentication

(2) Then, login to a mongos and each shard server, modify the System.version collection under the Admin database, originally {"CurrentVersion": 5}. Db.system.version.update ({"_id": "Authschema"},{$set: {"CurrentVersion": 3}})

(3) Finally, re-establish all users after modifying the version, reboot the cluster and add authentication.

reason :

This is related to the MONGDB authentication mechanism, which is used by the default authentication mode of Scram-sha-1 (currentversion=5) for 3.0, and 2.6 previously using MONGODB-CR (MongoDB Challenge and Response) (currentversion=3) authentication method.

3.0 of bug:https://jira.mongodb.org/browse/server-17459

2. Cluster shard failure

There are several reasons for this:

(1) Ensure that the server port is on, turn off the firewall, Systemctl stop FIREWALLD

(2) To ensure the best server time is less than 30 seconds

Date-s ' 05/24/2016 15:27:05 ' ntpdate–u x.x.x.x

(3) Too little data volume does not meet the Shard requirements

3. TTL index invalidation

There are several reasons for this:

(1) Guaranteed to build TTL index of the field is a date type, if used array, to ensure that the array contains date type of data

(2) When the index is set up using Expireafterseconds full spell, cannot be abbreviated as follows

Db.coll.ensureIndex ({"Ttlkey": 1},{"Expireafterseconds": 60*60*12}) Expiration time is 12h

4. How to shut down a cluster

Close the cluster in the order of Mongos-config-shard, log in to the appropriate database, select the Admin database, and use Db.shutdownserver () to close the service.

If authentication is enabled, remember to create the admin user before enabling , not just the MONGOs creation, but also the Shard servers to create.

5. Mongod Service failed to start

There are several reasons for this:

(1) Determine if the data directory exists

(2) To view the Mongod.lock file in the--dbpath directory, this file size is not 0, indicating the last time the database was abnormally exited, there are two methods, one is to delete the file directly, and the second is to repair the database (repair)

mongodb-Frequently Asked Questions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.