In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
A brief introduction to MongoDB
MongoDB is a high-performance, open source, schemalless document database, which is one of the most popular NoSql databases. It can be used to replace the traditional relational database or key / value storage in many scenarios. Mongo is developed using C++. The official website address of Mongo is http://www.mongodb.org/, where readers can get more detailed information.
1. What is NoSql?
NoSql, whose full name is Not Only Sql, refers to a non-relational database. The next generation database mainly addresses several key points: non-relational, distributed, open source, and horizontally scalable. Originally intended for large-scale web applications, the campaign began in early 2009 with features such as: free mode, support for easy replication, simple API, ultimate consistency (non-ACID), large-capacity data, etc. NoSQL is most used by us when key-value storage, of course, there are other document, column storage, schema database, xml database and so on.
2. Features:
High performance, easy to deploy, easy to use, very convenient to store data. The main functional features are:
1) for collection storage, it is easy to store data of object type.
2) Free mode.
3) dynamic query is supported.
4) full indexing is supported, including internal objects.
5) query is supported.
6) replication and failure recovery are supported.
7) use efficient binary data storage, including large objects such as video, etc.
8) automatically handle fragments to support scalability at the cloud computing level
9) drivers for Python,PHP,Ruby,Java,C,C#,Javascript,Perl and C++ languages are supported, and drivers for platforms such as Erlang and .NET are also available in the community.
10) the file format is BSON (an extension of JSON).
11) can be accessed through the network.
3. Function:
1) Collection-oriented storage: suitable for storing objects and data in JSON form.
2) dynamic query: Mongo supports rich query expressions. Query instructions use tags in the form of JSON to easily query objects and arrays embedded in a document.
3) complete indexing support: including document embedded objects and arrays. Mongo's query optimizer parses the query expression and generates an efficient query plan.
4) query monitoring: Mongo includes a monitoring tool for analyzing the performance of database operations.
5) replication and automatic failover: Mongo database supports data replication between servers, master-slave mode and mutual replication between servers. The primary goal of replication is to provide redundancy and automatic failover.
6) efficient traditional storage: support for binary data and large objects (such as photos or pictures)
7) automatic sharding to support cloud-level scalability: the automatic sharding feature supports horizontal database clusters and can dynamically add additional machines.
4. Applicable occasions:
1) website data: Mongo is very suitable for real-time insertion, update and query, and has the replication and high scalability required for website real-time data storage.
2) caching: due to its high performance, Mongo is also suitable as a cache layer for information infrastructure. After the system restart, the persistent cache layer built by Mongo can avoid the data source overload of the lower layer.
3) large-size, low-value data: it may be expensive to use traditional relational databases to store some data. before that, programmers often choose traditional files to store.
4) highly scalable scenarios: Mongo is ideal for databases consisting of dozens or hundreds of servers. Mongo's roadmap already includes built-in support for the MapReduce engine.
5) for the storage of objects and JSON data: Mongo's BSON data format is very suitable for document format storage and query.
Download, install and configure:
1. Decompression
# tar-zxvf mongodb-linux-x86_64-2.4.9.tgz # mv mongodb-linux-x86_64-2.4.9 / usr/local/mongodb
2. Create data and log directories
# mkdir-p / usr/local/mongodb/data# mkdir-p / usr/local/mongodb/logs
3. Command path optimization
# ln-s / usr/local/mongodb/bin/mongo / usr/sbin/mongo# ln-s / usr/local/mongodb/bin/mongodump / usr/sbin/mongodump# ln-s / usr/local/mongodb/bin/mongod / usr/sbin/mongod# ln-s / usr/local/mongodb/bin/mongorestore / usr/sbin/mongorestore
4. Start mongodb
# mongod-dbpath=/usr/local/mongodb/data/-logpath=/usr/local/mongodb/db.logs-fork-smallfiles
5. Check the running status of mongodb
# ps-aux | grep mongo# netstat-anpt | grep mongo
6. Add as auto-start
# Vim / etc/rc.d/rc.local add: / usr/local/mongodb/bin/mongod-- dbpath=/usr/local/mongodb/data/-- logpath=/usr/local/mongodb/db.logs-- fork-smallfiles
7. Log in to mongodb database (default is test database)
# / usr/local/mongodb/bin/mongo
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.