MONGODB Installation Environment Construction

Source: Internet
Author: User

Mongodb the default port number 27017

_id is a globally unique value, do not assign a value to this column, the default is unique, if the assignment, the inclusion of two columns of _id:2 , it is reported that the conflict cannot be inserted

[Email protected] ~]# tar xvf mongodb-linux-x86_64-2.6.10.tgz

[Email protected] ~]# mkdir-p/export/mongodb

[Email protected] ~]# mkdir-p/export/mongodb/bin

[Email protected] ~]# mkdir-p/export/mongodb/conf

[Email protected] ~]# mkdir-p/export/mongodb/log

[Email protected]~]# mkdir-p/export/mongodb/data

[[Email protected]]# cd/root/mongodb-linux-x86_64-2.6.10/bin

[Email protected]]# cp/root/mongodb-linux-x86_64-2.6.10/bin/*/export/mongodb/bin/

[[Email protected]]# vi/export/mongodb/conf/mongod.conf

[Email protected]]# cat mongod.conf

port=27408

Dbpath=/export/mongodb/data

Logpath=/export/mongodb/log/mongod.log

Fork=true

[[Email protected]]# cd/export/mongodb/bin

[[Email protected]]#./mongod-f/export/mongodb/conf/mongod.conf

[[Email protected]]#./mongo--port 20011

>

>

> Showdbs;

Admin (empty)

Local 0.078GB

> useadmin;

Switchedto DB Admin

>db.shutdownserver ()

[Email protected]]# netstat-anlp|grep Mongod

[[Email protected]]#./mongo--port 20011

> Usehelei;

Switchedto DB Helei

>db.t1.insert ({id:1})

Writeresult ({"ninserted": 1})

>db.t1.insert ({id:2});

Writeresult ({"ninserted": 1})

>db.t1.find ()

{"_id": ObjectId ("57033a5eade0255b255b4e22"), "id": 1}

{"_id": ObjectId ("57033a6bade0255b255b4e23"), "id": 2}


This article is from the "Age volt" blog, please make sure to keep this source http://suifu.blog.51cto.com/9167728/1789066

MONGODB Installation Environment Construction

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.