日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

elasticSearch6源码分析(8)RepositoriesModule模块

發布時間:2025/4/5 编程问答 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 elasticSearch6源码分析(8)RepositoriesModule模块 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.RepositoriesModule概述

Sets up classes for Snapshot/Restore

1.1 snapshot概述

A snapshot is a backup taken from a running Elasticsearch cluster. You can take a snapshot of individual indices or of the entire cluster and store it in a repository on a shared filesystem, and there are plugins that support remote repositories on S3, HDFS, Azure, Google Cloud Storage and more.Snapshots are taken incrementally. This means that when creating a snapshot of an index Elasticsearch will avoid copying any data that is already stored in the repository as part of an earlier snapshot of the same index. Therefore it can be efficient to take snapshots of your cluster quite frequently.Snapshots can be restored into a running cluster via the restore API. When restoring an index it is possible to alter the name of the restored index as well as some of its settings, allowing a great deal of flexibility in how the snapshot and restore functionality can be used.

1.2?repository?

You must register a snapshot repository before you can perform snapshot and restore operations. We recommend creating a new snapshot repository for each major version. The valid repository settings depend on the repository type.If you register same snapshot repository with multiple clusters, only one cluster should have write access to the repository. All other clusters connected to that repository should set the repository to readonly mode.

實例:備份

PUT /_snapshot/my_backup {"type": "fs","settings": {"location": "my_backup_location"} }

恢復

POST /_snapshot/my_backup/snapshot_1/_restore

刪除

DELETE /_snapshot/my_backup/snapshot_1

監控

GET /_snapshot/my_backup/snapshot_1/_status

2.配置類BlobStoreRepository

protected BlobStoreRepository(RepositoryMetaData metadata, Settings globalSettings, NamedXContentRegistry namedXContentRegistry) {super(globalSettings);this.metadata = metadata;this.namedXContentRegistry = namedXContentRegistry;snapshotRateLimiter = getRateLimiter(metadata.settings(), "max_snapshot_bytes_per_sec", new ByteSizeValue(40, ByteSizeUnit.MB));restoreRateLimiter = getRateLimiter(metadata.settings(), "max_restore_bytes_per_sec", new ByteSizeValue(40, ByteSizeUnit.MB));readOnly = metadata.settings().getAsBoolean("readonly", false);indexShardSnapshotFormat = new ChecksumBlobStoreFormat<>(SNAPSHOT_CODEC, SNAPSHOT_NAME_FORMAT,BlobStoreIndexShardSnapshot::fromXContent, namedXContentRegistry, isCompress());indexShardSnapshotsFormat = new ChecksumBlobStoreFormat<>(SNAPSHOT_INDEX_CODEC, SNAPSHOT_INDEX_NAME_FORMAT,BlobStoreIndexShardSnapshots::fromXContent, namedXContentRegistry, isCompress());ByteSizeValue chunkSize = chunkSize();if (chunkSize != null && chunkSize.getBytes() <= 0) {throw new IllegalArgumentException("the chunk size cannot be negative: [" + chunkSize + "]");}}

配置類的實現

?

?3.重點類

3.1?SnapshotsService

?創建snapshot

/*** Service responsible for creating snapshots* <p>* A typical snapshot creating process looks like this:* <ul>* <li>On the master node the {@link #createSnapshot(SnapshotRequest, CreateSnapshotListener)} is called and makes sure that no snapshots is currently running* and registers the new snapshot in cluster state</li>* <li>When cluster state is updated the {@link #beginSnapshot(ClusterState, SnapshotsInProgress.Entry, boolean, CreateSnapshotListener)} method* kicks in and initializes the snapshot in the repository and then populates list of shards that needs to be snapshotted in cluster state</li>* <li>Each data node is watching for these shards and when new shards scheduled for snapshotting appear in the cluster state, data nodes* start processing them through {@link SnapshotShardsService#processIndexShardSnapshots(ClusterChangedEvent)} method</li>* <li>Once shard snapshot is created data node updates state of the shard in the cluster state using the {@link SnapshotShardsService#sendSnapshotShardUpdate(Snapshot, ShardId, ShardSnapshotStatus)} method</li>* <li>When last shard is completed master node in {@link SnapshotShardsService#innerUpdateSnapshotState} method marks the snapshot as completed</li>* <li>After cluster state is updated, the {@link #endSnapshot(SnapshotsInProgress.Entry)} finalizes snapshot in the repository,* notifies all {@link #snapshotCompletionListeners} that snapshot is completed, and finally calls {@link #removeSnapshotFromClusterState(Snapshot, SnapshotInfo, Exception)} to remove snapshot from cluster state</li>* </ul>*/

3.2?RestoreService

/*** Service responsible for restoring snapshots* <p>* Restore operation is performed in several stages.* <p>* First {@link #restoreSnapshot(RestoreRequest, org.elasticsearch.action.ActionListener)}* method reads information about snapshot and metadata from repository. In update cluster state task it checks restore* preconditions, restores global state if needed, creates {@link RestoreInProgress} record with list of shards that needs* to be restored and adds this shard to the routing table using {@link RoutingTable.Builder#addAsRestore(IndexMetaData, SnapshotRecoverySource)}* method.* <p>* Individual shards are getting restored as part of normal recovery process in* {@link IndexShard#restoreFromRepository(Repository)} )}* method, which detects that shard should be restored from snapshot rather than recovered from gateway by looking* at the {@link ShardRouting#recoverySource()} property.* <p>* At the end of the successful restore process {@code RestoreService} calls {@link #cleanupRestoreState(ClusterChangedEvent)},* which removes {@link RestoreInProgress} when all shards are completed. In case of* restore failure a normal recovery fail-over process kicks in.*/

?

轉載于:https://www.cnblogs.com/davidwang456/p/10138559.html

總結

以上是生活随笔為你收集整理的elasticSearch6源码分析(8)RepositoriesModule模块的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 亚洲爱色 | 国产一区伦理 | 又欲又污又肉又黄短文 | 色播综合 | 亚洲视频精选 | 亚洲精品免费观看 | 久久国产欧美日韩精品 | 黄色av大片 | 在线观看中文字幕一区二区 | 无码人妻精品一区二区三区66 | 99久久久无码国产精品免费 | 日韩有码中文字幕在线 | 国产高中女学生第一次 | www麻豆| 亚洲4区 | 国产视频69| 特级淫片裸体免费看冫 | 久久精品视频在线播放 | aaa久久 | 成年人免费在线视频 | 校园春色欧美 | 天天躁日日躁aaaa视频 | 亚洲专区在线 | 男人av在线 | 免费成人av网址 | 在线看片| 一级高清视频 | 波多野结衣加勒比 | 在线观看亚洲一区 | 伊人狼人影院 | 天天躁日日摸久久久精品 | 在线一区不卡 | 国产日批视频在线观看 | 日韩欧美黄色网址 | 国产精品igao视频 | 伊人9999| 在线看片日韩 | 精品无码av一区二区三区不卡 | 中文字幕有码在线播放 | 9·1·黄·色·视·频 | 一本大道熟女人妻中文字幕在线 | 风间由美一区二区 | 国产jizz18女人高潮 | 久久精品电影 | 亚洲 国产 日韩 欧美 | 小sao货大ji巴cao死你 | 中文字幕一区二区三区四区欧美 | 亚洲精品一区二区三区在线观看 | 伦av综合一区 | 日本三级小视频 | 男操女视频在线观看 | 日日草夜夜草 | 国产免费激情视频 | a在线免费 | 亚洲三级免费 | 亚洲第一女人av | 日本一级淫片免费放 | 亚洲日日干 | 久久国产视频一区 | 国产成人99久久亚洲综合精品 | 日b视频免费观看 | 午夜视频日韩 | 免费成人深夜 | 99毛片| 免费萌白酱国产一区二区三区 | 国产主播在线看 | 亚洲理论在线 | 国产成人免费网站 | 在线视频福利 | 男女啪啪av | 性做久久久久久久久 | 午夜高潮视频 | 亚洲图片激情小说 | 亚洲啪啪免费视频 | 日韩美女黄色片 | 1024精品一区二区三区日韩 | 伊人久久免费视频 | 女生脱裤子让男生捅 | 少妇色视频 | 欧美三级电影在线观看 | 伊人久久大香线蕉综合网站 | 欧美日韩成人在线播放 | 亚洲国产久 | 国产资源站 | 久久三级网 | 亚洲一级一级 | 国产一级二级毛片 | 白浆网站| 中文字幕第23页 | 久久婷婷综合色 | 成年人在线免费 | 99热这里只有精品首页 | av网站观看| 九九九九精品 | 狠狠操天天操 | 国产一卡二卡在线 | 波多野结衣视频网址 | 日韩欧美影院 | 亚洲天堂网在线观看视频 |