Skip to content

Dynamic increasing/decreasing servers of out_forward #756

Closed
@toyama0919

Description

@toyama0919

Hi.

I wanted auto scale Aggregator for out_forward plugin.

I think server list can dynamically get with plugin.

Example

<match **>
  type forward
  buffer_type file
  buffer_path /var/log/td-agent/buffer/aggregate
  flush_interval 60s

  # dynamically define
  <servers>
    type ec2
    region ap-northeast-1
    port 24224
    tag { "Stages":"production", "Roles":"fluentd-aggregator" }
  </servers>

  # static define
  <server>
    host aggregator01
    port 24224
  </server>
</match>

Plugin Example(Amazon EC2 Plugin)

module Fluent
  class Ec2Servers < Servers
    Plugin.register_servers('ec2', self)

    include Configurable

    config_param :region, :string
    config_param :port, :string
    config_param :tag, :hash, :default => {}

    def initialize
      super
      require 'aws-sdk'
    end

    def configure(conf)
      super
      ....
    end

    def servers
      nodes = []

      AWS.ec2.client.describe_instances.each do |i|
        ##
        ## some process
        ##

        failure = FailureDetector.new(@heartbeat_interval, @hard_timeout, Time.now.to_i.to_f)

        node_conf = NodeConfig.new(ec2_name_tag, ec2_private_ip_address, @port, weight, standby, failure,
          @phi_threshold, recover_sample_size, @expire_dns_cache, @phi_failure_detector, @dns_round_robin)

        if @heartbeat_type == :none
          nodes << NoneHeartbeatNode.new(log, node_conf)
        else
          nodes << Node.new(log, node_conf)
        end
      end
      nodes
    end
  end
end

Other plugin Example

  • gce
  • azure
  • softlayer
  • sakura

Not need restart is Best, but need restart is simply😊

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature request*Deprecated Label* Use enhancement label in general

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions