MongoDB的安装配置
1,下载:http://www.mongodb.org/downloads2.4.5版:http://www.mongodb.org/dr/fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.5.tgz/download2,解压:hadoop@hadoopmaster:~/nosql$ tar zxvf mongodb-lin
·
1,下载:
http://www.mongodb.org/downloads
2.4.5版:http://www.mongodb.org/dr/fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.5.tgz/download
2,解压:
hadoop@hadoopmaster:~/nosql$ tar zxvf mongodb-linux-x86_64-2.4.5\ \(1\).tgz
mongodb-linux-x86_64-2.4.5/README
mongodb-linux-x86_64-2.4.5/THIRD-PARTY-NOTICES
mongodb-linux-x86_64-2.4.5/GNU-AGPL-3.0
mongodb-linux-x86_64-2.4.5/bin/mongodump
mongodb-linux-x86_64-2.4.5/bin/mongorestore
mongodb-linux-x86_64-2.4.5/bin/mongoexport
mongodb-linux-x86_64-2.4.5/bin/mongoimport
mongodb-linux-x86_64-2.4.5/bin/mongostat
mongodb-linux-x86_64-2.4.5/bin/mongotop
mongodb-linux-x86_64-2.4.5/bin/mongooplog
mongodb-linux-x86_64-2.4.5/bin/mongofiles
mongodb-linux-x86_64-2.4.5/bin/bsondump
mongodb-linux-x86_64-2.4.5/bin/mongoperf
mongodb-linux-x86_64-2.4.5/bin/mongosniff
mongodb-linux-x86_64-2.4.5/bin/mongod
mongodb-linux-x86_64-2.4.5/bin/mongos
mongodb-linux-x86_64-2.4.5/bin/mongo
hadoop@hadoopmaster:~/nosql$ ls
3,创建目录用来存放数据和log日志
hadoop@hadoopmaster:~/nosql/mongodb-linux-x86_64-2.4.5$ ls
bin GNU-AGPL-3.0 README THIRD-PARTY-NOTICES
hadoop@hadoopmaster:~/nosql/mongodb-linux-x86_64-2.4.5$ mkdir data
hadoop@hadoopmaster:~/nosql/mongodb-linux-x86_64-2.4.5$ mkdir log
hadoop@hadoopmaster:~/nosql/mongodb-linux-x86_64-2.4.5$
hadoop@hadoopmaster:~/nosql/mongodb-linux-x86_64-2.4.5$ cd log/
hadoop@hadoopmaster:~/nosql/mongodb-linux-x86_64-2.4.5/log$ touch mongodb.log
4,启动
①:使用mongod命令建立一个mongodb数据库链接,
hadoop@hadoopmaster:~/nosql/mongodb-linux-x86_64-2.4.5/bin$ ./mongod -dbpath ../data/ --logpath ../log/mongodb.log
all output going to: /home/hadoop/nosql/mongodb-linux-x86_64-2.4.5/bin/../log/mongodb.log
log file [/home/hadoop/nosql/mongodb-linux-x86_64-2.4.5/bin/../log/mongodb.log] exists; copied to temporary file [/home/hadoop/nosql/mongodb-linux-x86_64-2.4.5/bin/../log/mongodb.log.2013-08-17T05-36-47]
数据库的路径为/mongodb/data,
日志路径为/mongodb/log/mongodb.log
也可以通过port指定端口号如:- -port=10000
通过接上fork参数在后台启动: --fork
5,连接:
hadoop@hadoopmaster:~/nosql/mongodb-linux-x86_64-2.4.5/bin$ ./mongo 127.0.0.1:10000
MongoDB shell version: 2.4.5
connecting to: 127.0.0.1:10000/test
> dbsdbs
Sat Aug 17 13:42:15.699 JavaScript execution failed: ReferenceError: dbs is not defined
> dbdb
test
> show collectionsshow collections
>
6,配置文件的方式启动:
配置:
hadoop@hadoopmaster:~/nosql/mongodb-linux-x86_64-2.4.5$ more mongodb.conf
port=10000
dbpath=data/
logpath=log/mongodb.log
logappend=true
fork=true
hadoop@hadoopmaster:~/nosql/mongodb-linux-x86_64-2.4.5$
启动:
hadoop@hadoopmaster:~/nosql/mongodb-linux-x86_64-2.4.5$ ./bin/mongod -f ./mongodb.conf
about to fork child process, waiting until server is ready for connections.
forked process: 4120
all output going to: /home/hadoop/nosql/mongodb-linux-x86_64-2.4.5/log/mongodb.log
child process started successfully, parent exiting
hadoop@hadoopmaster:~/nosql/mongodb-linux-x86_64-2.4.5$
更多推荐
已为社区贡献1条内容
所有评论(0)