• snapshot(持续更新中)


    首先先了解一下官网中提到的如何backup your elasticsearch

    https://www.elastic.co/guide/en/elasticsearch/guide/current/backing-up-your-cluster.html

    知识点

    1.关于repository的几种类型。

    (来自官网)To use this functionality, you must first create a repository to save data. There are several repository types that you may choose from:

    • Shared filesystem, such as a NAS
    • Amazon S3
    • HDFS (Hadoop Distributed File System)
    • Azure Cloud

    下面截图是来自kopf这个插件,url在上面没有提到,其他的都能对上

    总结一下:fs---->Shared filesystem

         s3---->Amazon S3

         hdfs--->HDFS (Hadoop Distributed File System)

           azure--->Azure Cloud

    下面是google的一篇不错的关于snapshot es的 java 代码。

    https://dzone.com/articles/how-use-elasticsearch-snapshot

    下面是我自己写的代码

    String repositoryPath = "E:\snapshot";
                boolean compress = true;
                String repositoryType = "fs";
                // es 2.4
                Settings setting = Settings.builder()
                        .put("location", repositoryPath)
                        .put("compress", compress).build();
                PutRepositoryResponse putRepositoryResponse = clusterAdminClient.preparePutRepository(defaultRepositoryName)
                        .setType(repositoryType).setSettings(setting)
                        .execute().actionGet();
                if (putRepositoryResponse.isAcknowledged()) {
                    System.out.println(defaultRepositoryName + " have been created");
                    
                    repositoryMetaDataList = clusterAdminClient.prepareGetRepositories(defaultRepositoryName).get().repositories();
                    System.out.println(repositoryMetaDataList.size());
                }

    Exception in thread "main" RepositoryVerificationException[[hippo_Repository] [VMYox38PS9qXN3hYhf588Q, 'RemoteTransportException[[node-hippo3][10.12.198.242:9300][internal:admin/repository/verify]]; nested: RepositoryVerificationException[[hippo_Repository] a file written by master to the store [/opt/hippo/snapshot/E:snapshot] cannot be accessed on the node [{node-hippo3}{VMYox38PS9qXN3hYhf588Q}{10.12.198.242}{10.12.198.242:9300}{master=true}]. This might indicate that the store [/opt/hippo/snapshot/E:snapshot] is not shared between this node and the master node or that permissions on the store don't allow reading files written by the master node];'], [EZQYXYKcTtuDCgjr17_M6g, 'RemoteTransportException[[node-hippo1][10.12.198.240:9300][internal:admin/repository/verify]]; nested: RepositoryVerificationException[[hippo_Repository] a file written by master to the store [/opt/hippo/snapshot/E:snapshot] cannot be accessed on the node [{node-hippo1}{EZQYXYKcTtuDCgjr17_M6g}{10.12.198.240}{10.12.198.240:9300}{master=false}]. This might indicate that the store [/opt/hippo/snapshot/E:snapshot] is not shared between this node and the master node or that permissions on the store don't allow reading files written by the master node];']]]
        at org.elasticsearch.repositories.RepositoriesService$VerifyingRegisterRepositoryListener$1.onResponse(RepositoriesService.java:440)
        ......

    一开始我以为,这个repositoryPath应该是绝对路径,从报错看到设置的应该是相对路径(开头不能是/,直接输入文件夹名字就好了),那么绝对的文件夹位置在哪里设置的,google了一下,发现在elasticsearch.yml中有个变量path.repo,恍然大悟。。。

  • 相关阅读:
    【转】如何使用分区助手完美迁移系统到SSD固态硬盘?
    mysql 使用正则表达式查询
    【转】ajax发送请求时候为什么会报拒绝设置不安全的header
    【转】如何修改 video 样式
    flashfxp软件设置并关联默认编辑器
    【转】Windows中设置Fiddler抓HTTPS请求的解决办法 Unable to configure Windows to Trust the Fiddler Root certificate .
    【转】观看视频时启用硬件加速有什么用?如果关闭硬件加速又有什么区别呢?
    【转】C盘不能扩展卷怎么回事 C盘扩展卷灰色的解决办法
    97. Interleaving String
    93. Restore IP Addresses
  • 原文地址:https://www.cnblogs.com/majw/p/6484234.html
Copyright © 2020-2023  润新知