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$

MongoDB的安装配置的更多相关文章

  1. MongoDB的安装配置、基本操作及Perl操作MongoDB

    MongoDB的安装配置.基本操作及Perl操作MongoDB http://www.myhack58.com/Article/60/63/2014/42353.htm

  2. Linux环境下NodeJS和MongoDB的安装配置

     一.NodeJS的安装配置 #进入安装目录cd /usr/local/ #删除原有安装rm -rf noderm -rf node-v0.10.29-linux-x64 #解压压缩包tar -zxv ...

  3. MongoDB下载+安装+配置+错误解决方法

    下载 官网下载: https://www.mongodb.com/download-center/community Server=>Download 安装 下载完成后安装 建议下载根目录(下过 ...

  4. MongoDB(二)——安装配置了解

    前边介绍了MongoDB的大概理论知识,这篇来对MongoDB进行一下安装使用,支持安装在windows和linux上,当然了很多其它情况下我们是安装在linux上,由于毕竟server用linux的 ...

  5. MongoDB Linux 安装配置 后台运行

    介绍安装的文档很多,可以参考这篇: http://www.mkyong.com/mongodb/how-to-install-mongodb-on-mac-os-x/ 安装完后你可能会碰到的2个问题. ...

  6. mongodb window安装配置

    下载mongodb安装包 1. https://www.mongodb.org/dl/win32/x86_64-2008plus-ssl?_ga=2.233271640.711265466.15193 ...

  7. PHP MongoDB 扩展安装配置

    近日对MongoDB比较感兴趣,在linux下部署了一套LAMP,想把MongoDB加进来,下面进入正题: 1.确保安装好LAMP环境,假设php安装目录:/usr/local/php5 2.下载ht ...

  8. mongodb的安装配置方法

    安装方法: https://docs.mongodb.com/manual/tutorial/install-mongodb-enterprise-on-red-hat/ 使用向导: https:// ...

  9. Linux下安装配置MongoDB 3.0.x 版本数据库

    说明: 操作系统:CentOS 5.X 64位 IP地址:192.168.21.128 实现目的: 安装配置MongoDB数据库 具体操作: 一.关闭SElinux.配置防火墙 1.vi /etc/s ...

随机推荐

  1. js实现ppt

    实现ppt的js框架有很多,这里推荐几个: impress.js      impress.js demo webSlide.js    webSlide.js demo reveal.js      ...

  2. 代码实现获取log日志和logcat使用方法

    代码实现获取log日志new Thread(new Runnable() {                        @Override                        publi ...

  3. struct TABLE_SHARE

    struct TABLE_SHARE { TABLE_SHARE() {} /* Remove gcc warning */ /** Category of this table. */ TABLE_ ...

  4. UVa 10892 (GCD) LCM Cardinality

    我一直相信这道题有十分巧妙的解法的,去搜了好多题解发现有的太过玄妙不能领会. 最简单的就是枚举n的所有约数,然后二重循环找lcm(a, b) = n的个数 #include <cstdio> ...

  5. UVa 1638 (递推) Pole Arrangement

    很遗憾,这么好的一道题,自己没想出来,也许太心急了吧. 题意: 有长度为1.2.3...n的n个杆子排成一行.问从左到右看能看到l个杆子,从右往左看能看到r个杆子,有多少种排列方法. 分析: 设状态d ...

  6. 求双连通分量的详解。(根据刘汝佳的训练指南p314)

    无向图的双连通分量 点-双连通图:一个连通的无向图内部没有割点,那么该图是点-双连通图.         注意:孤立点,以及两点一边这两种图都是点-双连通的.因为它们都是内部无割点. 边-双连通图:一 ...

  7. VirtualBox的工作原理&参考网上文章

    事先申明,我这里有好多东西都是看网上的,文末给出参考博客链接. 1.在设置里面为什么要选择桥接网络?baidu之后,了解到是虚拟机工作原理的不同,也就是说有好几种工作模式. bridged(桥接模式) ...

  8. erlang 线上分析工具集锦

    1.Recon-Erlang线上系统诊断工具(引自): Erlang系统素以稳定可靠闻名,但是它也是c实现的,也是要管理比如内存,锁等等复杂的事情,也会出现Crash,而且crash的时候大部分原因是 ...

  9. 【WEB小工具】EncodingFilter—设置全局编码

    1.我们知道,如果是POST请求,我们需要调用request.setCharacterEncoding("utf-8") 方法来设计编码. public void doGet(Ht ...

  10. 常用UI布局

    1.LinearLayout(线性布局):将布局所包含的控件在线性方向上依次排列. <1>android:orientation 指定了排列方向(垂直方向(vertical).水平方向(h ...