tencent cloud

文档反馈

使用 CHDFS 作为 Druid 的 Deep storage

最后更新时间:2022-03-30 09:30:26

    环境依赖

    • CHDFS_JAR
    • Druid 版本:Druid-0.12.1。

    下载与安装

    获取 CHDFS JAR

    在官方 Github 上下载 CHDFS_JAR

    安装 CHDFS JAR

    使用 CHDFS 作为 Druid 的 Deep Storage,需要借助 Druid-hdfs-extension 实现。
    下载 CHDFS JAR 后,将chdfs_hadoop_plugin_network-1.7.jar拷贝到 Druid 安装路径extensions/druid-hdfs-storage以及hadoop-dependencies/hadoop-client/2.x.x下。

    使用方法

    配置修改

    1. 修改 Druid 安装路径的conf/druid/_common/common.runtime.properties文件,将 hdfs 的 extension 加入到druid.extensions.loadList中,同时指定 hdfs 为 Druid 的 deep storage,而路径则填写为 CHDFS 的路径:

      properties
      druid.extensions.loadList=["druid-hdfs-storage"]
      druid.storage.type=hdfs
      druid.storage.storageDirectory=ofs://<mountpoint>/<druid-path>
      
    2. conf/druid/_common/这个目录下,新建一个 hdfs 的配置文件 hdfs-site.xml,填入 CHDFS 的配置信息等:

      <!--?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.AbstractFileSystem.ofs.impl</name>
      <value>com.qcloud.chdfs.fs.CHDFSDelegateFSAdapter</value>
      </property>
      <property>
      <name>fs.ofs.impl</name>
      <value>com.qcloud.chdfs.fs.CHDFSHadoopFileSystemAdapter</value>
      </property>
      <!--本地 cache 的临时目录, 对于读写数据, 当内存 cache 不足时会写入本地硬盘, 这个路径若不存在会自动创建-->
      <property>
      <name>fs.ofs.tmp.cache.dir</name>
      <value>/data/chdfs_tmp_cache</value>
      </property>
      <!--appId 用户需要换成自己的 appid,可前往 https://console.tencentcloud.com/cam/capi 获取-->
      <property>
      <name>fs.ofs.user.appid</name>
      <value>125000001</value>
      </property>
      </configuration>

    上述配置的支持项与 CHDFS 官网文档描述完全一致,详情可参见 挂载 CHDFS文档。

    开始使用

    依次启动 Druid 进程,Druid 数据就可加载到 CHDFS 中。

    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持