{"id":276842,"date":"2016-03-24T09:59:02","date_gmt":"2016-03-24T06:59:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=276842"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=276842","title":{"rendered":"\u0421\u043b\u0435\u0436\u0435\u043d\u0438\u0435 \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0438\u0437 MongoDB Oplog \u0432 Sharded Cluster \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Scala \u0438 Akka Streams"},"content":{"rendered":"<br \/>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/khamrakulov.de\/tailing_the_mongodb_replica_set_oplog_with_scala_and_akka_streams\/\">Tailing the MongoDB Replica Set Oplog with Scala and Akka Streams<\/a>.<br \/>  \u041a\u0430\u043a \u043c\u044b \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0438 \u043f\u0440\u0435\u0436\u0434\u0435, \u0441\u043b\u0435\u0436\u0435\u043d\u0438\u0435 \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 MongoDB Sharded Cluster Oplog \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 Replica Set. \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0442\u0435\u043c\u044b.<br \/>  \u0412 \u0431\u043b\u043e\u0433\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b MongoDB \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0442\u0435\u043c\u0443 \u0441\u043b\u0435\u0436\u0435\u043d\u0438\u044f \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0438\u0437 MongoDB Oplog \u0432 Sharded Clusters. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0438\u0445 \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u0441\u044b\u043b\u043a\u0430\u043c:  <\/p>\n<ul>\n<li><a href=\"https:\/\/www.mongodb.com\/blog\/post\/tailing-mongodb-oplog-sharded-clusters\">Tailing the MongoDB Oplog on Sharded Clusters<\/a><\/li>\n<li><a href=\"https:\/\/www.mongodb.com\/blog\/post\/pitfalls-and-workarounds-for-tailing-the-oplog-on-a-mongodb-sharded-cluster\">Pitfalls and Workarounds for Tailing the Oplog on a MongoDB Sharded Cluster<\/a><\/li>\n<\/ul>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 MongoDB Sharded Cluster \u0432 <a href=\"https:\/\/docs.mongodb.org\/manual\/core\/sharding-introduction\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u0441\u0440\u0435\u0434\u0435. \u041f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/htimur\/mongo_oplog_akka_streams\">github<\/a>.  <\/p>\n<h2>MongoDB Sharded Cluster<\/h2>\n<p>  \u0418\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 MongoDB:  <\/p>\n<blockquote><p><strong>Sharding<\/strong>, \u0438\u043b\u0438 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0438\u043b\u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0445 (shards). \u041a\u0430\u0436\u0434\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0439 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u0432 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0435\u0434\u0438\u043d\u0443\u044e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p><\/blockquote>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ddc\/c53\/bb2\/ddcc53bb2ef64b39b15ec149e6c962a6.png\" alt=\"Sharded Collection\"\/><br \/>  \u0412 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0438\u043d \u0441\u0440\u0435\u0434\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0437\u0435\u043b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Replica Set:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/4d6\/3c2\/902\/4d63c29025f44f67b11da124225572eb.png\" alt=\"Sharded Cluster Architecture\"\/><a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 MongoDB<\/h2>\n<p>  \u0418\u0437-\u0437\u0430 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 MongoDB \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0432 <code>oplog<\/code>. \u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u043c\u0435\u044e\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 <code>fromMigrate<\/code>, \u0442.\u043a. \u043c\u044b \u043d\u0435 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d\u044b \u0432 \u044d\u0442\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445, \u043c\u044b \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u043d\u0430\u0448 <code>oplog<\/code> \u0437\u0430\u043f\u0440\u043e\u0441, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0445 \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.  <\/p>\n<pre><code class=\"scala\">client.getDatabase(&quot;local&quot;)         .getCollection(&quot;oplog.rs&quot;)         .find(and(                 in(MongoConstants.OPLOG_OPERATION, &quot;i&quot;, &quot;d&quot;, &quot;u&quot;),                 exists(&quot;fromMigrate&quot;, false)))         .cursorType(CursorType.TailableAwait)         .noCursorTimeout(true)<\/code><\/pre>\n<p>  <\/p>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0443\u0437\u043b\u0430\u0445<\/h2>\n<p>  \u041a\u0430\u043a \u0432\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u043e \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0434\u043b\u044f \u0441\u043b\u0435\u0436\u0435\u043d\u0438\u044f \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0438\u0437 <code>oplog<\/code> \u0432 Sharded Cluster \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 <code>oplog<\/code> \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0437\u043b\u0430 (Replica Set).<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 <code>config<\/code> \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432. \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043a\u0430\u043a:  <\/p>\n<pre><code>{   &quot;_id&quot; : &quot;shard01&quot;,   &quot;host&quot; : &quot;shard01\/localhost:27018,localhost:27019,localhost:27020&quot; }<\/code><\/pre>\n<p>  \u042f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>case<\/code> \u043a\u043b\u0430\u0441\u0441\u044b \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 <code>Document<\/code>, \u0442\u0430\u043a \u0447\u0442\u043e \u044f \u043e\u0431\u044a\u044f\u0432\u043b\u044e \u043a\u043b\u0430\u0441\u0441:  <\/p>\n<pre><code class=\"scala\">case class Shard(name: String, uri: String)<\/code><\/pre>\n<p>  \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 <code>Document<\/code> \u0432 <code>Shard<\/code>:  <\/p>\n<pre><code class=\"scala\">def parseShardInformation(item: Document): Shard = {   val document = item.toBsonDocument   val shardId = document.getString(&quot;_id&quot;).getValue   val serversDefinition = document.getString(&quot;host&quot;).getValue   val servers = if (serversDefinition.contains(&quot;\/&quot;)) serversDefinition.substring(serversDefinition.indexOf('\/') + 1) else serversDefinition   Shard(shardId, &quot;mongodb:\/\/&quot; + servers) }<\/code><\/pre>\n<p>  \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441:  <\/p>\n<pre><code class=\"scala\">val shards = client.getDatabase(&quot;config&quot;)                   .getCollection(&quot;shards&quot;)                   .find()                   .map(parseShardInformation)<\/code><\/pre>\n<p>  \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e MongoDB Sharded Cluster.  <\/p>\n<h2>\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 Source \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0437\u043b\u0430<\/h2>\n<p>  \u0427\u0442\u043e \u0431\u044b \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c <code>Source<\/code>, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u043f\u043e \u043d\u0430\u0448\u0435\u043c\u0443 \u0441\u043f\u0438\u0441\u043a\u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.  <\/p>\n<pre><code class=\"scala\">def source(client: MongoClient): Source[Document, NotUsed] = {   val observable = client.getDatabase(&quot;local&quot;)                         .getCollection(&quot;oplog.rs&quot;)                         .find(and(                               in(&quot;op&quot;, &quot;i&quot;, &quot;d&quot;, &quot;u&quot;),                               exists(&quot;fromMigrate&quot;, false)))                         .cursorType(CursorType.TailableAwait)                         .noCursorTimeout(true)    Source.fromPublisher(observable) }  val sources = shards.map({ shard =&gt;   val client = MongoClient(shard.uri)   source(client) })<\/code><\/pre>\n<p>  <\/p>\n<h3>\u041e\u0434\u0438\u043d Source, \u0447\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043c\u0438 \u0432\u0441\u0435\u043c\u0438<\/h3>\n<p>  \u041c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 <code>Source<\/code> \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0435\u0433\u0447\u0435 \u0438 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u043c\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0434\u043d\u043e\u0433\u043e <code>Source<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0438\u0445.<br \/>  \u0412 Akka Streams \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e <a href=\"http:\/\/doc.akka.io\/docs\/akka\/2.4.2\/scala\/stream\/stream-graphs.html\"><code>Fan-in<\/code> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/a>:  <\/p>\n<blockquote>\n<ul>\n<li><strong>Merge[In]<\/strong> \u2013 (N \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, 1 \u0432\u044b\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a) \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438\u0437 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0442\u043e\u043a.<\/li>\n<li><strong>MergePreferred[In]<\/strong> \u2013 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 <strong>Merge<\/strong> \u043d\u043e \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u0442\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u043d\u0435\u0433\u043e, \u0438\u043d\u0430\u0447\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e \u0442\u043e\u043c\u0443 \u0436\u0435 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u0447\u0442\u043e \u0438 **<em>Merge<\/em><\/li>\n<li><strong>ZipWith[A,B,&#8230;,Out]<\/strong> \u2013 (N \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, 1 \u0432\u044b\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a) \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0442 N \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 1 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u0432\u044b\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0437\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0437 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430.<\/li>\n<li><strong>Zip[A,B]<\/strong> \u2013 (2 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u0430, 1 \u0432\u044b\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a) \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0447\u0442\u043e \u0438 <strong>ZipWith<\/strong> \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 <strong>A<\/strong> \u0438 <strong>B<\/strong> \u0432 \u043f\u043e\u0442\u043e\u043a \u043f\u0430\u0440\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <strong>(A, B)<\/strong><\/li>\n<li><strong>Concat[A]<\/strong> \u2013 (2 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u0430, 1 \u0432\u044b\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a) \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442 2 \u043f\u043e\u0442\u043e\u043a\u0430 (\u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u0438\u0437 \u0432\u0442\u043e\u0440\u043e\u0433\u043e)<\/li>\n<\/ul>\n<p>  <\/p><\/blockquote>\n<p>  \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u0439 API \u0434\u043b\u044f <a href=\"http:\/\/doc.akka.io\/docs\/akka\/2.4.2\/scala\/stream\/stream-graphs.html#combining-sources-and-sinks-with-simplified-api\">Merge<\/a> \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u0442\u043e\u043a\u0430 \u0432 <code>STDOUT<\/code>:  <\/p>\n<pre><code class=\"scala\">val allShards: Source[Document, NotUsed] =    sources.foldLeft(Source.empty[Document]) {      (prev, current) =&gt; Source.combine(prev, current)(Merge(_))   }  allShards.runForeach(println)<\/code><\/pre>\n<p>  <\/p>\n<h2>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u2014 \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u0410\u0432\u0430\u0440\u0438\u0439\u043d\u044b\u0435 \u041e\u0442\u043a\u0430\u0442\u044b<\/h2>\n<p>  \u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a Akka Streams \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"http:\/\/doc.akka.io\/docs\/akka\/2.4.2\/scala\/stream\/stream-error.html\">Supervision Strategies<\/a>. \u0412 \u043e\u0431\u0449\u0435\u043c \u0438\u043c\u0435\u0435\u0442\u0441\u044f 3 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043a\u0438:  <\/p>\n<blockquote>\n<ul>\n<li><strong>Stop<\/strong> \u2014 \u041f\u043e\u0442\u043e\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439.<\/li>\n<li><strong>Resume<\/strong> \u2014 \u041e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u0442\u043e\u043a\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0441\u044f.<\/li>\n<li><strong>Restart<\/strong> \u2014 \u041e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u0442\u043e\u043a\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u044d\u0442\u0430\u043f\u0430. \u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u044d\u0442\u0430\u043f\u0430 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0441\u0435 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0447\u0438\u0449\u0430\u044e\u0442\u0441\u044f. \u042d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0446\u0430 \u044d\u0442\u0430\u043f\u0430.<\/li>\n<\/ul>\n<p>  <\/p><\/blockquote>\n<p>  \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <strong>Stop<\/strong>.<br \/>  \u041d\u043e \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0432\u0441\u0435 \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c <code>ActorPublisher<\/code> \u0438 <code>ActorSubscriber<\/code>, \u0442\u0430\u043a \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u044e\u0431\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c <code>Source<\/code> \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u043e\u0442\u043e\u043a\u0430.<br \/>  \u041d\u0430 <a href=\"https:\/\/github.com\/akka\/akka\/issues\/16916\">Github #16916<\/a> \u0443\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0434\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0438 \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u0441\u043a\u043e\u0440\u043e.<br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/www.mongodb.com\/blog\/post\/pitfalls-and-workarounds-for-tailing-the-oplog-on-a-mongodb-sharded-cluster\">Pitfalls and Workarounds for Tailing the Oplog on a MongoDB Sharded Cluster<\/a> \u0432\u0430\u0440\u0438\u0430\u043d\u0442:  <\/p>\n<blockquote><p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0438\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u043e\u0432 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0440\u0435\u043f\u043b\u0438\u043a. \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0430\u0440\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 <code>ts &amp; h<\/code> \u043f\u043e\u043b\u0435\u0439 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u0436\u0434\u0443\u044e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u0437 \u043a\u0430\u0436\u0434\u043e\u0433\u043e <code>oplog<\/code> \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0442\u0430\u043a \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0430 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u044b \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e\u043c \u0443\u0437\u043b\u043e\u0432 MongoDB. \u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u0442\u043e\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0443\u0437\u0435\u043b \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c \u0438\u043b\u0438 \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u044b\u043c, \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 <code>oplog<\/code> \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u043e\u0432, \u0438 \u0432\u0441\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e\u043c <code>oplog<\/code> \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 <code>oplog<\/code>, \u0442\u0430\u043a\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0438 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442.<\/p><\/blockquote>\n<p>  \u042f \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439.  <\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434<\/h2>\n<p>  \u041c\u044b \u043d\u0435 \u043e\u0445\u0432\u0430\u0442\u0438\u043b\u0438 \u0442\u0435\u043c\u0443 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 <code>orphan<\/code> \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 MongoDB Sharded Cluster, \u0442.\u043a. \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d \u0432\u043e \u0432\u0441\u0435\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u0438\u0437 <code>oplog<\/code> \u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442 \u0438\u0445 \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u043d\u044b\u043c\u0438 \u043f\u043e \u043f\u043e\u043b\u044e <code>_id<\/code>, \u0442\u0430\u043a \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442.<br \/>  \u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0432\u0438\u0434\u0435\u0442\u044c, \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0430\u0441\u043f\u0435\u043a\u0442\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Akka Streams, \u043d\u043e \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0412 \u043e\u0431\u0449\u0435\u043c \u0443 \u043c\u0435\u043d\u044f \u0434\u0432\u043e\u044f\u043a\u043e\u0435 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435 \u043e\u0431 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u043b\u043d\u0430 \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u0438\u0434\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044f\u0442 \u0438\u0434\u0435\u0438 Akka Actors \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c, \u043d\u043e \u0432\u0441\u0435 \u044d\u0442\u043e \u0435\u0449\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u043c. \u041b\u0438\u0447\u043d\u043e \u044f \u043f\u043e\u043a\u0430 \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f Akka Actors.         <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/279675\/\"> https:\/\/habrahabr.ru\/post\/279675\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<br \/>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/khamrakulov.de\/tailing_the_mongodb_replica_set_oplog_with_scala_and_akka_streams\/\">Tailing the MongoDB Replica Set Oplog with Scala and Akka Streams<\/a>.<br \/>  \u041a\u0430\u043a \u043c\u044b \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0438 \u043f\u0440\u0435\u0436\u0434\u0435, \u0441\u043b\u0435\u0436\u0435\u043d\u0438\u0435 \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 MongoDB Sharded Cluster Oplog \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 Replica Set. \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0442\u0435\u043c\u044b.<br \/>  \u0412 \u0431\u043b\u043e\u0433\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b MongoDB \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u0442\u0435\u043c\u0443 \u0441\u043b\u0435\u0436\u0435\u043d\u0438\u044f \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0438\u0437 MongoDB Oplog \u0432 Sharded Clusters. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0438\u0445 \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u0441\u044b\u043b\u043a\u0430\u043c:  <\/p>\n<ul>\n<li><a href=\"https:\/\/www.mongodb.com\/blog\/post\/tailing-mongodb-oplog-sharded-clusters\">Tailing the MongoDB Oplog on Sharded Clusters<\/a><\/li>\n<li><a href=\"https:\/\/www.mongodb.com\/blog\/post\/pitfalls-and-workarounds-for-tailing-the-oplog-on-a-mongodb-sharded-cluster\">Pitfalls and Workarounds for Tailing the Oplog on a MongoDB Sharded Cluster<\/a><\/li>\n<\/ul>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 MongoDB Sharded Cluster \u0432 <a href=\"https:\/\/docs.mongodb.org\/manual\/core\/sharding-introduction\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d \u0441\u0440\u0435\u0434\u0435. \u041f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/htimur\/mongo_oplog_akka_streams\">github<\/a>.  <\/p>\n<h2>MongoDB Sharded Cluster<\/h2>\n<p>  \u0418\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 MongoDB:  <\/p>\n<blockquote><p><strong>Sharding<\/strong>, \u0438\u043b\u0438 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0438\u043b\u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0445 (shards). \u041a\u0430\u0436\u0434\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0439 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u0432 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0435\u0434\u0438\u043d\u0443\u044e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p><\/blockquote>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ddc\/c53\/bb2\/ddcc53bb2ef64b39b15ec149e6c962a6.png\" alt=\"Sharded Collection\"\/><br \/>  \u0412 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0438\u043d \u0441\u0440\u0435\u0434\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0437\u0435\u043b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f Replica Set:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/4d6\/3c2\/902\/4d63c29025f44f67b11da124225572eb.png\" alt=\"Sharded Cluster Architecture\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-276842","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/276842","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=276842"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/276842\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=276842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=276842"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=276842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}