使用logstash同步MySQL的数据时,在jdbc查询sql文件时报sql语法错误,sql文件是navicat生成的
Logstash | 作者 littlemanta | 发布于2020年12月11日 | 阅读数:2244
使用logstash同步MySQL的数据时,在jdbc查询sql文件时报sql语法错误,并且错误总是near在第1行,sql文件的编码是utf8mb64 ,不知道是否是编码问题 logstash配置jdbc如下:
jdbc {
type => "jdbc"
jdbc_connection_string => "jdbc:mysql://host:3306/v-monitor?useUnicode=true&characterEncoding=UTF-8&userSSL=false&serverTimezone=GMT%2B8"
jdbc_user => "xx"
jdbc_password => "xxxxx"
jdbc_driver_library => "/usr/local/elasticsearch/elasticsearch-7.8.1/lib/mysql/mysql-connector-java-8.0.21.jar"
jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
connection_retry_attempts => "3"
jdbc_validate_connection => "true"
jdbc_validation_timeout => "3600"
jdbc_paging_enabled => "true"
jdbc_page_size => "500"
statement_filepath => "/usr/local/logstash/logstash-7.8.1/config/l_message.sql"
lowercase_column_names => true
sql_log_level => warn
record_last_run => true
use_column_value => true
tracking_column => "event_id"
tracking_column_type => numeric
last_run_metadata_path => "/usr/local/logstash/logstash-7.8.1/config/last_id.txt"
clean_run => false
schedule => "* * * * *"
异常信息如下:Exception when executing JDBC query {:exception=>"Java::JavaSql::SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO `l_message` VALUES (1, '' at line 1"}
请各位大佬慷慨相助啊!感谢!
jdbc {
type => "jdbc"
jdbc_connection_string => "jdbc:mysql://host:3306/v-monitor?useUnicode=true&characterEncoding=UTF-8&userSSL=false&serverTimezone=GMT%2B8"
jdbc_user => "xx"
jdbc_password => "xxxxx"
jdbc_driver_library => "/usr/local/elasticsearch/elasticsearch-7.8.1/lib/mysql/mysql-connector-java-8.0.21.jar"
jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
connection_retry_attempts => "3"
jdbc_validate_connection => "true"
jdbc_validation_timeout => "3600"
jdbc_paging_enabled => "true"
jdbc_page_size => "500"
statement_filepath => "/usr/local/logstash/logstash-7.8.1/config/l_message.sql"
lowercase_column_names => true
sql_log_level => warn
record_last_run => true
use_column_value => true
tracking_column => "event_id"
tracking_column_type => numeric
last_run_metadata_path => "/usr/local/logstash/logstash-7.8.1/config/last_id.txt"
clean_run => false
schedule => "* * * * *"
异常信息如下:Exception when executing JDBC query {:exception=>"Java::JavaSql::SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO `l_message` VALUES (1, '' at line 1"}
请各位大佬慷慨相助啊!感谢!
0 个回复