【mongodb】mongodb的安裝
獲取mongodb安裝包解壓
[root@localhost ~]# wget
[monogdb@localhost ~]$ tar xzf mongodb-linux-x86_64-1.8.3-rc0.tgz
建立monogdb的資料存放位置並賦予monogdb相應的許可權。
[root@localhost ~]# cd /opt
[root@localhost opt]# mkdir monogdata
[root@localhost opt]# ls
monogdata oracle software
[root@localhost opt]# chown monogdb:monogdb /opt/monogdata/
[root@localhost opt]# su - monogdb
[monogdb@localhost ~]$ mv mongodb-linux-x86_64-1.8.3-rc0 monogdb
[monogdb@localhost ~]$ cd monogdb/
[monogdb@localhost monogdb]$ cd bin/
[monogdb@localhost bin]$ ./mongod -dbpath /opt/monogdata/data/ --指定monogdb資料存放的位置。並開啟monogdb的服務。
Mon Aug 8 20:45:15 [initandlisten] MongoDB starting : pid=10340 port=27017 dbpath=/opt/monogdata/data/ 64-bit
Mon Aug 8 20:45:15 [initandlisten] db version v1.8.3-rc0, pdfile version 4.5
Mon Aug 8 20:45:15 [initandlisten] git version: 81147c1ca4cc10d9a81a0a2afdf364ab1ca8867d
Mon Aug 8 20:45:15 [initandlisten] build sys info: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41
Mon Aug 8 20:45:15 [initandlisten] waiting for connections on port 27017
Mon Aug 8 20:45:15 [websvr] web admin interface listening on port 28017
Mon Aug 8 20:47:15 [initandlisten] connection accepted from 127.0.0.1:21108 #1
Mon Aug 8 21:16:25 [conn1] end connection 127.0.0.1:21108
在另一個視窗即客戶端
/home/monogdb/monogdb/bin目錄下,執行./mongo 啟動客戶端和服務端連線,並做一些簡單的測試。
[monogdb@localhost bin]$ ./mongo
MongoDB shell version: 1.8.3-rc0
connecting to: test
> db
test
> use test;
switched to db test
> help
db.help() help on db methods
db.mycoll.help() help on collection methods
rs.help() help on replica set methods
help connect connecting to a db help
help admin administrative help
help misc misc things to know
help mr mapreduce help
show dbs show database names
show collections show collections in current database
show users show users in current database
show profile show most recent system.profile entries with time >= 1ms
use set current database
db.foo.find() list objects in collection foo
db.foo.find( { a : 1 } ) list objects in foo where a == 1
it result of the last line evaluated; use to further iterate
DBQuery.shellBatchSize = x set default number of items to display on shell
exit quit the mongo shell
> show dbs
admin (empty)
local (empty)
> show users
> show profile
db.system.profile is empty
Use db.setProfilingLevel(2) will enable profiling
Use db.system.profile.find() to show raw profile entries
> exit
bye
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-704438/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MongoDB的安裝MongoDB
- mongodb 安裝MongoDB
- 安裝mongodbMongoDB
- MongoDB安裝MongoDB
- mongodb 安裝MongoDB
- (翻譯) MongoDB(7) 安裝MongoDBMongoDB
- Mongodb的安裝(一)MongoDB
- Docker安裝mongodbDockerMongoDB
- 【mongodb安裝配置】MongoDB
- MAC 安裝 MongoDBMacMongoDB
- Mac安裝MongoDBMacMongoDB
- mongodb 3.2.0.4安裝MongoDB
- centos安裝mongodbCentOSMongoDB
- 【mongodb】安裝pymongoMongoDB
- MongoDB安裝指南MongoDB
- 【MongoDB】 MongoDB 3.2.x 安裝實踐MongoDB
- 小丸子學MongoDB系列之——安裝MongoDBMongoDB
- mongodb的安裝以及使用MongoDB
- mongodb的安裝配置,使用MongoDB
- MongoDB入門簡介|MongoDB下載安裝|MongoDB語法MongoDB
- 【MongoDB】安裝與配置MongoDB
- MongoDB | Linux 安裝MongoDBLinux
- Windows下安裝MongoDBWindowsMongoDB
- MongoDB安裝配置教程MongoDB
- docker-安裝mongodbDockerMongoDB
- Mac下安裝MongodbMacMongoDB
- MongoDB安裝(Linux)MongoDBLinux
- win10 mongodb安裝教程_win10 mongodb安裝步驟Win10MongoDB
- Ubuntu安裝和解除安裝mongodbUbuntuMongoDB
- Mongodb的下載與安裝MongoDB
- MongoDB的安裝及CURD操作MongoDB
- [MongoDB] MongoDB在El Capitan的安裝除錯詳解MongoDBAPI除錯
- 學習MongoDB 一:MongoDB 入門(安裝與配置)MongoDB
- mac怎麼安裝mongodbMacMongoDB
- MongoDB資料庫安裝MongoDB資料庫
- linux上安裝mongodbLinuxMongoDB
- CentOS7.7安裝mongodbCentOSMongoDB
- mongodb擴充套件安裝MongoDB套件