
mongodb
huyangg
这个作者很懒,什么都没留下…
-
原创 Data Model Design
Data Model DesignOn this pageEmbedded Data ModelsNormalized Data ModelsAdditional ResourcesEffective data models support your application needs. The key consideration for the str2017-12-08 11:14:16150
0
-
转载 MongoDB数据建模小案例:多列数据结构
需求需求是基于电影票售卖的不同渠道价格存储。某一个场次的电影,不同的销售渠道对应不同的价格。整理需求为:数据字段:场次信息;播放影片信息;渠道信息,与其对应的价格;渠道数量最多几十个;业务查询有两种:根据电影场次,查询某一个渠道的价格;根据渠道信息,查询对应的所有场次信息;建模不好的我们先来看其中一种典型的不好建模设计2017-12-12 11:02:40609
0
-
转载 云数据库MongoDB为什么需要限制连接数?
连接是要消耗资源的,而且消耗的并不少。内存:MongoDB为例,每个线程都要分配1MB的栈内存出来。1000个连接,1G内存就这么没了,甭管是否是活跃连接文件句柄:每个连接都要打开一个文件句柄,当然从成本上讲,这个消耗相对内存是小了很多。但换个角度,文件句柄也被其他模块消耗着,比如WT存储引擎,就需要消耗大量的文件句柄是否真的需要这么多的链接,一般的业务场景下请求压力在10002017-12-12 11:12:07663
0
-
转载 MongoDB索引原理
MongoDB索引原理为什么需要索引?当你抱怨MongoDB集合查询效率低的时候,可能你就需要考虑使用索引了,为了方便后续介绍,先科普下MongoDB里的索引机制(同样适用于其他的数据库比如mysql)。mongo-9552:PRIMARY> db.person.find(){ "_id" : ObjectId("571b5da31b0d530a03b3ce82"), "na2017-12-12 16:49:41166
0
-
原创 SQL to MongoDB Mapping Chart
MongoDB CRUD Operations > SQL to MongoDB Mapping ChartSQL to MongoDB Mapping ChartOn this pageTerminology and ConceptsExecutablesExamplesAdditional ResourcesIn addition to th2017-12-05 14:29:51208
1
-
原创 SQL to Aggregation Mapping Chart
SQL to Aggregation Mapping ChartOn this pageExamplesAdditional ResourcesThe aggregation pipeline allows MongoDB to provide native aggregation capabilities that corresponds to many2017-12-05 16:02:45134
0
-
原创 Troubleshoot Replica Sets
Replication > Replica Set Tutorials > Troubleshoot Replica SetsTroubleshoot Replica SetsOn this pageCheck Replica Set StatusCheck the Replication LagTest Connections Between al2017-12-22 21:02:54181
0
-
转载 提升MongoDB安全性的十个技巧
MongoDB提供了一系列组件来提升数据的安全性。数据安全在MongoDB中是最重要的——因此它利用这些组件来减少曝光面。下面是10个可以用来改善你个人或云中MongoDB服务器安全的小提示。 1、启用auth-即使在可信赖网络中部署MongoDB服务器时启用auth也是项好的安全实践。当你的网络受攻击时它能够提供“深层防御”。编辑配置文件来启用auth。 auth = true2017-12-25 08:59:351085
0
-
原创 Query Optimization
On this pageCreate an Index to Support Read OperationsQuery SelectivityCovered QueryIndexes improve the efficiency of read operations by reducing the amount of data that query operations n2017-12-26 14:49:05674
0
-
原创 Analyze Query Performance
On this pageEvaluate the Performance of a QueryCompare Performance of IndexesAdditional ResourcesThe cursor.explain("executionStats") and the db.collection.explain("executionStats")2017-12-26 16:19:08165
0
-
原创 Build Indexes on Replica Sets
Build Indexes on Replica SetsOn this pageConsiderationsProcedureTo minimize the impact of building an index on replica sets and sharded clusters with replica set shards, use the follow2017-12-27 13:59:23152
0
-
原创 FAQ: Concurrency
On this pageWhat type of locking does MongoDB use?How granular are locks in MongoDB?How do I see the status of locks on my mongodinstances?Does a read or write operation ever yield the loc2018-01-03 11:42:32255
0
-
转载 MongoDB CPU 利用率高,怎么破?
摘要: 经常有用户咨询「MongoDB CPU 利用率很高,都快跑满了」,应该怎么办? 遇到这个问题,99.9999% 的可能性是「用户使用上不合理导致」,本文主要介绍从应用的角度如何排查 MongoDB CPU 利用率高的问题 Step1: 分析数据库正在执行的请求 用户可以通过 Mongo Shell 连接,并执行 db.currentOp() 命令,能看到数据库当前正在执行的操作,如下是该命2017-12-28 09:01:305857
1
-
转载 MongoDB数据建模小案例:物联网时序数据库建模
注:本案例来自MongoDB官方教程PPT,也是一个非常典型的CASE,故此翻译,并结合当前MongoDB版本做了一些内容上的更新。本案例非常适合与IoT场景的数据采集,结合MongoDB的Sharding能力,文档数据结构等优点,可以非常好的解决物联网使用场景。需求案例背景是来自真实的业务,美国州际公路的流量统计。数据库需要提供的能力:存储事件数据提供分析查询能力2017-12-12 10:47:463149
1
-
转载 MongoDB数据建模小案例:朋友圈评论内容管理
摘要: MongoDB数据建模小案例:朋友圈评论内容管理需求社交类的APP需求,一般都会引入“朋友圈”功能,这个产品特性有一个非常重要的功能就是评论体系。先整理下需求:这个APP希望点赞和评论信息都要包含头像信息:点赞列表,点赞用户的昵称,头像;评论列表,评论用户的昵称,头像;数据查询则相对简单:根据分享ID,批量的查询出10条分2017-12-12 09:00:322941
0
-
转载 MongoDB生态 - 社区开源工具篇
工欲善其事,必先利其器,我们在使用数据库时,通常需要各种工具的支持来提高效率;很多新用户在刚接触 MongoDB 时,遇到的问题是『不知道有哪些现成的工具可以使用』,本系列文章将主要介绍 MongoDB 生态在工具、driver、可视化管理等方面的支持情况。MongoDB 生态 - 可视化管理工具MongoDB 生态 - 客户端 Driver 支持MongoDB 生态 - 官方命令行工具2017-12-11 16:09:22498
1
-
原创 Model One-to-One Relationships with Embedded Documents
Model One-to-One Relationships with Embedded DocumentsOn this pageOverviewPatternOverviewData in MongoDB has a flexible schema. Collections do not enforce document structure. D2017-12-08 11:15:34133
0
-
原创 Model One-to-Many Relationships with Embedded Documents
Model One-to-Many Relationships with Embedded DocumentsOn this pageOverviewPatternOverviewData in MongoDB has a flexible schema. Collections do not enforce document structure.2017-12-08 11:16:43103
0
-
原创 Model Tree Structures with Parent References
Model Tree Structures with Parent ReferencesOn this pageOverviewPatternOverviewData in MongoDB has a flexible schema. Collections do not enforce document structure. Decisions t2017-12-08 11:44:46131
0
-
原创 Model Tree Structures with Child References
Model Tree Structures with Child ReferencesOn this pageOverviewPatternOverviewData in MongoDB has a flexible schema. Collections do not enforce document structure. Decisions th2017-12-08 13:22:40100
0
-
原创 Model Tree Structures with an Array of Ancestors
Model Tree Structures with an Array of AncestorsOn this pageOverviewPatternOverviewData in MongoDB has a flexible schema. Collections do not enforce document structure. Decisio2017-12-08 13:46:39117
0
-
原创 Model Tree Structures with Materialized Paths
Model Tree Structures with Materialized PathsOn this pageOverviewPatternOverviewData in MongoDB has a flexible schema. Collections do not enforce document structure. Decisions2017-12-08 14:18:58140
0
-
原创 Model Tree Structures with Nested Sets
Model Tree Structures with Nested SetsOn this pageOverviewPatternOverviewData in MongoDB has a flexible schema. Collections do not enforce document structure. Decisions that af2017-12-08 14:40:57180
0
-
原创 Operational Factors and Data Models
Operational Factors and Data ModelsOn this pageDocument GrowthAtomicityShardingIndexesLarge Number of CollectionsCollection Contains Large Number of Small DocumentsStorage Optimizati2017-12-08 17:26:04133
0
-
转载 MongoDB Driver:使用正确的姿势连接复制集
摘要: MongoDB复制集(Replica Set)通过存储多份数据副本来保证数据的高可靠,通过自动的主备切换机制来保证服务的高可用。**但需要注意的时,连接副本集的姿势如果不对,服务高可用将不复存在。** 使用复制集时你需要知道的 MongoDB复制集里Primary节点是不固定的,当遇到复制集MongoDB复制集(Replica Set)通过存储多份数据副本来保证数据的高可靠,通2017-12-11 10:50:51603
0
-
转载 MongoDB应用案例:使用 MongoDB 存储日志数据
摘要: 线上运行的服务会产生大量的运行及访问日志,日志里会包含一些错误、警告、及用户行为等信息,通常服务会以文本的形式记录日志信息,这样可读性强,方便于日常定位问题,但当产生大量的日志之后,要想从大量日志里挖掘出有价值的内容,则需要对数据进行进一步的存储和分析。 本文以存储 web 服务的访问日志为例,介线上运行的服务会产生大量的运行及访问日志,日志里会包含一些错误、警告、及用户行为等2017-12-11 14:34:316566
0
-
转载 MongoDB应用案例:使用 MongoDB 存储商品分类信息
摘要: 电商业务一个基本的功能模块就是存储品类丰富的商品信息,各种商品特性、参数各异,MongoDB 灵活的文档模型非常适合于这类业务,本文主要介绍如何使用 MongoDB 来存储商品分类信息,内容翻译自User case - Product Catalog 关系型数据库解决方案 上述问题使用传统的关系型数据库也可以解决,比如以下几种方案 针对不同商品,创建不同的表 比如音乐专辑、电影这2种商品,2017-12-11 14:55:08679
0
-
转载 MongoDB 安全 checklist 及最优配置模板
最近 MongoDB “赎金事件”闹得沸沸扬扬,不少公网上裸奔的 MongoDB 中招,有兴趣的同学可以看下耗子叔写的从 MONGODB “赎金事件” 看安全问题,中招的主要原因还是因为用户的安全意识比较薄弱,部署的 MongoDB 完全没有任何安全防护,可以通过公网访问,并且没有开启鉴权。MongoDB 官方文档在安全方面做了很多总结,出了一个MongoDB Security C2017-12-11 15:07:481119
0
-
转载 Mongo shell:最强大的 MongoDB 管理工具
Mongo shell 是 MongoDB 的命令行管理工具,功能非常强大,最近社区很多人咨询的一些问题,比如命令行看 json 格式比较吃力?如何确定Secondary节点同步是否跟上?怎么查看DB、集合使用了多少空间?能否在shell 脚本里调用Mongo shell怎么执行 MongoDB 命令,比如创建集合、索引?......上述问题都可以通过 Mongo shell 来解2017-12-11 16:03:49168
0
-
原创 Back Up and Restore with Filesystem Snapshots
Back Up and Restore with Filesystem SnapshotsOn this pageSnapshots OverviewBack Up and Restore Using LVM on LinuxBack up Instances with Journal Files on Separate Volume or without Jour2018-01-04 16:04:13686
0