1.安装s3插件
sudo bin/elasticsearch-plugin install repository-s3
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for hadoop:
[hadoop@dyuit185 elasticsearch-7.15.0]$ ^C
[hadoop@dyuit185 elasticsearch-7.15.0]$ bin/elasticsearch-plugin install repository-s3
warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
-> Installing repository-s3
-> Downloading repository-s3 from elastic
[=================================================] 100%
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: plugin requires additional permissions @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.lang.RuntimePermission accessDeclaredMembers
* java.lang.RuntimePermission getClassLoader
* java.lang.reflect.ReflectPermission suppressAccessChecks
* java.net.SocketPermission * connect,resolve
* java.util.PropertyPermission es.allow_insecure_settings read,write
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.
Continue with installation? [y/N]y
-> Installed repository-s3
-> Please restart Elasticsearch to activate any plugins installed
离线下载安装:https://artifacts.elastic.co/downloads/elasticsearch-plugins/repository-s3/repository-s3-7.15.2.zip
安装命令:
bin/elasticsearch-plugin install file:/usr/local/elasticsearch-7.15.0/repository-s3-7.15.0.zip
修改config/jvm.options添加如下配置:
-Des.allow_insecure_settings=true
重新启动elasticsearch
删除插件命令:
sudo bin/elasticsearch-plugin remove repository-s3
2.添加s3,access_key,secret_key
bin/elasticsearch-keystore add s3.client.default.access_key
bin/elasticsearch-keystore add s3.client.default.secret_key
3.添加存储库
PUT _snapshot/my_s3_repository
{
"type": "s3",
"settings": {
"client": "default",
"bucket": "es-backup",
"endpoint": "oss-cn-hangzhou.aliyuncs.com",
"protocol":"https"
}
}
bucket:s3桶名称
endpoint: s3端点
client: 用于连接S3的S3客户端的名称。默认为default
base_path:指定存储库数据在其bucket中的路径,默认为空,不能以“/”开头和结尾
chunk_size: 如果需要,可以在快照期间将大文件分解为块。指定块大小为值和单位,例如:1TB、1GB、10MB。默认情况下,S3中blob的最大大小为5TB。
compress: 当设置为true时,元数据文件以压缩格式存储。默认情况下,此设置不会影响已经压缩的索引文件。默认为false
max_restore_bytes_per_sec: 节流每个节点的恢复速率。默认为无限制。请注意,还原也通过恢复设置进行限制
max_snapshot_bytes_per_sec: 节流每个节点的快照速率。默认为每秒40mb。
readonly: 使存储库只读。默认为false
server_side_encryption: 当设置为true时,文件在服务器端使用AES256算法加密。默认为false。
buffer_size: 使用单个请求上传块的最小阈值。超过这个阈值,S3存储库将使用AWS Multipart Upload API将数据块分成几个部分,每个部分的长度为buffer_size,并在自己的请求中上传每个部分。请注意,设置小于5mb的缓冲区大小是不允许的,因为它将阻止使用Multipart API,并可能导致上传错误。也不可能设置大于5gb的缓冲区大小,因为这是S3允许的最大上传大小。默认为100mb或JVM堆的5%,以较小者为准
canned_acl: S3存储库支持所有S3罐装acl: private、public-read、public-read-write、authenticated-read、log-delivery-write、bucket-owner-read、bucket-owner-full-control。默认为private。您可以使用canned_acl设置指定一个被封装的ACL。当S3存储库创建桶和对象时,它将罐装ACL添加到桶和对象中
4.使用kibana备份还原
参考:https://blog.csdn.net/tan809417133/article/details/133068800