数据接入服务 DIS-验证Plugin:验证DIS Source

时间:2023-11-01 16:20:00

验证DIS Source

  1. 使用PuTTY工具远程登录Flume所在服务器。
  2. 确认已配置好包含dis source的配置文件

    可基于Flume自带的flume-conf.properties.template修改,文件样例如下所示:
    agent.sources = dissourceagent.channels = memoryChannelagent.sinks = loggerSink# 定义 Source (使用dis source,从DIS读取数据)agent.sources.dissource.channels = memoryChannelagent.sources.dissource.type = com.cloud.dis.adapter.flume.source.DISSource agent.sources.dissource.streams = YOU_DIS_STREAM_NAMEagent.sources.dissource.ak = YOU_ACCESS_KEY_IDagent.sources.dissource.sk = YOU_SECRET_KEY_IDagent.sources.dissource.region = YOU_Regionagent.sources.dissource.projectId = YOU_PROJECT_IDagent.sources.dissource.endpoint = https://dis.${region}.cloud.comagent.sources.dissource.group.id = YOU_APP_NAME# 定义 Channelagent.channels.memoryChannel.type = memoryagent.channels.memoryChannel.capacity = 10000# 定义 Sink (使用logger sink,输出到控制台)agent.sinks.loggerSink.type = loggeragent.sinks.loggerSink.channel = memoryChannel

  3. 启动Flume程序,启动命令请参考Apache Flume官网指导。

    如果从Flume安装目录启动,示例命令如下所示:
    bin/flume-ng agent --conf-file conf/flume-conf.properties.template --name agent --conf conf/ -Dflume.root.logger=INFO,console

    其中bin/flume-ng agent表示启动Flume Agent;--conf-file 为用户编写的配置文件路径; --name 为配置文件中agent的名称, --conf 为Flume自带的conf/路径

    启动之后查看日志,若日志中有类似“source disSource started.”内容,表示DIS Source正常启动,其中“disSource”是用户配置的source名称。

  4. 检查DIS Source下载数据是否正常。

    向source指向的通道上传数据,如果flume没有报错且sink端能正常获取到数据,表示下载正常。

    如果使用步骤 2中示例的配置,则从DIS获取的数据会输出到控制台上,其内容显示为字节数组格式。

  5. 登录DIS控制台,等待2分钟后,查看表1中“streams”配置的通道的监控。如果显示有数据下载(蓝色线条),表示DIS Source运行成功。

support.huaweicloud.com/usermanual-dis/dis_01_0033.html