zenoh s3 存储插件使用

s3 存储插件可以方便的将数据持久化到对象存储中,同时基于s3 插件的特点以及zenoh 的能力实现方便的数据读写分离

参考玩法

可以将数据写入到s3中,同时对于不同的策略可以实现读写分离(可以基于数据复制以及基于zenoh的数据路由),玩法特别多

参考配置

  • zenoh router 配置
{
  "id":"1000",
  "mode": "router",
  "connect": {
    "endpoints": ["tcp/172.16.238.12:7447"]
  },
  "plugins": {
    "mqtt": {
      "port": 1883
    },
    // configuration of "storage-manager" plugin:
    "storage_manager": {
      "volumes": {
        // configuration of a "fs" volume (the "zenoh_backend_fs" backend library will be loaded at startup)
        "fs": {},
        "s3": {
          "region": "eu-west-1",
          "url": "http://172.16.238.10:9000"
        }
      },
      "storages": {
        // configuration of a "demo" storage using the "fs" volume
        "demo": {
          // the key expression this storage will subscribes to
          "key_expr": "demo/example/**",
          // this prefix will be stripped from the received key when converting to file path
          // this argument is optional.
          "strip_prefix": "demo/example",
          "volume": {
            "id": "fs",
            // the key/values will be stored as files within this directory (relative to ${ZENOH_BACKEND_FS_ROOT})
            "dir": "example"
          }
        },
        // s3 配置
        "s3_test": {
          // the key expression this storage will subscribes to
          "key_expr": "demo/example/**",
          // this prefix will be stripped from the received key when converting to file path
          // this argument is optional.
          // "strip_prefix": "demo/example",
          "volume": {
            "id": "s3",
            "bucket": "zenoh-bucket",
            "reuse_bucket": true,
            "private": {
              // Credentials for interacting with the S3 bucket
              "access_key": "minio",
              "secret_key": "minio123"
            }
          }
        }
      }
    },
    // Optionally, add the REST plugin
    "rest": {
      "http_port": 8000
    }
  },
  "adminspace": {
    "permissions": {
      "read": true,
      "write": true
    }
  }
}
  • 效果

说明

基于s3存储插件可以实现比较有意思的玩法,实现灵活的数据存储以及访问处理,但是目前也是有一些现实的,详细的可以参考官方的blog 文档

参考资料

https://zenoh.io/blog/2023-07-17-s3-backend/

https://github.com/eclipse-zenoh/zenoh-backend-s3

posted on 2024-12-21 08:00  荣锋亮  阅读(11)  评论(0编辑  收藏  举报

导航