Duration: 20,160 months 12
Recently interested in the database, so I went to the next part of the related popular database.
Mysql
relational database.
There are different storage methods on different engines.
The query statement uses the traditional SQL statement, has the mature system, the maturity is very high.
The share of the open source database is increasing, and the MySQL share page continues to grow.
The drawback is that efficiency can be significantly slower in the massive data processing.
Mongodb
Non-relational database (NoSQL), which belongs to the document type database. First explain the database of the document, that is, you can store XML, JSON, Bson type of data. These data are self-describing (self-describing), presenting hierarchical tree-like data structures. The data structure consists of a key value (Key=>value) pair.
Storage mode: Virtual memory + persistent.
Query statement: is a unique way to query MongoDB.
Suitable for scenarios: event recording, content management or blogging platform, etc.
Architectural Features: High availability can be achieved through replica sets, as well as shards.
Processing: Data is stored on the hard disk, but the data that needs to be read frequently is loaded into memory and stored in physical memory to achieve high-speed read and write.
Maturity and breadth: emerging databases, low maturity, NoSQL database closest to relational database, one of the more perfect db, the applicable population is growing.
Advantage:
Fast! The performance of MongoDB in the right amount of memory is very rapid, it stores hot data in physical memory, making the thermal data read and write very fast,
High Expansion!
Self-failover mechanism!
The storage format of JSON!
Disadvantage: The main thing is nothing mechanism!
Analyze MySQL and MongoDB application scenarios
1. If you need to use MongoDB as a back-end db instead of MySQL, where MySQL and MongoDB are parallel, then there are several scenarios in which this may be considered: (1) MongoDB is responsible for the part of the document storage, can have good code affinity, Direct write in JSON format is convenient. (such as logs, etc.) (2) Consider atomicity from the data models design phase, without the need for assistance such as transactions. Development using language such as Nodejs to develop, it is more convenient for development. (3) The failover mechanism of MongoDB itself does not need to be implemented in such a way as MHA.
2. Use MongoDB as a redis-like, memcache to cache db, serve MySQL, or back-end log collection analysis. Given that MongoDB is a nosql database, SQL statements and data structures are not as friendly as MySQL, and there will be times when MongoDB is used as a cache db such as Redis memcache, which is used to assist MySQL. or only for log collection analysis.
Reference Original: http://www.cnblogs.com/eternal1025/p/5419905.html
Talk about the difference between mongodb,mysql and the specific application scenario