+-
首页 专栏 linux 文章详情
qbit 发布于 3 月 8 日
关注作者
关注作者

0
将 ES 的快照备份到 Windows 共享目录(qbit)
前言
环境Elasticsearch 7.10.1
ES 所在服务器操作系统为 Ubuntu 20.04
Windows 服务器版本为 Windows Server 2019 已将
Windows 的
//172.31.19.143/es_snapshot 共享目录挂载到 ES 服务器的
/mnt/winshare 目录 Linux 挂载 Windows 共享目录参见: Ubuntu 20.04 读写 Windows 10 共享目录
修改 ES 服务配置
在elasticsearch.yml 文件中添加如下配置,并重启 ES 服务
path.repo:
- /mnt/winshare
注册快照仓库
官方文档: https://www.elastic.co/guide/...PUT /_snapshot/my_backup
{
"type": "fs",
"settings": {
"location": "/mnt/winshare/es_snapshot"
}
} HDFS 与 S3 可以用以下两个参数控制速度,
mount 的文件系统不可以
"max_snapshot_bytes_per_sec": "100mb", # 调整快照创建的速度,默认 40mb
"max_restore_bytes_per_sec": "200mb", # 调整快照恢复的速度,默认无限制 查看所有注册的快照仓库
GET _snapshot/_all 调整机器恢复分片速度和并发数
PUT _cluster/settings
{
"transient": {
"indices.recovery.max_bytes_per_sec": "200mb", # 默认 40mb
"cluster.routing.allocation.node_concurrent_recoveries": "5" # 默认 2
}
} 查看集群配置(包括默认配置)
GET _cluster/settings?flat_settings&include_defaults
创建快照
官方文档: https://www.elastic.co/guide/...PUT /_snapshot/my_backup/snapshot_zt
{
"indices": "zt_product_doc_index_20210223_3"
} 查看一个
my_backup仓库下的所有快照
GET _snapshot/my_backup/_all 查看
snapshot_zt 快照的概要状态
GET _snapshot/my_backup/snapshot_zt 查看
snapshot_zt 快照的详细状态
GET _snapshot/my_backup/snapshot_zt/_status
恢复快照
官方文档: https://www.elastic.co/guide/...POST /_snapshot/my_backup/snapshot_zt/_restore
{
"indices": "zt_product_doc_index_20210223_3",
"index_settings": {
"index.number_of_replicas": 0
},
"rename_pattern": "zt_product_doc_index_20210223_3",
"rename_replacement": "zt_product_doc_index_20210223_3_restore"
} 增加副本
PUT zt_product_doc_index_20210223_3_restore/_settings
{
"index.number_of_replicas" : "1"
}
本文出自 qbit snap
linux elasticsearch snapshot
阅读 43 更新于 6 分钟前
赞
收藏
分享
本作品系原创, 采用《署名-非商业性使用-禁止演绎 4.0 国际》许可协议
qbit snap
开箱即用,拿走不谢。
关注专栏
qbit
189 声望
49 粉丝
0 条评论
得票 时间
提交评论
qbit
189 声望
49 粉丝
宣传栏
目录
▲
前言
环境Elasticsearch 7.10.1
ES 所在服务器操作系统为 Ubuntu 20.04
Windows 服务器版本为 Windows Server 2019 已将
Windows 的
//172.31.19.143/es_snapshot 共享目录挂载到 ES 服务器的
/mnt/winshare 目录 Linux 挂载 Windows 共享目录参见: Ubuntu 20.04 读写 Windows 10 共享目录
修改 ES 服务配置
在elasticsearch.yml 文件中添加如下配置,并重启 ES 服务
path.repo:
- /mnt/winshare
注册快照仓库
官方文档: https://www.elastic.co/guide/...PUT /_snapshot/my_backup
{
"type": "fs",
"settings": {
"location": "/mnt/winshare/es_snapshot"
}
} HDFS 与 S3 可以用以下两个参数控制速度,
mount 的文件系统不可以
"max_snapshot_bytes_per_sec": "100mb", # 调整快照创建的速度,默认 40mb
"max_restore_bytes_per_sec": "200mb", # 调整快照恢复的速度,默认无限制 查看所有注册的快照仓库
GET _snapshot/_all 调整机器恢复分片速度和并发数
PUT _cluster/settings
{
"transient": {
"indices.recovery.max_bytes_per_sec": "200mb", # 默认 40mb
"cluster.routing.allocation.node_concurrent_recoveries": "5" # 默认 2
}
} 查看集群配置(包括默认配置)
GET _cluster/settings?flat_settings&include_defaults
创建快照
官方文档: https://www.elastic.co/guide/...PUT /_snapshot/my_backup/snapshot_zt
{
"indices": "zt_product_doc_index_20210223_3"
} 查看一个
my_backup仓库下的所有快照
GET _snapshot/my_backup/_all 查看
snapshot_zt 快照的概要状态
GET _snapshot/my_backup/snapshot_zt 查看
snapshot_zt 快照的详细状态
GET _snapshot/my_backup/snapshot_zt/_status
恢复快照
官方文档: https://www.elastic.co/guide/...POST /_snapshot/my_backup/snapshot_zt/_restore
{
"indices": "zt_product_doc_index_20210223_3",
"index_settings": {
"index.number_of_replicas": 0
},
"rename_pattern": "zt_product_doc_index_20210223_3",
"rename_replacement": "zt_product_doc_index_20210223_3_restore"
} 增加副本
PUT zt_product_doc_index_20210223_3_restore/_settings
{
"index.number_of_replicas" : "1"
}
本文出自 qbit snap