找传奇、传世资源到传世资源站!

mongodb实战.pdf

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈


from clipboard
目录
第一部分 基础篇 ............................................................................................................................ 5
第一章 走进 MongoDB ........................................................................................................... 5
1.1 为什么要用 NoSQL ................................................................................................... 6
1.1.1 NoSQL 简介 ..................................................................................................... 6
1.1.2 发展现状 ........................................................................................................ 6
1.1.3 为什么是 NoSQL ............................................................................................ 6
1.1.4 NoSQL 特点 ..................................................................................................... 8
1.2 初识 MongoDB .......................................................................................................... 8
1.2.1 特点 ................................................................................................................ 9
1.2.2 功能 ................................................................................................................ 9
1.2.3 适用场合 ...................................................................................................... 10
第二章 安装和配置 .............................................................................................................. 10
2.1 Windows 平台的安装 .............................................................................................. 11
2.2 Linux 平台的安装 ..................................................................................................... 12
第三章 体系结构 .................................................................................................................. 13
3.1 数据逻辑结构 ......................................................................................................... 13
3.2 数据存储结构 ......................................................................................................... 14
第四章 快速入门 .................................................................................................................. 16
4.1 启动数据库 ............................................................................................................. 16
4.1.1 命令行方式启动 .......................................................................................... 16
4.1.2 配置文件方式启动 ...................................................................................... 17
4.1.3 Daemon 方式启动 ......................................................................................... 17
4.1.4 mongod 参数说明 ......................................................................................... 18
4.2 停止数据库 ............................................................................................................. 19
4.2.1 Control-C ........................................................................................................ 19
4.2.2 shutdownServer()指令 .................................................................................. 19
4.2.3 Unix 系统指令 ............................................................................................... 20
4.3 连接数据库 ............................................................................................................. 20
4.4 插入记录 ................................................................................................................. 20
4.5 _id key ....................................................................................................................... 21
4.6 查询记录 ................................................................................................................. 22
4.6.1 普通查询 ...................................................................................................... 22
4.6.2 条件查询 ...................................................................................................... 23
4.6.3 findOne()语法 ................................................................................................ 24
4.6.4 通过 limit 限制结果集数量 ......................................................................... 24
4.7 修改记录 ................................................................................................................. 24
4.8 删除记录 ................................................................................................................. 24
4.9 常用工具集 .............................................................................................................. 25
4.10 客户端 GUI 工具 ................................................................................................... 25
4.10.1 MongoVUE ................................................................................................... 25
4.10.2 RockMongo .................................................................................................. 26 
 3 / 91
4.10.3 MongoHub ................................................................................................... 27
第二部分 应用篇 .......................................................................................................................... 27
第五章 高级查询 .................................................................................................................. 27
5.1 条件操作符 ............................................................................................................. 28
5.1 条件操作符 ..................................................................................................... 28
5.2 $all 匹配所有.................................................................................................... 28
5.3 $exists 判断字段是否存在 .............................................................................. 28
5.4 Null 值处理 ....................................................................................................... 29
5.5 $mod 取模运算 ................................................................................................ 29
5.6 $ne 不等于 ....................................................................................................... 30
5.7 $in 包含 ............................................................................................................ 30
5.8 $nin 不包含 ...................................................................................................... 30
5.9 $size 数组元素个数 ......................................................................................... 31
5.10 正则表达式匹配 ........................................................................................... 31
5.11 Javascript 查询和$where 查询 ...................................................................... 32
5.12 count 查询记录条数 ...................................................................................... 32
5.13 skip 限制返回记录的起点 ............................................................................. 32
5.14 sort 排序 ......................................................................................................... 33
5.2 游标 ......................................................................................................................... 33
5.3 存储过程 ................................................................................................................. 34
第六章 Capped Collection ..................................................................................................... 35
6.1 简单介绍 ................................................................................................................. 35
6.2 功能特点 ................................................................................................................. 35
6.3 常见用处 ................................................................................................................. 35
6.4 推荐用法 ................................................................................................................. 35
6.5 注意事项 ................................................................................................................. 35
第七章 GridFS ........................................................................................................................ 36
7.1 为什么要用 GridFS .................................................................................................. 36
7.2 如何实现海量存储 ................................................................................................. 36
7.3 语言支持 ................................................................................................................. 36
7.4 简单介绍 ................................................................................................................. 36
7.5 命令行工具 ............................................................................................................. 37
7.6 索引 ......................................................................................................................... 38
第八章 MapReduce ............................................................................................................... 38
8.1 Map ........................................................................................................................... 39
8.2 Reduce ...................................................................................................................... 40
8.3 Result ........................................................................................................................ 40
8.4 Finalize ...................................................................................................................... 41
8.5 Options ..................................................................................................................... 41
第三部分 管理篇 .......................................................................................................................... 42
第九章 数据导出 mongoexport .......................................................................................... 42
9.1 常用导出方法 ......................................................................................................... 42
9.2 导出 CSV 格式的文件 ............................................................................................. 43
第十章 数据导入 mongoimport ........................................................................................... 43 
 4 / 91
10.1 导入 JSON 数据 ..................................................................................................... 43
10.2 导入 CSV 数据 ....................................................................................................... 44
第十一章 数据备份 mongodump ........................................................................................ 44
第十二章 数据恢复 mongorestore ...................................................................................... 45
第十三章 访问控制 .............................................................................................................. 45
13.1 绑定 IP 内网地址访问 MongoDB 服务 ................................................................ 46
13.2 设置监听端口 ....................................................................................................... 46
13.3 使用用户名和口令登录 ....................................................................................... 46
第十四章 命令行操作 .......................................................................................................... 49
14.1 通过 eval 参数执行指定语句 ............................................................................... 49
14.2 执行指定文件中的内容 ....................................................................................... 49
第十五章 进程控制 .............................................................................................................. 50
15.1 查看活动进程 ....................................................................................................... 50
15.2 结束进程 ............................................................................................................... 50
第四部分 性能篇 .......................................................................................................................... 51
第十六章 索引 ...................................................................................................................... 51
16.1 基础索引 ............................................................................................................... 51
16.2 文档索引 ............................................................................................................... 52
16.3 组合索引 ............................................................................................................... 52
16.4 唯一索引 ............................................................................................................... 52
16.5 强制使用索引 ....................................................................................................... 53
16.6 删除索引 ............................................................................................................... 54
第十七章 explain 执行计划 .................................................................................................. 54
第十八章 优化器 profile ....................................................................................................... 55
18.1 开启 Profiling 功能 .............................................................................................. 55
18.2 查询 Profiling 记录 .............................................................................................. 55
第十九章 性能优化 .............................................................................................................. 56
19.1 优化方案 1: 创建索引 ......................................................................................... 56
19.2 优化方案 2: 限定返回结果条数 ......................................................................... 56
19.3 优化方案 3: 只查询使用到的字段,而不查询所有字段 ................................. 57
19.4 优化方案 4: 采用 capped collection .................................................................... 57
19.5 优化方案 5: 采用 Server Side Code Execution .................................................... 57
19.6 优化方案 6: Hint ................................................................................................... 57
19.7 优化方案 7: 采用 Profiling ................................................................................... 57
第二十章 性能监控 .............................................................................................................. 58
20.1 mongosniff .............................................................................................................. 58
20.2 Mongostat ............................................................................................................... 59
20.3 db.serverStatus ....................................................................................................... 59
20.4 db.stats ................................................................................................................... 61
20.5 第三方工具 ........................................................................................................... 61
第五部分 架构篇 .......................................................................................................................... 62
第二十一章 Replica Sets 复制集 .......................................................................................... 62
21.1 部署 Replica Sets ................................................................................................... 62
21.2 主从操作日志 oplog ............................................................................................. 66
 5 / 91
21.3 主从配置信息 ....................................................................................................... 67
21.4 管理维护 Replica Sets ........................................................................................... 68
21.4.1 读写分离 .................................................................................................... 68
21.4.2 故障转移 .................................................................................................... 68
21.4.3 增减节点 .................................................................................................... 70
第二十二章 Sharding 分片 ................................................................................................... 76
22.1 启动 Shard Server .................................................................................................. 77
22.2 启动 Config Server................................................................................................. 77
22.3 启动 Route Process ............................................................................................... 77
22.4 配置 Sharding ........................................................................................................ 78
22.5 验证 Sharding 正常工作 ....................................................................................... 78
22.6 管理维护 Sharding ................................................................................................ 80
22.6.1 列出所有的 Shard Server ........................................................................... 80
22.6.2 查看 Sharding 信息 .................................................................................... 80
22.6.3 判断是否是 Sharding ................................................................................. 81
22.6.4 对现有的表进行 Sharding ......................................................................... 81
22.6.5 新增 Shard Server ....................................................................................... 82
22.6.6 移除 Shard Server ....................................................................................... 84
第二十三章 Replica Sets Sharding ..................................................................................... 86
23.1 创建数据目录 ....................................................................................................... 87
23.2 配置 Replica Sets ................................................................................................... 88
23.2.1 配置 shard1 所用到的 Replica Sets ........................................................... 88
23.2.2 配置 shard2 所用到的 Replica Sets ........................................................... 89
23.3 配置 3 台 Config Server......................................................................................... 90
23.4 配置 3 台 Route Process ....................................................................................... 90
23.5 配置 Shard Cluster ................................................................................................. 90
23.6 验证 Sharding 正常工作 ....................................................................................... 91

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复