searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

Elasticsearch适配天翼云ZOS对象存储

2024-07-17 09:39:41
23
0

ZOS概述

对象存储(简称ZOS,Zettabyte Object Storge)是天翼云为客户提供的一种海量、弹性、高可靠、高性价比的存储产品,是专门针对云计算、大数据和非结构化数据的海量存储形态,通过S3协议和标准的服务接口,提供非结构化数据(图片、音视频、文本等格式文件)的无限存储服务。

 

架构

对象(Object)是对象存储的基本单元,可以是任意大小的二进制数据,通常以文件的形式存在。对象存储中,数据以对象(Object)的形式进行存储,每个对象由元数据(Metadata)、文件数据(Data)、对象ID(OID)组成。

元数据(Metadata)是描述对象的属性和特征的信息,以键值对(Key-Value)的形式被上传到ZOS中。

文件数据(Data)即文件的数据内容。

对象ID(OID) 即对象的名称,一个桶里的每个对象必须拥有唯一的对象ID。

桶(Bucket)是存储对象的容器,用户可以在桶中创建、组织和管理对象。

应用场景

数据备份

对象存储主要满足各种应用软件、本地数据库、RDS和非结构化数据的备份归档需求,还可以为云主机、云硬盘等产品提供备份存储能力。主要优势在于同资源池IAAS、PAAS资源内网天然互通,节约了外网流量费用。在需要时,还可将ZOS中的数据迁移至其他地域实现异地灾备。

数据迁移

天翼云提供了对象存储迁移能力,可将ZOS中的数据迁移至不同地域下的桶中,亦可将其他服务商的对象存储数据迁移至ZOS中。

 

ZOS适配Elasticsearch

开通ZOS

获得AKSKendpoint,建好bucket

 

配置Elastisearch

配置在上面获得的AKSK:

bin/elasticsearch-keystore add s3.client.default.access_key

bin/elasticsearch-keystore add s3.client.default.secret_key

 

在配置文件中配置region:

vim config/elasticsearch.yml

增加:

s3.client.default.region: cn-huadong-1

 

联通测试

配置repository:

curl -X PUT "ip:9200/_snapshot/test_repository?pretty" -H 'Content-Type: application/json' -d'

{

  "type": "s3",

  "settings": {

    "bucket": "bucket-****",

    "base_path": "test/subdir",

    "protocol": "http",

    "endpoint": "ip:80"

  }

}'

 

成功后会显示:

{

  "acknowledged" : true

}

 

创建测试index

curl -X PUT "ip:9200/my_index" -H 'Content-Type: application/json' -d'

{

  "settings": {

    "number_of_shards": 1,

    "number_of_replicas": 0

  },

  "mappings": {

    "properties": {

      "name": {

        "type": "text"

      },

      "age": {

        "type": "integer"

      }

    }

  }

}'

 

插入数据:

curl -X POST "ip:9200/my_index/_doc" -H 'Content-Type: application/json' -d'

{

  "name": "John Doe",

  "age": 30

}'

 

curl -X POST "ip:9200/my_index/_doc" -H 'Content-Type: application/json' -d'

{

  "name": "Jane Doe",

  "age": 25

}'

 

创建快照:

curl -X PUT "ip:9200/_snapshot/test_repository/test_snapshot?wait_for_completion=true&pretty" -H 'Content-Type: application/json' -d'

{

  "indices": "my_index"

}'

 

ZOS中此时应该有相应的数据。

 

索引恢复测试

删除elasticsearch里的索引:

curl -X DELETE "ip:9200/my_index?pretty"

 

恢复索引:

curl -X POST "ip:9200/_snapshot/test_repository/test_snapshot/_restore?pretty"

 

此时应该可以看到索引又恢复了。

0条评论
0 / 1000
InnerPeace
5文章数
0粉丝数
InnerPeace
5 文章 | 0 粉丝
原创

Elasticsearch适配天翼云ZOS对象存储

2024-07-17 09:39:41
23
0

ZOS概述

对象存储(简称ZOS,Zettabyte Object Storge)是天翼云为客户提供的一种海量、弹性、高可靠、高性价比的存储产品,是专门针对云计算、大数据和非结构化数据的海量存储形态,通过S3协议和标准的服务接口,提供非结构化数据(图片、音视频、文本等格式文件)的无限存储服务。

 

架构

对象(Object)是对象存储的基本单元,可以是任意大小的二进制数据,通常以文件的形式存在。对象存储中,数据以对象(Object)的形式进行存储,每个对象由元数据(Metadata)、文件数据(Data)、对象ID(OID)组成。

元数据(Metadata)是描述对象的属性和特征的信息,以键值对(Key-Value)的形式被上传到ZOS中。

文件数据(Data)即文件的数据内容。

对象ID(OID) 即对象的名称,一个桶里的每个对象必须拥有唯一的对象ID。

桶(Bucket)是存储对象的容器,用户可以在桶中创建、组织和管理对象。

应用场景

数据备份

对象存储主要满足各种应用软件、本地数据库、RDS和非结构化数据的备份归档需求,还可以为云主机、云硬盘等产品提供备份存储能力。主要优势在于同资源池IAAS、PAAS资源内网天然互通,节约了外网流量费用。在需要时,还可将ZOS中的数据迁移至其他地域实现异地灾备。

数据迁移

天翼云提供了对象存储迁移能力,可将ZOS中的数据迁移至不同地域下的桶中,亦可将其他服务商的对象存储数据迁移至ZOS中。

 

ZOS适配Elasticsearch

开通ZOS

获得AKSKendpoint,建好bucket

 

配置Elastisearch

配置在上面获得的AKSK:

bin/elasticsearch-keystore add s3.client.default.access_key

bin/elasticsearch-keystore add s3.client.default.secret_key

 

在配置文件中配置region:

vim config/elasticsearch.yml

增加:

s3.client.default.region: cn-huadong-1

 

联通测试

配置repository:

curl -X PUT "ip:9200/_snapshot/test_repository?pretty" -H 'Content-Type: application/json' -d'

{

  "type": "s3",

  "settings": {

    "bucket": "bucket-****",

    "base_path": "test/subdir",

    "protocol": "http",

    "endpoint": "ip:80"

  }

}'

 

成功后会显示:

{

  "acknowledged" : true

}

 

创建测试index

curl -X PUT "ip:9200/my_index" -H 'Content-Type: application/json' -d'

{

  "settings": {

    "number_of_shards": 1,

    "number_of_replicas": 0

  },

  "mappings": {

    "properties": {

      "name": {

        "type": "text"

      },

      "age": {

        "type": "integer"

      }

    }

  }

}'

 

插入数据:

curl -X POST "ip:9200/my_index/_doc" -H 'Content-Type: application/json' -d'

{

  "name": "John Doe",

  "age": 30

}'

 

curl -X POST "ip:9200/my_index/_doc" -H 'Content-Type: application/json' -d'

{

  "name": "Jane Doe",

  "age": 25

}'

 

创建快照:

curl -X PUT "ip:9200/_snapshot/test_repository/test_snapshot?wait_for_completion=true&pretty" -H 'Content-Type: application/json' -d'

{

  "indices": "my_index"

}'

 

ZOS中此时应该有相应的数据。

 

索引恢复测试

删除elasticsearch里的索引:

curl -X DELETE "ip:9200/my_index?pretty"

 

恢复索引:

curl -X POST "ip:9200/_snapshot/test_repository/test_snapshot/_restore?pretty"

 

此时应该可以看到索引又恢复了。

文章来自个人专栏
你知道为了搜索
5 文章 | 1 订阅
0条评论
0 / 1000
请输入你的评论
1
1