Данные не синхронизируются с Elastic Search 6.5.1 - PullRequest
0 голосов
/ 30 ноября 2018

База данных Mysql

Я ссылался на эти ссылки:

Файл конфигурации

logstash-sample.conf

                # Sample Logstash configuration for creating a simple
                # Beats -> Logstash -> Elasticsearch pipeline.

                                            jdbc {
                jdbc_driver_library => "C:/logstash-6.5.1/logstash-core/lib/jars/x-pack-sql-jdbc-6.5.1.jar"
                jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
                jdbc_connection_string => "jdbc:mysql://localhost:3306/test"
                jdbc_user => "root"
                jdbc_password => ""
                statement => "SELECT * FROM persons"
                jdbc_paging_enabled => "true"
                jdbc_page_size => "50000"
                }

                }

                output{
                elasticsearch { codec => json hosts => ["localhost:9200"] index => "persons" }
                stdout { codec => rubydebug }
                }

Проверка имени базы данных

Персонажи таблицы данных

Индекс лица

Журналы

            C:\logstash-6.5.1\bin>logstash -f logstash-sample.conf
            Sending Logstash logs to C:/logstash-6.5.1/logs which is now configured via log4j2.properties
            [2018-11-30T18:10:52,868][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
            [2018-11-30T18:10:52,883][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"6.5.1"}
            [2018-11-30T18:10:53,550][INFO ][logstash.config.source.local.configpathloader] No config files found in path {:path=>"C:/logstash-6.5.1/bin/logstash-sample.conf"}
            [2018-11-30T18:10:53,559][ERROR][logstash.config.sourceloader] No configuration found in the configured sources.
            [2018-11-30T18:10:53,894][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}

Запрос GET

http://localhost:9200/persons/_search/?pretty

            {
                "error": {
                    "root_cause": [
                        {
                            "type": "index_not_found_exception",
                            "reason": "no such index",
                            "resource.type": "index_or_alias",
                            "resource.id": "persons",
                            "index_uuid": "_na_",
                            "index": "persons"
                        }
                    ],
                    "type": "index_not_found_exception",
                    "reason": "no such index",
                    "resource.type": "index_or_alias",
                    "resource.id": "persons",
                    "index_uuid": "_na_",
                    "index": "persons"
                },
                "status": 404
            }

Любое предложение приветствуется

Ответы [ 2 ]

0 голосов
/ 07 декабря 2018

Решение, которое сработало

windows

  1. неверный путь Jdbc.
  2. проблема с драйвером mysql.

Config

                        jdbc {
                        jdbc_driver_library => "C:/logstash-6.5.1/logstash-core/lib/jars/x-pack-sql-jdbc-6.5.1.jar"
                        jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
                        jdbc_connection_string => "jdbc:mysql://localhost:3306/test"
                        jdbc_user => "root"
                        jdbc_password => ""
                        statement => "SELECT * FROM persons"
                        jdbc_paging_enabled => "true"
                        jdbc_page_size => "50000"
                        }

                        }

                        output{
                        elasticsearch { codec => json hosts => ["127.0.0.1:9200:9200"] index => "persons" }
                        stdout { codec => rubydebug }
                        }

Надеюсь, что это поможет другим.

0 голосов
/ 30 ноября 2018

Хорошо, поскольку вы находитесь в папке logstash/bin, а ваше поле logstash-sample.conf находится в папке logstash/config, вам необходимо запустить logstash следующим образом:

C:\logstash-6.5.1\bin> logstash -f ../config/logstash-sample.conf
                                        ^
                                        |
                               add this relative path
...