Mongodb在CentOS 6.4下的安装
因为公司今天要用到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
# cat /etc/centos-release
CentOS release 6.4 (Final)
# uname -r
2.6.32-358.el6.x86_64
2、将下载后的二进制通用包上传到指定目录
1
2
3
# ll
total 112060
-rw-r--r--. 1 root root 114747467 Jun32014 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
# 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
# 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
# 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
# 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
# ./mongod
./mongod --help for help and startup options
2014-06-03T10:26:46.715-0400 MongoDB starting : pid=2466 port=27017 dbpath=/data/db 64-bit host=node1.a.org
2014-06-03T10:26:46.716-0400 db version v2.6.1
2014-06-03T10:26:46.716-0400 git version: 4b95b086d2374bdcfcdf2249272fb552c9c726e8
2014-06-03T10:26:46.716-0400 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 allocator: tcmalloc
2014-06-03T10:26:46.716-0400 options: {}
2014-06-03T10:26:46.744-0400 journal dir=/data/db/journal
2014-06-03T10:26:46.745-0400 recover : no journal files present, no recovery needed
2014-06-03T10:26:47.086-0400 preallocateIsFaster=true 4.36
2014-06-03T10:26:47.595-0400 preallocateIsFaster=true 4
2014-06-03T10:26:49.169-0400 preallocateIsFaster=true 6.74
2014-06-03T10:26:49.169-0400 preallocating a journal file /data/db/journal/prealloc.0
2014-06-03T10:26:55.035-0400 File Preallocator Progress: 146800640/1073741824 13%
2014-06-03T10:27:01.880-0400 File Preallocator Progress: 230686720/1073741824 21%
2014-06-03T10:27:05.072-0400 File Preallocator Progress: 346030080/1073741824 32%
2014-06-03T10:27:08.879-0400 File Preallocator Progress: 408944640/1073741824 38%
2014-06-03T10:27:11.875-0400 File Preallocator Progress: 461373440/1073741824 42%
2014-06-03T10:27:17.608-0400 File Preallocator Progress: 503316480/1073741824 46%
2014-06-03T10:27:20.223-0400 File Preallocator Progress: 608174080/1073741824 56%
2014-06-03T10:27:23.542-0400 File Preallocator Progress: 660602880/1073741824 61%
2014-06-03T10:27:26.074-0400 File Preallocator Progress: 702545920/1073741824 65%
2014-06-03T10:27:29.646-0400 File Preallocator Progress: 754974720/1073741824 70%
2014-06-03T10:27:32.058-0400 File Preallocator Progress: 796917760/1073741824 74%
2014-06-03T10:27:37.469-0400 File Preallocator Progress: 817889280/1073741824 76%
2014-06-03T10:27:42.695-0400 File Preallocator Progress: 933232640/1073741824 86%
2014-06-03T10:27:47.057-0400 File Preallocator Progress: 985661440/1073741824 91%
2014-06-03T10:27:57.082-0400 preallocating a journal file /data/db/journal/prealloc.1
2014-06-03T10:28:01.474-0400 File Preallocator Progress: 220200960/1073741824 20%
2014-06-03T10:28:04.394-0400 File Preallocator Progress: 251658240/1073741824 23%
2014-06-03T10:28:10.073-0400 File Preallocator Progress: 283115520/1073741824 26%
2014-06-03T10:28:13.519-0400 File Preallocator Progress: 419430400/1073741824 39%
2014-06-03T10:28:16.335-0400 File Preallocator Progress: 461373440/1073741824 42%
2014-06-03T10:28:20.779-0400 File Preallocator Progress: 492830720/1073741824 45%
2014-06-03T10:28:24.779-0400 File Preallocator Progress: 534773760/1073741824 49%
2014-06-03T10:28:30.009-0400 File Preallocator Progress: 597688320/1073741824 55%
2014-06-03T10:28:33.670-0400 File Preallocator Progress: 660602880/1073741824 61%
2014-06-03T10:28:38.545-0400 File Preallocator Progress: 692060160/1073741824 64%
2014-06-03T10:28:41.378-0400 File Preallocator Progress: 796917760/1073741824 74%
2014-06-03T10:28:44.155-0400 File Preallocator Progress: 838860800/1073741824 78%
2014-06-03T10:28:49.733-0400 File Preallocator Progress: 880803840/1073741824 82%
2014-06-03T10:28:55.421-0400 File Preallocator Progress: 964689920/1073741824 89%
2014-06-03T10:28:59.458-0400 File Preallocator Progress: 1059061760/1073741824 98%
2014-06-03T10:29:12.101-0400 preallocating a journal file /data/db/journal/prealloc.2
2014-06-03T10:29:15.159-0400 File Preallocator Progress: 220200960/1073741824 20%
2014-06-03T10:29:18.199-0400 File Preallocator Progress: 272629760/1073741824 25%
2014-06-03T10:29:21.522-0400 File Preallocator Progress: 325058560/1073741824 30%
2014-06-03T10:29:27.902-0400 File Preallocator Progress: 367001600/1073741824 34%
2014-06-03T10:29:30.465-0400 File Preallocator Progress: 461373440/1073741824 42%
2014-06-03T10:29:33.149-0400 File Preallocator Progress: 482344960/1073741824 44%
2014-06-03T10:29:36.458-0400 File Preallocator Progress: 555745280/1073741824 51%
2014-06-03T10:29:39.057-0400 File Preallocator Progress: 608174080/1073741824 56%
2014-06-03T10:29:45.521-0400 File Preallocator Progress: 650117120/1073741824 60%
2014-06-03T10:29:48.044-0400 File Preallocator Progress: 744488960/1073741824 69%
2014-06-03T10:29:55.217-0400 File Preallocator Progress: 786432000/1073741824 73%
2014-06-03T10:29:58.073-0400 File Preallocator Progress: 901775360/1073741824 83%
2014-06-03T10:30:06.947-0400 File Preallocator Progress: 933232640/1073741824 86%
2014-06-03T10:30:18.879-0400 allocating new datafile /data/db/local.ns, filling with zeroes...
2014-06-03T10:30:18.880-0400 creating directory /data/db/_tmp
2014-06-03T10:30:18.904-0400 done allocating datafile /data/db/local.ns, size: 16MB,took 0.001 secs
2014-06-03T10:30:18.936-0400 allocating new datafile /data/db/local.0, filling with zeroes...
2014-06-03T10:30:18.938-0400 done allocating datafile /data/db/local.0, size: 64MB,took 0.001 secs
2014-06-03T10:30:18.958-0400 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 added index to empty collection
2014-06-03T10:30:18.984-0400 command local.$cmd command: create { create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 numYields:0reslen:37 145ms
2014-06-03T10:30:19.052-0400 waiting for connections on port 27017
2014-06-03T10:31:18.745-0400 mem (MB) res:42 virt:465
2014-06-03T10:31:18.746-0400 mapped (incl journal view):160
2014-06-03T10:31:18.746-0400 connections:0
2014-06-03T10:31:18.776-0400 task: WriteBackManager::cleaner took: 19ms
2014-06-03T10:36:18.943-0400 mem (MB) res:43 virt:465
2014-06-03T10:36:18.943-0400 mapped (incl journal view):160
2014-06-03T10:36:18.943-0400 connections:0
2014-06-03T10:41:19.006-0400 mem (MB) res:43 virt:465
2014-06-03T10:41:19.006-0400 mapped (incl journal view):160
2014-06-03T10:41:19.006-0400 connections:0
2014-06-03T10:46:19.206-0400 mem (MB) res:43 virt:465
2014-06-03T10:46:19.206-0400 mapped (incl journal view):160
2014-06-03T10:46:19.206-0400 connections:0
2014-06-03T10:51:19.262-0400 mem (MB) res:43 virt:465
2014-06-03T10:51:19.262-0400 mapped (incl journal view):160
2014-06-03T10:51:19.262-0400 connections:0
2014-06-03T10:56:19.321-0400 mem (MB) res:43 virt:465
2014-06-03T10:56:19.321-0400 mapped (incl journal view):160
2014-06-03T10:56:19.321-0400 connections:0
2014-06-03T11:01:19.383-0400 mem (MB) res:43 virt:465
2014-06-03T11:01:19.383-0400 mapped (incl journal view):160
2014-06-03T11:01:19.383-0400 connections:0
2014-06-03T11:06:19.444-0400 mem (MB) res:43 virt:465
2014-06-03T11:06:19.444-0400 mapped (incl journal view):160
2014-06-03T11:06:19.444-0400 connections:0
2014-06-03T11:11:19.505-0400 mem (MB) res:43 virt:465
2014-06-03T11:11:19.506-0400 mapped (incl journal view):160
2014-06-03T11:11:19.506-0400 connections:0
2014-06-03T11:16:19.573-0400 mem (MB) res:43 virt:465
2014-06-03T11:16:19.573-0400 mapped (incl journal view):160
2014-06-03T11:16:19.573-0400 connections:0
页:
[1]