In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "how to install mongodb", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to install mongodb" this article.
MongoDB is a product between relational database and non-relational database, which is the most functional and most like relational database in non-relational database. The data structure he supports is very loose, which is similar to json's bjson format, so it can store more complex data types. The most important feature of Mongo is that the query language it supports is very powerful, and its syntax is somewhat similar to the object-oriented query language. It can almost achieve most of the functions similar to the single table query of relational database, and also supports the establishment of data indexing.
It is characterized by high performance, easy to deploy, easy to use, and it is very convenient to store data. The main functional features are:
For collection storage, it is easy to store data of object type.
Mode freedom.
Dynamic query is supported.
Full indexing is supported, including internal objects.
Query is supported.
Replication and failure recovery are supported.
Use efficient binary data storage, including large objects such as video, etc.
Automatically handle fragments to support scalability at the cloud computing level
Support for RUBY,PYTHON,JAVA,C++,PHP and other languages.
The file is stored in BSON (an extension of JSON)
Accessible through the network
The so-called "Collenction-Orented-oriented" means that data is grouped and stored in a dataset, which is called a Collenction. Each collection has a unique identification name in the database and can contain an unlimited number of documents. The concept of a collection is similar to a table (table) in a relational database (RDBMS), except that it does not need to define any schema.
Schema freedom (schema-free) means that we do not need to know any structural definition of the file stored in the mongodb database. If necessary, you can store files with different structures in the same database.
A document stored in a collection is stored as a key-value pair. The key is used to uniquely identify a document that is a string type, while the value can be a complex file type. We call this form of storage BSON (Binary Serialized dOcument Format).
The MongoDB server can run on Linux, Windows or OS X platforms and supports 32-bit and 64-bit applications. The default port is 27017. It is recommended to run on 64-bit platform because of MongoDB
The maximum file size supported when running in 32-bit mode is 2GB.
MongoDB stores the data in a file (the default path is: / data/db) and manages it using memory-mapped files for efficiency.
The above is picked casually, in fact, non-traditional non-relational databases, now classified as document-based databases, note that the largest file supported by the 32-bit operating system is 2GB, so friends who do mass storage of large files should choose 64-bit system installation. Let's start our road of download and installation.
MongoDB's official website is: http://www.mongodb.org/
The latest version of MongoDB can be downloaded from the DownLoad menu on the official website: http://www.mongodb.org/downloads
I chose Windows 32-bit version 1.8.1.
The MongoDB For .net driver package is located under the Driver menu on the official website (with links to other languages): https://github.com/mongodb/mongo-csharp-driver/downloads
My operating system is Windows7 Professional Edition, the MongoDB version is Windows 32-bit 1.8.1, and the development kit is VS2008 version.
We're starting our installation process.
1. Extract mongodb-win32-i386-1.8.1.zip, create the path C:\ Program Files\ mongodb, and Copy to the extracted Bin file under this folder
C:\ Program Files\ mongodb\ bin
C:\ Program Files\ mongodb\ data\ db
C:\ Program Files\ mongodb\ data\ log
Create a log file MongoDB.log under the log folder, that is, C:\ Program Files\ mongodb\ data\ log\ MongoDB.log
After completing the above work, you wonder why you set up these folders (because the Mongodb installation requires these folders, the default installation is not to create, but the files are all installed to C:\ data\)
3. Introduction of several installation methods
Program startup mode
Run cmd.exe to enter the DOS hit interface
Execute this command to create the database file of mongodb to the C:\ Program Files\ mongodb\ data\ db directory, and you will not be surprised to see a successful prompt for sucess on the last line of the command
After the startup program is opened, run the mongo.exe program (note that there is no d). The interface is as follows
Test database operation
> help (view related information)
> db.foo.insert ({afoo 1}) (insert the value of the foo field into the foo table, which is the default table)
> db.foo.find () (view Foo table data)
The results are as follows:
You can see that three records have been inserted, respectively, a _ set.
When mongod.exe is turned off, mongo.exe cannot connect to the database, so every time you want to use the mongodb database, you have to open the mongod.exe program, so it's troublesome, next we will
Install MongoDB as a windows service
Windows service mode
Run cmd.exe
> cd C:\ Program Files\ mongodb\ bin > C:\ Program Files\ mongodb\ bin > mongod-- dbpath "C:\ Program Files\ mongodb\ data\ db"-- logpath "C:\ Program Files\ mongodb\ data\ log\ MongoDB.log"-install-- serviceName "MongoDB"
Here MongoDB.log is the log file that you started to build. The serviceName "MongoDB" service is called MongoDB.
The success of running the command is as shown below:
The quoting service has been installed successfully, run
> NET START MongoDB (enable the service) > NET stop MongoDB (disable the service) > > C:\ Program Files\ mongodb\ bin > mongod-- dbpath "C:\ Program Files\ mongodb\ data\ db"-- logpath "C:\ Program Files\ mongodb\ data\ log\ MongoDB.log"-- remove-- serviceName "MongoDB" (delete, note that it is not-- install)
For other orders, please refer to the help command or the official website description.
View Servic
Run the mongo.exe client under the bin folder to test it. The test is the same as 3.1.
Daemon mode
-- fork runs MongoDB as a daemon to create a server process
> C:\ Program Files\ mongodb\ bin > mongod-- port 10220-fork-- dbpath "C:\ Program Files\ mongodb\ data\ db"-- logpath "C:\ Program Files\ mongodb\ data\ log\ MongoDB.log" forked process: 44086all output going to: MongoDB.log
This is the end of the introduction of several installations.
4. Stop MongoDB
The safest way to stop after processing all the current operations and saving the cached data to disk
> user admin > db.shutdownServer ()
Of course, we can also shut down the process directly, but this way will cause the data in the cache to be refreshed and saved to disk before it is urgent and lost.
The above is all the contents of the article "how to install mongodb". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.