In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Introduction to MongoDB:
1.MongoDB is an open source document database based on distributed file storage and the industry-leading NoSQL database written in C++.
two。 In the case of high load, adding more nodes can ensure server performance.
3.MongoDB is a product between relational database and non-relational database. The main purpose of not using relational model is to obtain better expansibility. MongoDB no longer has the concept of row, and its operation mode is based on two concepts: collection and document.
4. MongoDB aims to provide scalable high-performance data storage solutions for WEB applications.
5.MongoDB stores the data as a document, and the data structure consists of key-value (key= > value) pairs. MongoDB documents are similar to JSON objects. Field values can contain other documents, arrays, and document arrays.
Main features:
1.MongoDB is easy to install, provides document-oriented storage function, and is easy to operate.
2.MongoDB provides replication, high availability, and automatic sharding. If the load increases (more storage space and more processing power are needed), it can be distributed among other nodes in the computer network, which is called sharding.
3.MongoDB supports rich query expressions, and query instructions use tags in the form of JSON to easily query objects and arrays embedded in documents.
4.MongoDB supports a variety of programming languages: Ruby, Python, Java, C++, PHP, C # and other languages.
5.MongoDB uses the update () command to replace the completed document (data) or some specified data fields.
Map/reduce in 6.MongoDB is mainly used for batch processing and aggregation of data.
Areas of application of MongoDB:
MongoDB can provide scalable high-performance data storage solutions for web applications. MongoDB is mainly applicable to website data, distributed scenarios, data caching and JSON document format storage. It is suitable for Internet applications with large amount of data, high concurrency and weak transactions. its built-in horizontal scaling mechanism provides data processing capacity from millions to billions, which can well meet the data storage requirements of web2.0 and mobile Internet applications.
Deploy and install MongoDB4.0:
Installation environment:
Operating system: CentOs 7
Software package: https://pan.baidu.com/s/1xI38QSzie6DK2UL7wQ6K9g
Turn off the firewall and Selinux
Installation process:
1. Install support packages
Yum-y install openssl-devel libcurl
two。 Copy the software package to the CentOs 7 root directory using the winscp tool
3. Extract the MongoDB software package
Tar zxvf mongodb-linux-x86_64-rhel70-4.0.0.tgz-C / opt
4. Rename and move directory to / usr/local/ directory
Mv / opt/mongodb-linux-x86_64-rhel70-4.0.0 / usr/local/mongodb
5. Create MongoDB's data storage directory, log storage directory and log files
Mkdir-p / data/mongodb/mongodb1
Mkdir-p / data/conf/
Mkdir-p / data/logs/
Touch / data/logs/mongodb1.log
Chmod-R 777 / data/logs/mongodb1.log
6. Adjust the settings of shell resources to prevent frequent access to MongoDB resulting in errors that result in failure to connect to MongoDB instances
Ulimit-n 25000 # maximum number of open files at a time
Ulimit-u 25000 # maximum number of programs opened at the same time
7. Create a configuration file (startup parameters)
Vim / data/conf/mongodb1.conf
The modifications are as follows:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
SystemLog:
Destination: file
LogAppend: true
Log file path of path: / data/logs/mongodb1.log / / mongodb1
# Where and how to store data.
Storage:
Data file path of dbPath: / data/mongodb/mongodb1/ mongodb1
Journal:
Enabled: true
# engine:
# mmapv1:
# wiredTiger:
# how the process runs
ProcessManagement:
Fork: true # fork and run in background
PidFilePath: / data/mongodb/mongodb1/mongod.pid # location of pidfile
TimeZoneInfo: / usr/share/zoneinfo
# network interfaces
Net:
Port: 27017 / / process number of mongodb1
BindIp: 0.0.0.0 # Listen to local interface only, comment to listen on all interfaces.
# security:
# operationProfiling:
Replication: / / Delete "#" and enable replication set function
ReplSetName: test-rc / / name is test-rc
# sharding:
# # Enterprise-Only Options
# auditLog:
# snmp:
8. Set kernel parameters (when one node runs out of available memory, the system allocates memory from other nodes)
Echo 0 > / proc/sys/vm/zone_reclaim_mode
Sysctl-w vm.zone_reclaim_mode=0
Echo never > / sys/kernel/mm/transparent_hugepage/enabled
Echo never > / sys/kernel/mm/transparent_hugepage/defrag
The executable file for 9.MongoDB is located in the bin directory, so you can add it to the PATH path:
Vim / etc/profile
Append the following statement to the end of the file
Export PATH=/usr/local/mongodb/bin:$PATH\
Then reload the environment variables:
Source / etc/profile
10. Set MongoDB Boot self-boot
Vim / etc/rc.local
Rm-rf / data/mongodb/mongodb1/mongod.lock
/ usr/local/mongodb/bin/mongod-f / data/conf/mongodb1.conf / / start the instance
11. Start the MongoDB database
Mongod-f / data/conf/mongodb1.conf
twelve。 Check the MongoDB process
Netstat-tunlp | grep mongod
13. Shut down the MongoDB database
Mongod-f / data/conf/mongodb1.conf-- shutdown
14. Local client connects and accesses MongoDB database (default port: 27017)
Enter directly with the command mongo
It's over!
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.