首页 > 数据库 >MongoDB Oplogs 到底都记录了什么 与 智者老冯

MongoDB Oplogs 到底都记录了什么 与 智者老冯

时间:2023-12-28 14:01:37浏览次数:31  
标签:Oplogs 12 MongoDB 老冯 NumberLong ISODate Timestamp ns op


MongoDB  Oplogs  到底都记录了什么 与  智者老冯_数据库

最近董宇辉的事情,让我意识到,如果光一味的搞技术,那么对于人生和生活是不完整的,后序在撰写一些技术文章的时候,会带有一些对于当前热点事件的一些感触和反思,也希望能找到一些有同样想法的人,终究人生的道路是孤独的,如果在孤独中能找到一些人能对你有一些共鸣,那是一件幸福的事情。

这里先说技术,后说感触:

MongoDB 本身是一个分成收到欢迎的 NOSQL数据库,其中oplogs是MongoDB 中最重要的日志,他提供了强大的复制和同步的能力,由此mongodb 才能有高可用,复制集合,数据一致性,分片等多种能力的支持,这些都与oplogs 有强相关。

在这里我们先说说oplogs 的数据中的格式

repl:PRIMARY> show collections;
oplog.rs
replset.election
replset.minvalid
replset.oplogTruncateAfterPoint
startup_log
system.profile
system.replset
system.rollback.id
repl:PRIMARY> db.oplog.rs.findOne();
{
 "ts" : Timestamp(1639190792, 1),
 "h" : NumberLong(0),
 "v" : 2,
 "op" : "n",
 "ns" : "",
 "wall" : ISODate("2021-12-11T02:46:32.518Z"),
 "o" : {
  "msg" : "initiating set"
 }
}
repl:PRIMARY> db.oplog.rs.find();
{ "ts" : Timestamp(1639190792, 1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:46:32.518Z"), "o" : { "msg" : "initiating set" } }
{ "ts" : Timestamp(1639190803, 2), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "c", "ns" : "config.$cmd", "ui" : UUID("c3c70f0e-028e-4db8-85b4-79e8b65eccc9"), "wall" : ISODate("2021-12-11T02:46:43.802Z"), "o" : { "create" : "transactions", "idIndex" : { "v" : 2, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "config.transactions" } } }
{ "ts" : Timestamp(1639190803, 3), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "c", "ns" : "config.$cmd", "ui" : UUID("b2fb5908-b21b-4ed5-9f2d-218396875b19"), "wall" : ISODate("2021-12-11T02:46:43.806Z"), "o" : { "create" : "image_collection", "idIndex" : { "v" : 2, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "config.image_collection" } } }
{ "ts" : Timestamp(1639190803, 4), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:46:43.806Z"), "o" : { "msg" : "new primary" } }
{ "ts" : Timestamp(1639190803, 5), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "c", "ns" : "admin.$cmd", "ui" : UUID("4a7fa891-c1a9-49a6-abc4-d94693030358"), "wall" : ISODate("2021-12-11T02:46:43.810Z"), "o" : { "create" : "system.keys", "idIndex" : { "v" : 2, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "admin.system.keys" } } }
{ "ts" : Timestamp(1639190803, 6), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "i", "ns" : "admin.system.keys", "ui" : UUID("4a7fa891-c1a9-49a6-abc4-d94693030358"), "wall" : ISODate("2021-12-11T02:46:43.811Z"), "o" : { "_id" : NumberLong("7040270890788978692"), "purpose" : "HMAC", "key" : BinData(0,"aIg6SYcKvt6nEuNtwy/ZljTSHB8="), "expiresAt" : Timestamp(1646966803, 0) } }
{ "ts" : Timestamp(1639190804, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "i", "ns" : "admin.system.keys", "ui" : UUID("4a7fa891-c1a9-49a6-abc4-d94693030358"), "wall" : ISODate("2021-12-11T02:46:44.561Z"), "o" : { "_id" : NumberLong("7040270890788978693"), "purpose" : "HMAC", "key" : BinData(0,"1PeuaQ4B1+eGmmlBuaGU+NfTcpA="), "expiresAt" : Timestamp(1654742803, 0) } }
{ "ts" : Timestamp(1639190823, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:47:03.807Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639190833, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:47:13.808Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639190843, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:47:23.809Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639190853, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:47:33.809Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639190863, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:47:43.810Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639190873, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:47:53.811Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639190883, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:48:03.812Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639190893, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:48:13.812Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639190903, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:48:23.813Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639190913, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:48:33.813Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639190923, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:48:43.815Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639190933, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:48:53.816Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639190943, 1), "t" : NumberLong(1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-11T02:49:03.817Z"), "o" : { "msg" : "periodic noop" } }
Type "it" for more

首先我们可以打开oplogs并且可以通过语句来对数据进行读取,上面的oplogs 中的一些字段是有意义的,我们这里来解释一下。

ts: 时间戳,基于是日志,并且是一个分布式数据库的日志,则每个操作的时间是非常重要的,这里时间戳的产生都要和复制集中的各个主机的时间进行同步,并且产生的时间戳在各个复制集中具有唯一性。这里 ts 64位来表达这个时间 32位时间 + 32位计数累计

t: 这里与mongodb的本身复制集有关,基于复制集采用的raft 协议,则在每次节点进行切换的情况下,这里的值会进行自增,来标记这个节点曾经发生了什么。

v: oplog的版本标识

op:数据库中具体的操作 这里有不同的标识,如 插入,删除,更新 ,DDL 空转等标志, i , d , u ,c, n

ns: 操作在那个层面发生如某个 collation 里面

o:  操作中指定的字段 key 与 op 进行配置和,则获得对于操作+字段,则指定这个操作的具体信息

o2:  查询字段,这里只针对 op=u的情况下

b: 这标识在数据插入中,使用的是upsert 如果这个位置是 true,则表明数据是upsert 方式插入的

txnNumber 标识事务的ID 因为MongoDB是支持事务的,所以事务也是有事务号的,也是有顺序和标识的

当然这里还有一些其他的字段,比如prevOpTime, preImageOpTime,  postImangeOpTime ,这些字段是针对当前的oplogs 条目与前后与这条记录的有关系的条目关系。

repl:PRIMARY> db.test.insertOne({"author" : "Simon", "text" : "Lemon is sweet", "tags":["mongodb", "python", "pymongo"], "date": ISODate("2023-12-18T04:22:47.243Z") });
{
 "acknowledged" : true,
 "insertedId" : ObjectId("61b78ad32b236dddb7d04847")
}
repl:PRIMARY> db.test.insertOne({"author" : "Simon", "text" : "Lemon is sweet", "tags":["mongodb", "python", "pymongo"], "date": ISODate("2023-12-18T04:22:47.243Z") });
{
 "acknowledged" : true,
 "insertedId" : ObjectId("61b78ad42b236dddb7d04848")
}
repl:PRIMARY> db.test.insertOne({"author" : "Simon", "text" : "Lemon is sweet", "tags":["mongodb", "python", "pymongo"], "date": ISODate("2023-12-18T04:22:47.243Z") });
{
 "acknowledged" : true,
 "insertedId" : ObjectId("61b78ad52b236dddb7d04849")
}
repl:PRIMARY>

这里我们在一个表中插入数据,并尝试在oplogs 中找到这条数据

repl:PRIMARY> db.oplog.rs.find({ "op": "i" }).sort({ $natural: -1 }).limit(1);
{ "ts" : Timestamp(1639418581, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "i", "ns" : "test.test", "ui" : UUID("28a721ca-06b1-4c06-8588-efb0ef4fd21d"), "wall" : ISODate("2021-12-13T18:03:01.880Z"), "o" : { "_id" : ObjectId("61b78ad52b236dddb7d04849"), "author" : "Simon", "text" : "Lemon is sweet", "tags" : [ "mongodb", "python", "pymongo" ], "date" : ISODate("2023-12-18T04:22:47.243Z") } }
repl:PRIMARY>

db.oplog.rs.find({ "op": "i" }).sort({ $natural: -1 }).limit(1);

{ "ts" : Timestamp(1639418581, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "i", "ns" : "test.test", "ui" : UUID("28a721ca-06b1-4c06-8588-efb0ef4fd21d"), "wall" : ISODate("2021-12-13T18:03:01.880Z"), "o" : { "_id" : ObjectId("61b78ad52b236dddb7d04849"), "author" : "Simon", "text" : "Lemon is sweet", "tags" : [ "mongodb", "python", "pymongo" ], "date" : ISODate("2023-12-18T04:22:47.243Z") } }

这里我们可以看出,在oplogs中的确有标记,

"ns" : "test.test"

"o" : { "_id" : ObjectId("61b78ad52b236dddb7d04849"), "author" : "Simon", "text" : "Lemon is sweet", "tags" : [ "mongodb", "python", "pymongo" ], "date" : ISODate("2023-12-18T04:22:47.243Z") } }

这两个部分已经标记了整体的操作的信息,凭借这些完全可以进行数据的复制操作。

MongoDB  Oplogs  到底都记录了什么 与  智者老冯_python_02

repl:PRIMARY> db.oplog.rs.find({ "op": "c" }).sort({ $natural: -1 }).limit(1);
{ "ts" : Timestamp(1639419500, 2), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "c", "ns" : "test.$cmd", "ui" : UUID("28a721ca-06b1-4c06-8588-efb0ef4fd21d"), "wall" : ISODate("2021-12-13T18:18:20.703Z"), "o" : { "createIndexes" : "test", "v" : 2, "key" : { "author" : -1 }, "name" : "author_-1", "background" : true } }
repl:PRIMARY>

从上面的部分我们也可以看到添加索引的DDL 也明确可以在oplogs中存在添加索引的记录。

在我们感性的认知了oplogs后,我们针对oplogs在性能方面进行一些说明

1  关于oplogs 的大小的问题,在设置oplogs空间的大小与这个数据库索要承载的数据库的并发和数据的处理量有关。

2  网络的问题是针对mongodb中尤其是非单机的情况下,性能,数据的一致性,包含在一些情况下,数据的写入的速度等等都有关,所以网络对于mongodb 的重要性不言而喻。

同时我们还有一些对于oplogs 的查询和分析语句

比如我们查询1小时内的oplogs的记录

var  since = Math.floor(ISODate("2021-12-13T09:00:00.000Z").getTime() / 1000)
var  until = Math.floor(ISODate("2021-12-13T15:00:00.000Z").getTime() / 1000)
db.oplog.rs.find({ "ts"  : { "$lt"  : Timestamp(until, 1), "$gt"  : Timestamp(since, 1) } })
repl:PRIMARY> var  since = Math.floor(ISODate("2021-12-13T09:00:00.000Z").getTime() / 1000)
repl:PRIMARY> var  until = Math.floor(ISODate("2021-12-13T15:00:00.000Z").getTime() / 1000)
repl:PRIMARY> db.oplog.rs.find({ "ts"  : { "$lt"  : Timestamp(until, 1), "$gt"  : Timestamp(since, 1) } })
{ "ts" : Timestamp(1639388480, 2), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:41:20.144Z"), "o" : { "msg" : "new primary" } }
{ "ts" : Timestamp(1639388490, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:41:30.150Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388500, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:41:40.156Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388510, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:41:50.160Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388520, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:42:00.164Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388530, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:42:10.164Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388540, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:42:20.167Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388550, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:42:30.169Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388560, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:42:40.171Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388570, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:42:50.173Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388580, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:43:00.175Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388590, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:43:10.179Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388600, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:43:20.180Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388610, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:43:30.184Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388620, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:43:40.187Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388630, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:43:50.190Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388640, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:44:00.193Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388650, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:44:10.196Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388660, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:44:20.197Z"), "o" : { "msg" : "periodic noop" } }
{ "ts" : Timestamp(1639388670, 1), "t" : NumberLong(2), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "wall" : ISODate("2021-12-13T09:44:30.198Z"), "o" : { "msg" : "periodic noop" } }
Type "it" for more
repl:PRIMARY>

统计当前oplog中的update 操作

repl:PRIMARY> db.oplog.rs.aggregate([
...         { $match: { "op":"u"  }},
...         { $group: { _id:"$ns",count:{$sum:1}}}
...     ])
{ "_id" : "admin.system.users", "count" : 1 }
{ "_id" : "config.system.sessions", "count" : 12 }
repl:PRIMARY>

最近董宇辉的事情,让我对于冯唐冯老师,非常的佩服,尤其是回顾东方甄选有一期,冯唐老师和董宇辉和俞敏洪直播的视频,进行翻看后,冯唐老师对于人性的把握,对于企业的发展,对于员工和老板之间关系发展,,以及利益的取舍等,都有非常直白的解读,尽管俞敏洪将话讲的非常的“文艺”,而冯唐厉害之处,将常人听不懂的内涵的意思,全部解读出来,并且正大光明的将做这些话说出来,这是很多名人都做不到的。

这里给我一些启示:

1  人是有高低之分,承认人和人就是不一样,这与公平无关,这是现实。

2  人可以善良,但是善良之前,你是否有能力支撑你的善良,善良不等于软弱和无知。

3 可以收敛自己的聪明,但对跨过底线人,必须有聪明去惩罚过线的人让其得到教训或惩罚。

4  做人见好就收,不要赚最后一个铜板,不要将自己推到巅峰,在半山腰下来的未必不是好事。

MongoDB  Oplogs  到底都记录了什么 与  智者老冯_python_03

标签:Oplogs,12,MongoDB,老冯,NumberLong,ISODate,Timestamp,ns,op
From: https://blog.51cto.com/u_14150796/9014288

相关文章

  • MongoDB 通配符索引 (wildcard index) 的利与弊
    MongoDB支持在单个字段或多个字段上创建索引,以提高查询性能。MongoDB支持灵活的模式,这意味着文档字段名在集合中可能会有所不同。使用通配符索引可支持针对任意或未知字段的查询。·一个集合中可以创建多个通配符索引·通配符索引可以覆盖与集合中其他索引相同的字段·通配符......
  • mongodb安装
    #!/bin/bash###############################################################FileName:install_redis.sh#Version:V1.0#Author:junwang#Organization:#CreatedTime:2021-04-1417:12:54#Description:###############################################......
  • Windows下安装MongoDB实践总结
    本文记录Windows环境下的MongoDB安装与使用总结。【1】官网下载官网下载地址:DownloadMongoDBCommunityServer|MongoDB这里可以选择下载zip或者msi,zip是解压后自己配置,msi是傻瓜式一键安装。这里我们分别对比进行实践。【2】ZIP包实践①解压将上面下载的ZIP包进行解压,如下所示......
  • Python MongoDB 聚合管道操作符及使用
    ​ 1、$match筛选文档,类似于SQL的WHERE子句。可以使用$match来选择满足特定条件的文档。使用示例:PythonMongoDB聚合管道操作符及使用-CJavaPy2、$group分组和汇总数据,类似于SQL的GROUPBY子句。你可以使用$group来对文档进行分组,并进行聚合操作,如计算总和、......
  • mongoDB-使用总结($group 、$unwind、$cond等)
    1.按年分库表联合查询db.collection_2023_3.aggregate({$set:{_id:'2023_3'}},{$unionWith:{coll:'collection_2023_4',pipeline:[{$set:{_id:"2023_4"}}]}}) 2.多字段分组{$group:{_id:{data_time:......
  • mongoDB取日周月年
    1.$dateFromString字符串转时间类型{$dateFromString:{dateString:<dateStringExpression>,  //要转化的时间字符串format:<formatExpression>,  //转换的格式,’%Y-%m-%dT%H:%M:%S.%LZ‘   timezone:<tzExpression>,  //指定时区onError:<......
  • MongoDB限定条件的查询语句
    在MongoDB里面查询语句使用如下:--限定条件进行查询db.getCollection('source_news').find("_id":{$in:[28829497251611,28829497251535,28829497251452,28829497251359,28829497251276,28829497251238,28829497251130,28829497250977,28829497250914,28829497......
  • Mongodb快速入门
    目录简介MongoDB基础知识安装&配置基本数据类型CURD操作数据库操作集合操作(表)文档操作新增文档查询文档修改文档删除文档聚合Pymongo简介MongoDB是一款强大、灵活、且易于扩展的通用型数据库易用性MongoDB是一个面向文档(document-oriented)的数据库,而不是关系型数据库。不采用......
  • MongoDB、Elasticsearch、Redis、HBase应用场景分析
    1.MongoDB一个基于分布式文件存储的数据库系统,由C++编写,旨在为Web应用提供高速、可扩展、高性能的数据存储解决方案。MongoDB采用了文档型数据库模型,即数据以文档的形式存储,而文档是由键值对组成的。MongoDB的名称来自Hadoop创始人DougCutting的宠物狗Mongo。  应用场景......
  • 爬虫-今日头条我的收藏-增量式导入到mongodb(三)
    背景:续接前文,当我们有了原始数据之后,自然会想如何利用这些数据。这些文件数据都是json格式,打开一个文本文件眼睛都要看花。所以想把这些数据导入到对应的数据库中,市面上几乎所有数据库都支持json格式存储。随着时间的推移,用户不断有新的收藏,这样就不断产生新的收藏文件。需要不......