Build a Elasticsearch service environment and synchronize with MySQL data

Source: Internet
Author: User
Tags logstash

1, installation Elasticsearch

Official website Download: Https://www.elastic.co/downloads/elasticsearch

2, Installation Elasticsearch-head

GitHub Address: Https://github.com/mobz/elasticsearch-head, follow the instructions on GitHub to complete the installation (you need to install the node. JS Environment)

3. Install Logstash (for data synchronization)

: Https://www.elastic.co/cn/downloads/logstash. After decompression modify the Logstash folder under the Gemfile file, change the source to: https://gems.ruby-china.org

4, Installation Logstash-input-jdbc

Enter Logstash/bin, execute logstash-plugin install LOGSTASH-INPUT-JDBC.

5. Prepare to synchronize related files

Create a Lib directory under the bin directory and put Mysql-connector-java.jar

Create a new Jdbc.sql file in the bin directory, join and synchronize data-related SQL statements

Create a new logstash.conf file in the Config directory with the following contents:

Input {    stdin {    }    jdbc {      # mysql JDBC connection string to our backup databse      jdbc_connection_string = > "Jdbc:mysql://192.168.0.113:3306/telecom?characterencoding=utf8"      # The user we wish to excute our statement as< C6/>jdbc_user = "root"      jdbc_password "* * * * * * * * *" # The path to our      downloaded JDBC driver      jdbc_driver_li Brary = "Lib\mysql-connector-java-5.1.38.jar"      # The name of the driver class for MySQL      jdbc_driver_class =& Gt "Com.mysql.jdbc.Driver"      jdbc_paging_enabled = "true"      jdbc_page_size = "50000"      Statement_ filepath = "Jdbc.sql" schedule = "* * * * *      "    }}output {    Elasticsearch {        hosts = = ["192.168. 0.113:9200 "] Index        =" index name "document_type" = "Index type name"     }    stdout {        codec = Json_lines    }}
6. Perform data synchronization commands

Go to the Bin directory and execute logstash.bat-f. /config/logstash.conf

Build a Elasticsearch service environment and synchronize with MySQL data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.