28 MongoDB Issues

Source: Internet
Author: User
Tags couchbase failover safe mode couchdb

MongoDB is currently the best document-oriented, free, open-source NoSQL database. If you are preparing for a technical interview with MongoDB NoSQL database, you'd better take a look at the following MongoDB NoSQL interview quiz. These MongoDB NoSQL interview questions cover the basic concepts of NoSQL databases, replication (Replication), sharding (sharding), Transactions and locks, trace analysis Tools (Profiler), nuances and log features. Let's take a look at the interview questions and answers to these MongoDB NoSQL databases:

1. What do you mean by the NoSQL database? What is the difference between NoSQL and RDBMS? Why use and not use NoSQL databases? What are some of the benefits of NoSQL databases?

I wrote a full blog to answer these questions, look here

2. What are the types of NoSQL databases?

Types of NoSQL databases

For example: MongoDB, Cassandra, CouchDB, hypertable, Redis, Riak, neo4j, HBASE, Couchbase, Memcachedb, revendb and Voldemort are th E Examples of the NoSQL databases. Read more.

3. What is the most basic difference between MySQL and MongoDB?

Both MySQL and MongoDB are free open-source databases. There are many basic differences between MySQL and MongoDB, including data representation, querying, relationships, transactions, schema design and definition, standardization (normalization), speed and performance. By comparing MySQL and MongoDB, we are actually comparing relational and non-relational databases. Read more

4. How do you compare MongoDB, Couchdb and couchbase?

Both MongoDB and COUCHDB are document-oriented databases. MongoDB and Couchdb are the most typical representatives of open source NoSQL databases. They have nothing in common except that they are stored in document form. MongoDB and Couchdb are quite different in data model implementations, interfaces, object storage, and Replication methods.

Details can be found in the following links:

Mongdb vs CouchDB

CouchDB vs Couchbase

5. What is MongoDB's reason for being the best NoSQL database?

The following features make MongoDB the best NoSQL database:

    • FILE-oriented
    • Performance
    • High Availability
    • Ease of scalability
    • Rich Query Language

What are the nuances on a 6.32-bit system?

Journaling will activate additional memory-mapped files. This will further suppress the size of the database on the 32-bit version. As a result, journaling is now disabled by default on 32-bit systems.

7. Does the journal replay encounter problems when the entry (entry) is incomplete (such as when there is a fault in the middle)?

Each journal (group) write is consistent unless it is complete or it will not play back during the recovery process.

8. What is the role of the parser in MongoDB?

MongoDB includes a database parser that can display the performance characteristics of each operation in the database. With this parser you can find queries (or write operations) that are slower than expected, and use this information, for example, to determine whether you need to add an index.

9. What is a namespace (namespace)?

MongoDB stores Bson objects in a cluster (collection). Database names and cluster names are linked together by periods called namespaces (namespace).

10. If the user removes the object's properties, is the property removed from the storage tier?

Yes, the user removes the property and the object is re-saved (Re-save ()).

11. Can I use log features for secure backups?

Yes.

12. Allow null values?

For object members, yes. However, users are not able to add null values (NULL) to the database Cluster (collection) because null values are not objects. However, the user is able to add an empty object {}.

13. Update operation immediately fsync to disk?

No, disk write operations are deferred by default. The write operation may reach the disk in two or three seconds (by default, within 60 seconds). For example, if the database receives 1000 operations on an object in one second, the disk is flushed only once. (Note that although the Fsync option is valid on the command line and after Getlasterror_old) (Translator: Perhaps deceptive's face test??).

14. How do I perform a transaction/locking?

MongoDB does not use traditional locks or complex transactions with rollback, as it is designed for lightweight, fast and predictable performance. It can be likened to the MySQL Mylsam auto-commit mode. Performance has been improved by streamlining support for transactions, especially in a system that may pass through multiple servers.

15. Why is my data file so large?

MongoDB proactively allocates headroom to prevent file system fragmentation.

16. How long does it take to enable backup recovery?

It takes 10-30 seconds to declare the primary database from the backup database down to a backup database as the new primary database. Operations on the primary database during this time will fail-including write and strong-consistent reads (strong consistent read) operations. However, you can also perform a final consistency query (eventually consistent query) on the second database (in Slaveok mode), even during this time.

17. What is master or primary?

It is the primary node/member in the current backup cluster (replica set) that handles all write operations. In a backup cluster, when the failover (failover) event occurs, an additional member becomes primary.

18. What is secondary or slave?

Seconday copy the appropriate action from the current primary. It is done by tracking replication Oplog (local.oplog.rs).

19. Do I have to call GetLastError to make sure that the write takes effect?

No. Regardless of whether you call GetLastError (also known as "Safe Mode") the server does the same things. Call GetLastError just to confirm that the write operation was successfully committed. Of course, you often want to be sure, but the security of the write operation and whether it takes effect is not determined by this.

Should I start a clustered shard (sharded) or a MongoDB environment that is not a clustered shard?

For development convenience, we recommend starting a MongoDB environment in non-clustered shards (unsharded), unless one server is not enough to hold your initial data set. Upgrading from a non-clustered shard to a clustered shard (sharding) is seamless, so it is not necessary to consider cluster sharding (sharding) When your data set is not very large.

21. How do Shards (sharding) and Replication (replication) work?

Each shard (shard) is a logical collection of partitioned data. Shards may consist of a single server or cluster, and we recommend using clusters for each shard (shard).

22. When will the data be extended to multiple shards (shard)?

MongoDB Shards are region-based (range). So all the objects in a collection (collection) are stored in a block (chunk). There are multiple shards that have the option to fetch data only if there is an extra block. Now, the size of each default block is 64Mb, so you need at least a few megabytes of space to implement a migration.

23. What happens when I try to update a document on a block (chunk) that is being migrated?

The update operation occurs immediately on the Old Shard (Shard) before the change is replicated to the new shard before the transfer of ownership (ownership transfers).

24. What happens if I start a query when a shard (shard) stops or is slow?

If a shard (Shard) is stopped, the query returns an error unless the query has the "Partial" option set. If a shard (shard) responds slowly, MongoDB waits for its response.

25. Can I delete the old files in the Movechunk directory?

No problem, these files are temporary files that are generated when the Shard (shard) is balanced (balancing). Once these operations have been completed, the relevant temporary files should also be deleted. But the cleanup work is now manual, so be careful to consider the space to release these files.

26. How do I view the links that Mongo is using?

Db._admincommand ("Connpoolstats");

27. If the block move operation (Movechunk) fails, do I need to manually clear the partially transferred document?

No, the move operation is consistent (consistent) and deterministic (deterministic); Once a failure occurs, the move continues to retry, and when completed, the data will only appear in the New Shard (Shard).

28. If I am using replication technology (replication), can I use a portion of the log (journaling) while others are not used?

OK.

28 MongoDB Issues

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.