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