In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Why study?
The project needs, the company needs to mine valuable information from previous log records and purchase information, with a large amount of data and complex structure.
The requirements of the project determine that it is necessary to solve the problems of high concurrency of database read and write, efficient storage and access of massive data, high scalability and high availability.
MongoDB (unstructured database) can not only deal with structured data, but also more suitable for dealing with unstructured data (text, image, hypermedia and other information). It breaks through the limitation that the definition of relational database structure is not easy to change and the fixed length of data, and has incomparable advantages over relational database in dealing with continuous information and unstructured information.
The advantages of MongoDB: large amount of data, high performance, easy to expand, high availability, easy to achieve large amount of data storage; perfect Java API, storage format JSON, very easy to deal with JAVA,JS, easy to operate and maintain, clear version control, very active community.
Relational databases are not good at: writing large amounts of data; fields are not fixed; table structure changes; simple queries need to return results quickly.
MongoDB is widely used in major Internet companies, covering a wide range and easy to use.
What are the features of 2.MongoDB?
Document oriented storage: BSON
Collection-oriented storage: easy to store data of object type.
Powerful query function: supports rich query expressions. Using tags in the form of json, you can query objects and arrays embedded in a document.
Complete query function: full index support includes embedded objects and arrays. The query optimizer generates an efficient query plan.
Schema freedom: keys in the collection do not require consistency, and key values do not require consistent data types. I don't know any of its structural definitions.
Replication (master-slave replica / replica set) and automatic failover: for failure recovery, read extension; Mongo database supports data replication between servers, supports master-slave mode and mutual replication between servers
Sharding (automatic sharding): for load balancing, write expansion. Support horizontal database clusters and dynamically add additional machines
GridsFS: avoid file system restrictions on the number of files in directories. There is no disk fragmentation.
Support RUBY,PYTHON,JAVA,C++ and other multi-language, multi-platform
Query monitoring: monitoring tools are used to analyze database operation performance
Caching service: caching relational database data to reduce data pressure
Automatic processing of fragments
Third, the solution for MongoDB to store binary data in the database?
There are two types: the first is to convert files into binary data and store them in mongodb, just as ordinary data is stored, and the second is to use gridfs
The first: first read the contents of the file, then insert it into the bson.binary.Binary object, and finally write to the database as usual; get the file as simple as usual, find the data as usual, and then write the binary content to the file
Second, if it is a large file, you can use gridfs
Gridfs will divide the file into several blocks to store, the default size of each block is 256K, so, if it is a small file, do not use gridfs to store, otherwise it will waste space. Gridfs is a distributed file system on MongoDB, you can use mongodb's sharding and replication mechanism, because Mongodb allocates data space in 2GB units, so gridfs does not produce disk fragments.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.