【问题标题】:How to emit metrics from remote Storm worker to a Graphite server when using a customized IScheduler?使用自定义 IScheduler 时,如何从远程 Storm 工作人员向 Graphite 服务器发送指标?
【发布时间】:2019-03-21 10:03:06
【问题描述】:

我很好地收集了从 Apache Storm 到 Graphite 的指标。然后我开发了一个实现 IScheduler 接口的自定义调度程序,现在我无法收集任何指标。

这是我的scheduler

public class SiteAwareScheduler implements IScheduler {
    @Override
    public void prepare(Map conf) {
    }
    @Override
    public void schedule(Topologies topologies, Cluster cluster) {
        ....
    }
}

在storm.yaml文件上:

supervisor.scheduler.meta:
  site: "cluster"
storm.scheduler: "org.sense.storm.scheduler.SiteAwareScheduler"

我正在使用this library 收集指标并将其发送到 Graphite 服务器。

public class MyTopology {
    config.put(YammerFacadeMetric.FACADE_METRIC_TIME_BUCKET_IN_SEC, 30);
    config.put(SimpleGraphiteStormMetricProcessor.GRAPHITE_HOST, "127.0.0.1");
    config.put(SimpleGraphiteStormMetricProcessor.GRAPHITE_PORT, 2003);
    config.put(SimpleGraphiteStormMetricProcessor.REPORT_PERIOD_IN_SEC, 10);
    config.put(Config.TOPOLOGY_NAME, "MqttSensorSumTopology");
    config.registerMetricsConsumer(MetricReporter.class, new MetricReporterConfig(".*", SimpleGraphiteStormMetricProcessor.class.getCanonicalName()), 1);
    ...
    TopologyBuilder topologyBuilder = new TopologyBuilder();
    ...
    topologyBuilder.setBolt(MqttSensors.BOLT_SENSOR_TICKET_SUM.getValue(), new SumSensorValuesWindowBolt(SensorType.COUNTER_TICKETS).withTumblingWindow(Duration.seconds(5)), 1)
.shuffleGrouping(MqttSensors.SPOUT_STATION_01_TICKETS.getValue())
.addConfiguration(TagSite.SITE.getValue(), TagSite.CLUSTER.getValue());
}

public class SumSensorValuesWindowBolt extends BaseWindowedBolt {
    public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) {
        StormYammerMetricsAdapter.configure(stormConf, context, new MetricsRegistry());
        this.collector = collector;
    }
    public void execute(TupleWindow inputWindow) {
        ...
    }
}

IScheduler 的“准备”方法没有 TopologyContext,所以我不知道在哪里用新的计划实例化我的指标。

有什么提示吗? 谢谢 费利佩

【问题讨论】:

    标签: apache-storm scheduling graphite graphite-carbon


    【解决方案1】:

    我按照link 上的说明安装了 Graphite。然后我按照link 在两台机器上的说明配置了文件storm.yaml。主人和工人。

    storm.metrics.reporters:
      # Graphite Reporter
      - class: "org.apache.storm.metrics2.reporters.GraphiteStormReporter"
        daemons:
            - "supervisor"
            - "nimbus"
            - "worker"
        report.period: 60
        report.period.units: "SECONDS"
        graphite.host: "localhost"
        graphite.port: 2003
    

    然后指标出现在我的拓扑名称MqttSensorSumTopology-1-1553506290 下的 Graphite 服务器上。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-23
      • 2011-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多