您好,登錄后才能下訂單哦!
Centos6.4 x64簡單安裝MongoDB
一、下載MongoDB2.4.9版
下載MongoDB
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.9.tgz
解壓MongoDB
tar -zxvf mongodb-linux-x86_64-2.4.9.tgz -C /usr/src
移動MongoDB目錄
mv /usr/src/mongodb-linux-x86_64-2.4.9 /usr/local/mongodb
二、部署MongoDB
進入MongoDB目錄
cd /usr/local/mongodb
創建數據目錄和日志目錄
mkdir -p /data/mongodb/db
mkdir -p /data/mongodb/log
vi /etc/profile
PATH=$PATH:/usr/local/mongodb/bin
source /etc/profile
以后臺方式啟動MongoDB
mongod --dbpath=/data/mongodb/db --logpath=/data/mongodb/log/mongodb.log --fork
about to fork child process, waiting untilserver is ready for connections.
forked process: 6440
all output going to:/data/mongodb/log/mongodb.log
child process started successfully, parentexiting
設置開機啟動MongoDB
echo "mongod --dbpath=/data/mongodb/db --logpath=/data/mongodb/log/mongodb.log --fork" >> /etc/rc.local
查看是否運行
pgrep mongo -l
6440 mongod
進入數據庫
mongo
MongoDB shell version: 2.4.9
connecting to: 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
>
> show dbs
local 0.078125GB
>exit
bye
查看端口
netstat -nalupt | grep mongo
tcp 0 0 0.0.0.0:28017 0.0.0.0:* LISTEN 6440/mongod
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 6440/mongod
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。