fluent/fluent-plugin-sql

Failed to flush the buffer

She1d0n opened this issue · 1 comments

My fluentd is 1.4.2,pg is 0.21.0. And my td-agent.conf about input/output is as follows:

<source>
  @type sql

  tag_prefix my.rdb  # optional, but recommended

  select_interval 60s  # optional
  select_limit 500     # optional

  <table>
    table issues
    tag issues  # optional
    update_column id,title,author_id,project_id,created_at,updated_at,description,milestone_id,state,iid,updated_by_id,weight,confidential,due_date,moved_to_id,lock_version,title_html,description_html,time_estimate,relative_position,service_desk_reply_to,cached_markdown_version,last_edited_at,last_edited_by_id,discussion_locked,closed_at,closed_by_id,state_id
  </table>
</source>

<match my.rdb.*>
  @type sql
  remove_tag_prefix my.rdb # optional, dual of tag_prefix in in_sql

  <table>
    table issues
    column_mapping 'id:id,title:title,author_id:author_id,project_id:project_id,created_at:created_at,updated_at:updated_at,description:description,milestone_id:milestone_id,state:state,iid:iid,updated_by_id:updated_by_id:updated_by_id,weight:weight,confidential:confidential,due_date:due_date,moved_to_id:moved_to_id,lock_version:lock_version,title_html:title_html,description_html:description_html,time_estimate:time_estimate,relative_position:relative_position,service_desk_reply_to:service_desk_reply_to,cached_markdown_version:cached_markdown_version,last_edited_at:last_edited_at,last_edited_by_id:last_edited_by_id,discussion_locked:discussion_locked,closed_at:closed_at,closed_by_id:closed_by_id,state_id:state_id'
  </table>

</match>

When I start fluentd,it is failed. Error logs are as follows:

  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/pg-0.21.0/lib/pg.rb:56:in `initialize'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/pg-0.21.0/lib/pg.rb:56:in `new'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/pg-0.21.0/lib/pg.rb:56:in `connect'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:692:in `connect'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:223:in `initialize'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `new'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `postgresql_connection'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:811:in `new_connection'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:855:in `checkout_new_connection'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:834:in `try_to_checkout_new_connection'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:795:in `acquire_connection'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:523:in `checkout'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:382:in `connection'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/activerecord-5.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:413:in `with_connection'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluent-plugin-sql-1.1.1/lib/fluent/plugin/out_sql.rb:231:in `write'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.4.2/lib/fluent/plugin/output.rb:1125:in `try_flush'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.4.2/lib/fluent/plugin/output.rb:1425:in `flush_thread_run'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.4.2/lib/fluent/plugin/output.rb:454:in `block (2 levels) in start'
  2019-06-19 09:10:32 +0800 [warn]: #0 /opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/fluentd-1.4.2/lib/fluent/plugin_helper/thread.rb:78:in `block in thread_create'
2019-06-19 09:10:33 +0800 [warn]: #0 failed to flush the buffer. retry_time=1 next_retry_seconds=2019-06-19 09:10:34 +0800 chunk="58ba2e1a420609cf4aa6ef44dd53ad50" error_class=PG::ConnectionBad error="\xE8\x87\xB4\xE5\x91\xBD\xE9\x94\x99\xE8\xAF\xAF:  \xE6\xB2\xA1\xE6\x9C\x89\xE7\x94\xA8\xE4\xBA\x8E\xE4\xB8\xBB\xE6\x9C\xBA \"10.10.5.230\", \xE7\x94\xA8\xE6\x88\xB7 \"postgres\", \xE6\x95\xB0\xE6\x8D\xAE\xE5\xBA\x93 \"gitlabhq_production\", SSL \xE5\x85\xB3\xE9\x97\xAD \xE7\x9A\x84 pg_hba.conf \xE8\xAE\xB0\xE5\xBD\x95\n"
  2019-06-19 09:10:33 +0800 [warn]: #0 suppressed same stacktrace
2019-06-19 09:10:34 +0800 [warn]: #0 failed to flush the buffer. retry_time=2 next_retry_seconds=2019-06-19 09:10:36 +0800 chunk="58ba2e1a420609cf4aa6ef44dd53ad50" error_class=PG::ConnectionBad error="\xE8\x87\xB4\xE5\x91\xBD\xE9\x94\x99\xE8\xAF\xAF:  \xE6\xB2\xA1\xE6\x9C\x89\xE7\x94\xA8\xE4\xBA\x8E\xE4\xB8\xBB\xE6\x9C\xBA \"10.10.5.230\", \xE7\x94\xA8\xE6\x88\xB7 \"postgres\", \xE6\x95\xB0\xE6\x8D\xAE\xE5\xBA\x93 \"gitlabhq_production\", SSL \xE5\x85\xB3\xE9\x97\xAD \xE7\x9A\x84 pg_hba.conf \xE8\xAE\xB0\xE5\xBD\x95\n"
  2019-06-19 09:10:34 +0800 [warn]: #0 suppressed same stacktrace

I can't understand the error :

 failed to flush the buffer. retry_time=2 next_retry_seconds=2019-06-19 09:10:36 +0800 chunk="58ba2e1a420609cf4aa6ef44dd53ad50" error_class=PG::ConnectionBad error="\xE8\x87\xB4\xE5\x91\xBD\xE9\x94\x99\xE8\xAF\xAF:  \xE6\xB2\xA1\xE6\x9C\x89\xE7\x94\xA8\xE4\xBA\x8E\xE4\xB8\xBB\xE6\x9C\xBA \"10.10.5.230\", \xE7\x94\xA8\xE6\x88\xB7 \"postgres\", \xE6\x95\xB0\xE6\x8D\xAE\xE5\xBA\x93 \"gitlabhq_production\", SSL \xE5\x85\xB3\xE9\x97\xAD \xE7\x9A\x84 pg_hba.conf \xE8\xAE\xB0\xE5\xBD\x95\n

What should I solve it ?

@She1d0n Your problem is not fluentd, it's a misconfiguration in pg_hba.conf
The error message you have (in English):
There is no pg_hba.conf record for host \"10.10.5.230\", user \"postgres\", database \"gitlabhq_production\", SSL closed

I'm pretty sure you have figured it out already, though. :)