【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
- 安裝mongodbMongoDB
- mongodb 安裝MongoDB
- MongoDB | Linux 安裝MongoDBLinux
- 【mongodb安裝配置】MongoDB
- MAC 安裝 MongoDBMacMongoDB
- Docker安裝mongodbDockerMongoDB
- mongodb的安裝以及使用MongoDB
- Windows下安裝MongoDBWindowsMongoDB
- Mac下安裝MongodbMacMongoDB
- MongoDB安裝配置教程MongoDB
- docker-安裝mongodbDockerMongoDB
- 【MongoDB】安裝與配置MongoDB
- linux上安裝mongodbLinuxMongoDB
- win10 mongodb安裝教程_win10 mongodb安裝步驟Win10MongoDB
- Ubuntu安裝和解除安裝mongodbUbuntuMongoDB
- MongoDB資料庫安裝MongoDB資料庫
- MongoDB下載與安裝MongoDB
- docker安裝mongoDB及使用DockerMongoDB
- Mac 安裝與配置mongodbMacMongoDB
- mac怎麼安裝mongodbMacMongoDB
- mongodb擴充套件安裝MongoDB套件
- CentOS7.7安裝mongodbCentOSMongoDB
- ubuntu透過安裝包安裝MongodbUbuntuMongoDB
- 快速掌握mongoDB(一)——mongoDB安裝部署和常用shell命令MongoDB
- mongodb macos 下的安裝和使用MongoDBMac
- mongodb的安裝和啟動方法MongoDB
- MongoDB日常運維-02安裝MongoDB運維
- 如何在 Ubuntu 上安裝 MongoDBUbuntuMongoDB
- CentOS7.2 安裝 MongoDB 3.4CentOSMongoDB
- windows安裝mongodb詳細教程WindowsMongoDB
- windows 下 MongoDB 的安裝與啟動WindowsMongoDB
- python資料庫-MongoDB的安裝(53)Python資料庫MongoDB
- MongoDB4.4.2版本的安裝MongoDB
- Homestead 安裝 MongoDB 以及擴充套件!MongoDB套件
- 如何安裝MongoDB併成功啟動MongoDB
- MongoDB基本介紹與安裝(1)MongoDB
- CentOS 7快速安裝Mongodb詳解CentOSMongoDB
- Mongodb安裝坑 - Service 'MongoDB Server' (MongDB) failed to start. Verify that you have...MongoDBServerAI