tencent cloud

对象存储

文档对象存储实践教程大数据实践使用 COS 作为 Druid 的 Deep storage

使用 COS 作为 Druid 的 Deep storage

PDF
聚焦模式
字号
最后更新时间: 2024-01-06 10:54:03

环境依赖

HADOOP-COS 与 Hadoop-COS-Java-SDK(包含在 HADOOP-COS 的 dep 目录下)
Druid 版本:Druid-0.12.1

下载与安装

获取 hadoop-cos

在官方 Github 上下载 HADOOP-COS

安装 hadoop-cos

Druid 使用 COS 作为 Deep Storage 需要借助 Druid-hdfs-extension 实现: 下载 HADOOP-COS 后,将 dep 目录下的 hadoop-cos-2.x.x.jar 以及 cos_hadoop_api-5.2.6.jar 拷贝到 druid 安装路径的 extensions/druid-hdfs-storage 以及 hadoop-dependencies/hadoop-client/2.x.x。

使用方法

配置修改

首先,修改 druid 安装路径的 conf/druid/_common/common.runtime.properties 文件,将 hdfs 的extension 加入到 druid.extensions.loadList 中,同时指定 hdfs 为 druid 的 deep storage,而路径则填写为 cosn 的路径:
properties
druid.extensions.loadList=["druid-hdfs-storage"]
druid.storage.type=hdfs
druid.storage.storageDirectory=cosn://bucket-appid/<druid-path>
然后,在 conf/druid/_common/ 这个目录下新建一个 hdfs 的配置文件 hdfs-site.xml,填入 COS 的密钥信息等:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
-->
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>fs.cosn.userinfo.secretId</name>
<value>xxxxxxxxxxxxxxxxxxxxxxx</value>
</property>
<property>
<name>fs.cosn.userinfo.secretKey</name>
<value>xxxxxxxxxxxxxxx</value>
</property>
<property>
<name>fs.cosn.impl</name>
<value>org.apache.hadoop.fs.CosFileSystem</value>
</property>
<property>
<name>fs.cosn.userinfo.region</name>
<value>ap-xxxx</value>
</property>
<property>
<name>fs.cosn.tmp.dir</name>
<value>/tmp/hadoop_cos</value>
</property>
</configuration>
上述配置的支持项与 HADOOP-COS 官网文档描述完全一致,请查阅 HADOOP-COS 官方文档

开始使用

最后依次启动 druid 的进程后,Druid 的数据就可以加载到 COS 中。

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈