日韩性视频-久久久蜜桃-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模块的全部內容,希望文章能夠幫你解決所遇到的問題。

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

主站蜘蛛池模板: 国产精品久久久久久中文字 | 久久久国产一区二区三区 | 日韩欧美中文字幕在线观看 | 免费视频a | 帮我拍拍漫画全集免费观看 | bangbros性欧美18 | 久久视频免费在线观看 | 麻豆人妻少妇精品无码专区 | 国产免费a级片 | 黄视频网站免费看 | 中文精品无码中文字幕无码专区 | 成人乱码一区二区三区av | 国产剧情久久久 | 麻豆免费观看网站 | 国产又爽又黄的视频 | 亚洲一区二区三区色 | 成人黄色片视频 | 久久久久久欧美精品se一二三四 | 日韩国产精品一区二区三区 | 午夜寂寞少妇 | 亚洲aⅴ在线| 一级全黄毛片 | 91精品999| 亚洲精品一区二区三区影院忠贞 | 国产精品一区二区三区在线播放 | 国产av日韩一区二区三区精品 | 久久黄页 | 国产精品老牛影视 | 青娱乐在线播放 | 谁有毛片网站 | 天堂福利在线 | 一个色综合导航 | 福利在线一区二区三区 | 成人爽a毛片一区二区免费 日本高清免费看 | 免费观看一级一片 | 九九九九九伊人 | 欧美五月激情 | 中文字幕国产精品 | 黑人巨大精品 | 国产视频久久久 | 91av在线免费视频 | 国产乡下妇女做爰毛片 | 少妇一级淫片免费放 | 男人久久天堂 | 91欧美激情一区二区三区成人 | 国产伦精品免费视频 | 俄罗斯黄色大片 | 天天草比 | 丝袜老师扒开让我了一夜漫画 | 性色av网址 | av网站一区二区 | 91国产视频在线观看 | 亚洲成人网在线 | 欧美成人自拍视频 | 在线观看亚洲区 | 久久久一二三区 | 日韩欧美国产一区二区三区 | 欧美一卡二卡在线观看 | yy色综合 | 在线观看国产日韩 | 天天射天天色天天干 | free性满足hd国产精品久 | 午夜激情视频在线 | 亚洲涩涩网站 | 偷拍老头老太高潮抽搐 | 久久青草热| 亚洲二区视频 | 一区二区三区亚洲视频 | 国产精品一区二区人妻喷水 | 99久久精品久久久久久清纯 | 少妇又紧又爽视频 | 亚洲中文无码久久 | 香蕉狠狠爱视频 | 天天干天天舔天天射 | 欧美特黄一级 | 少妇按摩一区二区三区 | 国产乱码久久久久久 | 日韩一区二区三区网站 | 欧美a视频 | 亚洲永久精品在线观看 | 亚洲欧美自拍视频 | 亚洲视频一二三 | 久久久久人妻精品一区二区三区 | 日韩欧美国产成人精品免费 | 久久久人 | 四季av一区二区三区免费观看 | 国精产品一区一区三区mba下载 | 中国成人av | 精品国产一区二区三区在线观看 | 日韩av在线免费播放 | 日本v片| 麻豆av免费看 | 欧亚乱熟女一区二区在线 | 国产三级av在线播放 | 精品成人一区二区三区久久精品 | 国产在线不卡一区 | 黄视频免费观看 | 直接看的av网站 | 色射综合 |