标签:mys rem tps 解压 connect bsp values -o 服务器
logstash版本:6.5.3,确保 JDK 的版本是 1.8
/usr/share/logstash/bin/logstash-plugin install logstash-output-jdbc
下载
https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.47.zip
解压安装
mkdir /etc/logstash/jdbc
cd /etc/logstash/jdbc
解压到/etc/logstash/jdbc目录
unzip mysql-connector-java-5.1.47.zip
CREATE TABLE test(
ID INT NOT NULL AUTO_INCREMENT,
TIME VARCHAR(25) NOT NULL,
IP VARCHAR(20) NOT NULL,
MESSAGES VARCHAR(255) NOT NULL,
PRIMARY KEY (ID)
);
output {
jdbc {
driver_jar_path => "/etc/logstash/jdbc/mysql-connector-java-5.1.47/mysql-connector-java-5.1.47-bin.jar"
driver_class => "com.mysql.jdbc.Driver"
connection_string => "jdbc:mysql://mysql服务器ip:端口/数据库?user=数据库用户名&password=数据库密码"
statement => [ "insert into 数据表 (TIME ,IP,MESSAGES) values (?,?,?)","%{@timestamp}" ,"%{host}","%{message}" ]
}
}
标签:mys rem tps 解压 connect bsp values -o 服务器
原文地址:https://www.cnblogs.com/longBlogs/p/10340252.html