"Database" Mean installation of Web development 04-mongodb on Linux and problems encountered

Source: Internet
Author: User
Tags mongodb client



Brief introduction



Mean is a full stack development framework for JavaScript. More about



The storage of persistent data with MongoDB is a part of mean web full stack development.



MongoDB is a product between a relational database and a non-relational database, and is the most versatile and most like relational database in a non-relational database. It is characterized by high performance, easy to deploy, easy to use, and easy to store data.



MongoDB's learning materials can be consulted:



MongoDB Chinese Community



The previous section describes the NoSQL manager for MongoDB Client Management tool to connect to the local database and how to use it, which describes the installation and connection of MongoDB on Linux.





Installing MongoDB under Linux


Because of the local environment problem, I usually like to connect directly to the remote private server when I develop, then let's try to install, configure and connect MongoDB on Linux.



Os:centos 7.2



Install package: Click here to view



1. Download and unzip:


Curl-o https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.4.4.tgz
TAR-ZXVF mongodb-linux-x86_64-rhel70-3.4.4.tgz


2. Move the unpacking package to the specified directories and add paths:



(/usrusually contains only the program that comes with the system when it is released, and /usr/localis the directory that the local system administrator uses to freely add programs)



The MongoDB executable is located in the bin directory, so it is added to the path path:


MV  mongodb-linux-x86_64-rhel70-3.4.4//usr/local/mongodb
Export PATH=/usr/local/mongodb/bin:$PATH     


The database directory in 3.MongoDB must be created manually, typically in the MongoDB directory to create the data/db folder and the logs file:


cd/usr/local/mongodbmkdir-p Data/dbtouch logs







Start MongoDB and problems


1. After installation and configuration, run in the bin directory:


CD bin
Mongod--dbpath. /data/db


If you see this phrase, it runs successfully: [Thread1] waiting for connections on port 27017






2. Background management of MongoDB by entering the following command below the bin


./mongo


such as inserting:


> Db.runoob.insert ({x:10"ninserted" : 1 })>" _id " : ObjectId ("5604ff74a274a611b0c990aa""x" : Ten }>


Note the issue:



1. If you encounter a start-up:


in initAndListen: 29 Data directory /data/db not found., terminating


Indicates that the specified database path is not correct.



The above error occurs because the/data/dbdirectory does not exist, if you start, do not specify any parameters, MongoDB will default to use the/data/dbdirectory to store data, we can use--dbpathto specify other paths, such as:


/Users/pantao/Workspace/MongoDB/db





2. The previous CentOS version is 6.6. So you will encounter the following problems



Error found:./mongod:/lib64/libc.so.6:version ' glibc_2.14 ' not found (required by./mongod)






That's because the glibc version is too low (glibc is the GNU libc Library, the C runtime library. GLIBC is the lowest-level API in a Linux system, and almost any other runtime relies on glibc)



View glibc version, found to be version 2.12:






or execute:


Strings/lib64/libc.so.6 |grep glibc_





So it is recommended to use the CentOS7.2 version, the libc version is 2.17 This problem does not occur.






Next: Remote connection with NoSQL Manager for MongoDB






"Database" Mean installation of Web development 04-mongodb on Linux and problems encountered


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.