设为首页 收藏本站
查看: 1721|回复: 0

[经验分享] Mongodb在CentOS 6.4下的安装

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-6-5 09:27:41 | 显示全部楼层 |阅读模式
因为公司今天要用到Mongodb数据库,之前没有接触过,接触更多的都是MySQL;然后去网上找相关的文档教程,大致的看下安装类似于MySQL的安装;本博文借鉴博友的博客,谢谢博友的分享
操作系统:CentOS 6.4 x86-64
软件版本:mongodb-linux-x86_64-2.6.1.tgz
Mongodb官网下载链接地址:http://www.mongodb.org/dr//fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.1.tgz/download

Mongodb概述:
MongoDB是为处理大数据而生的一款面向文档的数据库,由10gen公司开发和维护
NoSQL数据库与传统的关系型数据库相比,它具有操作简单、完全免费、源码公开、随时下载等特点
其实NoSQL,我们大家一定对Redis熟悉吧!它也是NoSQL数据库,是作为缓存数据库系统不二的选择;
1、查看操作系统的版本
1
2
3
4
[iyunv@node1 ~]# cat /etc/centos-release
CentOS release 6.4 (Final)
[iyunv@node1 ~]# uname -r
2.6.32-358.el6.x86_64



2、将下载后的二进制通用包上传到指定目录
1
2
3
[iyunv@node1 src]# ll
total 112060
-rw-r--r--. 1 root root 114747467 Jun  3  2014 mongodb-linux-x86_64-2.6.1.tgz



3、解压该文件到特定目录,并建立软件接
1
2
tar -xf mongodb-linux-x86_64-2.6.1.tgz -C /usr/local
ln -sv mongodb-linux-x86_64-2.6.1 mongodb



4、查看文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[iyunv@node1 mongodb]# tree
.
├── bin
│?? ├── bsondump
│?? ├── mongo
│?? ├── mongod
│?? ├── mongodump
│?? ├── mongoexport
│?? ├── mongofiles
│?? ├── mongoimport
│?? ├── mongooplog
│?? ├── mongoperf
│?? ├── mongorestore
│?? ├── mongos
│?? ├── mongostat
│?? └── mongotop
├── GNU-AGPL-3.0
├── README     #安装前查看
└── THIRD-PARTY-NOTICES
1 directory, 16 files



5、设置mongodb环境变量
1
2
[iyunv@node1 ~]# vim /etc/profile.d/mongodb.sh
export PATH=$PATH:/usr/local/mongodb/bin



6、查看README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[iyunv@node1 mongodb]# cat README
MongoDB README       #MongoDB自述
Welcome to MongoDB!  #欢迎到MongoDB!
COMPONENTS           #组件
  bin/mongod - The database process. #数据库的处理过程
  bin/mongos - Sharding controller.  #分片控制器
  bin/mongo  - The database shell (uses interactive javascript). #数据库shell 使用javascript交互
UTILITIES
  bin/mongodump         - MongoDB dump tool - for backups, snapshots, etc..  # MongoDB转储工具备份,快照,等
  bin/mongorestore      - MongoDB restore a dump                             # MongoDB恢复转储
  bin/mongoexport       - Export a single collection to test (JSON, CSV)     #mongoexport口一个集合测试
  bin/mongoimport       - Import from JSON or CSV                            #把从MongoDB GridFS获取文件实用
  bin/mongofiles        - Utility for putting and getting files from MongoDB GridFS #把从MongoDB GridFS获取文件实用
  bin/mongostat         - Show performance statistics                        #示性能统计
RUNNING
  For command line options invoke:  #命令行选项调用
    $ ./mongod --help  #查看mongod的帮助信息
  To run a single server database:  #运行单个服务器数据库
    $ mkdir /data/db #创建数据库数据文件、临时文件、等这些文件的存储目录
    $ ./mongod    #启动mongodb,首先要初始化数据库,生成指定的文件
    $
    $ # The mongo javascript shell connects to localhost and test database by default:
    $ ./mongo
    > help



7、创建保存数据库的目录
1
[iyunv@node1 ~]# mkdir -pv /data/db



8、启动Mongodb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
[iyunv@node1 bin]# ./mongod
./mongod --help for help and startup options
2014-06-03T10:26:46.715-0400 [initandlisten] MongoDB starting : pid=2466 port=27017 dbpath=/data/db 64-bit host=node1.a.org
2014-06-03T10:26:46.716-0400 [initandlisten] db version v2.6.1
2014-06-03T10:26:46.716-0400 [initandlisten] git version: 4b95b086d2374bdcfcdf2249272fb552c9c726e8
2014-06-03T10:26:46.716-0400 [initandlisten] build info: Linux build14.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-06-03T10:26:46.716-0400 [initandlisten] allocator: tcmalloc
2014-06-03T10:26:46.716-0400 [initandlisten] options: {}
2014-06-03T10:26:46.744-0400 [initandlisten] journal dir=/data/db/journal
2014-06-03T10:26:46.745-0400 [initandlisten] recover : no journal files present, no recovery needed
2014-06-03T10:26:47.086-0400 [initandlisten] preallocateIsFaster=true 4.36
2014-06-03T10:26:47.595-0400 [initandlisten] preallocateIsFaster=true 4
2014-06-03T10:26:49.169-0400 [initandlisten] preallocateIsFaster=true 6.74
2014-06-03T10:26:49.169-0400 [initandlisten] preallocating a journal file /data/db/journal/prealloc.0
2014-06-03T10:26:55.035-0400 [initandlisten]   File Preallocator Progress: 146800640/1073741824 13%
2014-06-03T10:27:01.880-0400 [initandlisten]   File Preallocator Progress: 230686720/1073741824 21%
2014-06-03T10:27:05.072-0400 [initandlisten]   File Preallocator Progress: 346030080/1073741824 32%
2014-06-03T10:27:08.879-0400 [initandlisten]   File Preallocator Progress: 408944640/1073741824 38%
2014-06-03T10:27:11.875-0400 [initandlisten]   File Preallocator Progress: 461373440/1073741824 42%
2014-06-03T10:27:17.608-0400 [initandlisten]   File Preallocator Progress: 503316480/1073741824 46%
2014-06-03T10:27:20.223-0400 [initandlisten]   File Preallocator Progress: 608174080/1073741824 56%
2014-06-03T10:27:23.542-0400 [initandlisten]   File Preallocator Progress: 660602880/1073741824 61%
2014-06-03T10:27:26.074-0400 [initandlisten]   File Preallocator Progress: 702545920/1073741824 65%
2014-06-03T10:27:29.646-0400 [initandlisten]   File Preallocator Progress: 754974720/1073741824 70%
2014-06-03T10:27:32.058-0400 [initandlisten]   File Preallocator Progress: 796917760/1073741824 74%
2014-06-03T10:27:37.469-0400 [initandlisten]   File Preallocator Progress: 817889280/1073741824 76%
2014-06-03T10:27:42.695-0400 [initandlisten]   File Preallocator Progress: 933232640/1073741824 86%
2014-06-03T10:27:47.057-0400 [initandlisten]   File Preallocator Progress: 985661440/1073741824 91%
2014-06-03T10:27:57.082-0400 [initandlisten] preallocating a journal file /data/db/journal/prealloc.1
2014-06-03T10:28:01.474-0400 [initandlisten]   File Preallocator Progress: 220200960/1073741824 20%
2014-06-03T10:28:04.394-0400 [initandlisten]   File Preallocator Progress: 251658240/1073741824 23%
2014-06-03T10:28:10.073-0400 [initandlisten]   File Preallocator Progress: 283115520/1073741824 26%
2014-06-03T10:28:13.519-0400 [initandlisten]   File Preallocator Progress: 419430400/1073741824 39%
2014-06-03T10:28:16.335-0400 [initandlisten]   File Preallocator Progress: 461373440/1073741824 42%
2014-06-03T10:28:20.779-0400 [initandlisten]   File Preallocator Progress: 492830720/1073741824 45%
2014-06-03T10:28:24.779-0400 [initandlisten]   File Preallocator Progress: 534773760/1073741824 49%
2014-06-03T10:28:30.009-0400 [initandlisten]   File Preallocator Progress: 597688320/1073741824 55%
2014-06-03T10:28:33.670-0400 [initandlisten]   File Preallocator Progress: 660602880/1073741824 61%
2014-06-03T10:28:38.545-0400 [initandlisten]   File Preallocator Progress: 692060160/1073741824 64%
2014-06-03T10:28:41.378-0400 [initandlisten]   File Preallocator Progress: 796917760/1073741824 74%
2014-06-03T10:28:44.155-0400 [initandlisten]   File Preallocator Progress: 838860800/1073741824 78%
2014-06-03T10:28:49.733-0400 [initandlisten]   File Preallocator Progress: 880803840/1073741824 82%
2014-06-03T10:28:55.421-0400 [initandlisten]   File Preallocator Progress: 964689920/1073741824 89%
2014-06-03T10:28:59.458-0400 [initandlisten]   File Preallocator Progress: 1059061760/1073741824 98%
2014-06-03T10:29:12.101-0400 [initandlisten] preallocating a journal file /data/db/journal/prealloc.2
2014-06-03T10:29:15.159-0400 [initandlisten]   File Preallocator Progress: 220200960/1073741824 20%
2014-06-03T10:29:18.199-0400 [initandlisten]   File Preallocator Progress: 272629760/1073741824 25%
2014-06-03T10:29:21.522-0400 [initandlisten]   File Preallocator Progress: 325058560/1073741824 30%
2014-06-03T10:29:27.902-0400 [initandlisten]   File Preallocator Progress: 367001600/1073741824 34%
2014-06-03T10:29:30.465-0400 [initandlisten]   File Preallocator Progress: 461373440/1073741824 42%
2014-06-03T10:29:33.149-0400 [initandlisten]   File Preallocator Progress: 482344960/1073741824 44%
2014-06-03T10:29:36.458-0400 [initandlisten]   File Preallocator Progress: 555745280/1073741824 51%
2014-06-03T10:29:39.057-0400 [initandlisten]   File Preallocator Progress: 608174080/1073741824 56%
2014-06-03T10:29:45.521-0400 [initandlisten]   File Preallocator Progress: 650117120/1073741824 60%
2014-06-03T10:29:48.044-0400 [initandlisten]   File Preallocator Progress: 744488960/1073741824 69%
2014-06-03T10:29:55.217-0400 [initandlisten]   File Preallocator Progress: 786432000/1073741824 73%
2014-06-03T10:29:58.073-0400 [initandlisten]   File Preallocator Progress: 901775360/1073741824 83%
2014-06-03T10:30:06.947-0400 [initandlisten]   File Preallocator Progress: 933232640/1073741824 86%
2014-06-03T10:30:18.879-0400 [FileAllocator] allocating new datafile /data/db/local.ns, filling with zeroes...
2014-06-03T10:30:18.880-0400 [FileAllocator] creating directory /data/db/_tmp
2014-06-03T10:30:18.904-0400 [FileAllocator] done allocating datafile /data/db/local.ns, size: 16MB,  took 0.001 secs
2014-06-03T10:30:18.936-0400 [FileAllocator] allocating new datafile /data/db/local.0, filling with zeroes...
2014-06-03T10:30:18.938-0400 [FileAllocator] done allocating datafile /data/db/local.0, size: 64MB,  took 0.001 secs
2014-06-03T10:30:18.958-0400 [initandlisten] build index on: local.startup_log properties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "local.startup_log" }
2014-06-03T10:30:18.958-0400 [initandlisten]   added index to empty collection
2014-06-03T10:30:18.984-0400 [initandlisten] command local.$cmd command: create { create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 numYields:0  reslen:37 145ms
2014-06-03T10:30:19.052-0400 [initandlisten] waiting for connections on port 27017
2014-06-03T10:31:18.745-0400 [clientcursormon] mem (MB) res:42 virt:465
2014-06-03T10:31:18.746-0400 [clientcursormon]  mapped (incl journal view):160
2014-06-03T10:31:18.746-0400 [clientcursormon]  connections:0
2014-06-03T10:31:18.776-0400 [PeriodicTaskRunner] task: WriteBackManager::cleaner took: 19ms
2014-06-03T10:36:18.943-0400 [clientcursormon] mem (MB) res:43 virt:465
2014-06-03T10:36:18.943-0400 [clientcursormon]  mapped (incl journal view):160
2014-06-03T10:36:18.943-0400 [clientcursormon]  connections:0
2014-06-03T10:41:19.006-0400 [clientcursormon] mem (MB) res:43 virt:465
2014-06-03T10:41:19.006-0400 [clientcursormon]  mapped (incl journal view):160
2014-06-03T10:41:19.006-0400 [clientcursormon]  connections:0
2014-06-03T10:46:19.206-0400 [clientcursormon] mem (MB) res:43 virt:465
2014-06-03T10:46:19.206-0400 [clientcursormon]  mapped (incl journal view):160
2014-06-03T10:46:19.206-0400 [clientcursormon]  connections:0
2014-06-03T10:51:19.262-0400 [clientcursormon] mem (MB) res:43 virt:465
2014-06-03T10:51:19.262-0400 [clientcursormon]  mapped (incl journal view):160
2014-06-03T10:51:19.262-0400 [clientcursormon]  connections:0
2014-06-03T10:56:19.321-0400 [clientcursormon] mem (MB) res:43 virt:465
2014-06-03T10:56:19.321-0400 [clientcursormon]  mapped (incl journal view):160
2014-06-03T10:56:19.321-0400 [clientcursormon]  connections:0
2014-06-03T11:01:19.383-0400 [clientcursormon] mem (MB) res:43 virt:465
2014-06-03T11:01:19.383-0400 [clientcursormon]  mapped (incl journal view):160
2014-06-03T11:01:19.383-0400 [clientcursormon]  connections:0
2014-06-03T11:06:19.444-0400 [clientcursormon] mem (MB) res:43 virt:465
2014-06-03T11:06:19.444-0400 [clientcursormon]  mapped (incl journal view):160
2014-06-03T11:06:19.444-0400 [clientcursormon]  connections:0
2014-06-03T11:11:19.505-0400 [clientcursormon] mem (MB) res:43 virt:465
2014-06-03T11:11:19.506-0400 [clientcursormon]  mapped (incl journal view):160
2014-06-03T11:11:19.506-0400 [clientcursormon]  connections:0
2014-06-03T11:16:19.573-0400 [clientcursormon] mem (MB) res:43 virt:465
2014-06-03T11:16:19.573-0400 [clientcursormon]  mapped (incl journal view):160
2014-06-03T11:16:19.573-0400 [clientcursormon]  connections:0



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-20198-1-1.html 上篇帖子: mongodb 常用优化方式 下篇帖子: 使用MMS可视化监控MongoDB服务器
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表