標籤:資料庫 記錄 下載安裝 2014
最近工作終於到了使用mongodb,以前從來沒有接觸過mongodb,只知道它屬於nosql類型的資料庫,這裡將安裝記錄如下:
1、到官網下載安裝檔案:
這裡下載版本為:mongodb-linux-x86_64-2.6.6.gz
[[email protected] tools]# ll mongodb-linux-x86_64-2.6.6.gz
-rw-r--r-- 1 root root 116039527 Dec 23 2014 mongodb-linux-x86_64-2.6.6.gz
[[email protected] tools]# tar xf mongodb-linux-x86_64-2.6.6.gz
[[email protected] tools]# ll mongodb-linux-x86_64-2.6.6*
-rw-r--r-- 1 root root 116039527 Dec 23 2014 mongodb-linux-x86_64-2.6.6.gz
mongodb-linux-x86_64-2.6.6:
total 64
drwxr-xr-x 2 root root 4096 Jul 22 02:48 bin
-rw-r--r-- 1 1046 1046 34520 Dec 8 2014 GNU-AGPL-3.0
-rw-r--r-- 1 1046 1046 1359 Dec 8 2014 README
-rw-r--r-- 1 1046 1046 17793 Dec 8 2014 THIRD-PARTY-NOTICES
[[email protected] tools]#
[[email protected] tools]# mv mongodb-linux-x86_64-2.6.6 /usr/local/mongodb
[[email protected] tools]# cd /usr/local/mongodb/
[[email protected] mongodb]# pwd
/usr/local/mongodb
[[email protected] mongodb]#
2、定義設定檔:
[[email protected] mongodb]# mkdir conf
[[email protected] mongodb]# cd conf
[[email protected] conf]# vim mongodb.conf
port = 30000
bind_ip = 192.168.19.25
dbpath = /data/mongo/data/db
logpath = /data/mongo/data/log/log
logappend = true
fork = true
pidfilepath = /data/mongo/data/mongod.pid
[[email protected] conf]#
[[email protected] conf]# mkdir -p /data/mongo/data/
[[email protected] conf]# mkdir -p /data/mongo/data/log
[[email protected] conf]# mkdir -p /data/mongo/data/db
設定檔解釋:
#port = 30000 監聽連接埠
#bind_ip = 192.168.19.25 在哪個ip地址上啟動
#dbpath = /data/mongo/data/db 定義資料庫檔案路徑
#logpath = /data/mongo/data/log/log 定義日誌存放路徑
#logappend = true 定義日誌存放方式
#fork = true 定義mongodb進程啟動方式,這裡以守護進程方式啟動
#pidfilepath = /data/mongo/data/mongod.pi 定義進程pid檔案存放路徑
3、添加環境變數:
[[email protected] mongodb]# cd bin/
[[email protected] bin]# pwd
/usr/local/mongodb/bin
[[email protected] bin]# vim /etc/profile
export PATH=/usr/local/mongodb/bin:$PATH
[[email protected] bin]# source /etc/profile
[[email protected] bin]#
4、啟動mongodb
[[email protected] bin]# mongod -f /usr/local/mongodb/conf/mongodb.conf
about to fork child process, waiting until server is ready for connections.
forked process: 1735
child process started successfully, parent exiting
[[email protected] bin]#
[[email protected] bin]# netstat -lnput|grep mongo
tcp 0 0 192.168.19.25:30000 0.0.0.0:* LISTEN 1735/mongod
[[email protected] bin]#
[[email protected] ~]# mongo --host 192.168.19.25 --port 30000
MongoDB shell version: 2.6.6
connecting to: 192.168.19.25:30000/test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
>
出現以上介面表示mongo安裝成功,至此mongo安裝完畢,至於一些常用命令可以到/usr/local/mongo/bin目錄下查看,
[[email protected] ~]# cd /usr/local/mongodb/bin/
[[email protected] bin]# ll
total 283568
-rwxr-xr-x 1 1046 1046 23603184 Dec 8 2014 bsondump
-rwxr-xr-x 1 1046 1046 11900240 Dec 8 2014 mongo
-rwxr-xr-x 1 1046 1046 23773296 Dec 8 2014 mongod
-rwxr-xr-x 1 1046 1046 23676016 Dec 8 2014 mongodump
-rwxr-xr-x 1 1046 1046 23619312 Dec 8 2014 mongoexport
-rwxr-xr-x 1 1046 1046 23667776 Dec 8 2014 mongofiles
-rwxr-xr-x 1 1046 1046 23644016 Dec 8 2014 mongoimport
-rwxr-xr-x 1 1046 1046 23614480 Dec 8 2014 mongooplog
-rwxr-xr-x 1 1046 1046 23424896 Dec 8 2014 mongoperf
-rwxr-xr-x 1 1046 1046 23713104 Dec 8 2014 mongorestore
-rwxr-xr-x 1 1046 1046 18433232 Dec 8 2014 mongos
-rwxr-xr-x 1 1046 1046 23663984 Dec 8 2014 mongostat
-rwxr-xr-x 1 1046 1046 23607088 Dec 8 2014 mongotop
[[email protected] bin]#
本文出自 “平平淡淡才是真” 部落格,請務必保留此出處http://ucode.blog.51cto.com/10837891/1828805
mongodb的安裝