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