Joe
Joe

Reputation: 72

Logstash can't connect ElasticSearch.Got response code '400' contacting Elasticsearch at URL 'http://127.0.0.1:9200/_license'

There is my envirmoment. ElasticSearch 7.8.0 ,Logstash 7.14.0 I tried transfer MySQL data to ElasticSearch.There is my pipline config.

input {
      stdin {
       }
      jdbc {
        jdbc_connection_string => "jdbc:mysql://127.0.0.1:3306/test?characterEncoding=UTF-8&useSSL=false&autoReconnect=true"
        jdbc_user => "username"
        jdbc_password => "password"
       jdbc_driver_library => "/etc/logstash/pipeline/mysql-connector-java-8.0.26.jar"

       jdbc_driver_class => "com.mysql.jdbc.Driver"
       jdbc_paging_enabled => "true"
       jdbc_page_size => "50000"
       codec => plain { charset => "UTF-8"}
     tracking_column => created_at
     record_last_run => true
     last_run_metadata_path => "/opt/logstash/lastrun/.logstash_jdbc_last_run"

      statement_filepath => "/etc/logstash/pipeline/jdbc.sql"

      clean_run => false

       schedule => "* * * * *"
       type => "std"
     }
 }


output {

    elasticsearch {

        hosts => "127.0.0.1:9200"

        index => "test"

        document_type => "testdb"


        document_id => "%{id}"
    }

    stdout {

        codec => json_lines

    }
}

When I start the logstash, It looks some error,I cannt sync data..

[2021-08-11T01:11:50,378][ERROR][logstash.outputs.elasticsearch][main] Unable to get license information {:url=>"http://127.0.0.1:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :message=>"Got response code '400' contacting Elasticsearch at URL 'http://127.0.0.1:9200/_license'"}
[2021-08-11T01:11:50,378][ERROR][logstash.outputs.elasticsearch][main] Could not connect to a compatible version of Elasticsearch {:url=>"http://127.0.0.1:9200/"}
[2021-08-11T01:11:51,645][ERROR][logstash.outputs.elasticsearch][main][d38f4c43e6fdc69444ff9aadc94fa4db5da791aa7892cf45e98fa87844fb0d43] Elasticsearch setup did not complete normally, please review previously logged errors {:message=>"No Available connections", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::NoConnectionAvailableError}
[2021-08-11T01:11:55,385][WARN ][logstash.outputs.elasticsearch][main] Restored connection to ES instance {:url=>"http://127.0.0.1:9200/"}

I start logstash with docker,in the docker environment,it connect elasticsearch in shell(curl 127.0.0.1:9200) correctly.

Why does Logstash visit http://127.0.0.1:9200/_license?

Upvotes: 0

Views: 1573

Answers (1)

Joe
Joe

Reputation: 72

  1. Logstash Version Should be Same as ElasticSearch Version.Thanks for @leandrojmp and @Val.
  2. The offical docker container has default setting,it contain xpack config,so I should editlogstash.yaml,remove xpack config or change it as note.

Some other advise.

With the license change from elastic, versions after 7.10 are not open source anymore and will only work with Elastic distribution of Elasticsearch using the Elastic License (the free one or one of the paid tiers).

Upvotes: 1

Related Questions