上一篇logstash-output-jdbc使用中提到“运行bin/logstash -f test.conf时可能提示注册插件失败”,通过分析详细的错误日志,发现其赫然写着“connection is not available,request time out after 10000ms”,原来是mysql连接的问题,插件注册失败只是表象。

由于没有在logstash所在的机器A安装mysql,而是通过mysql connector 的jar包(logstash conf文件里指定了jar报路径),所以没有办法测试A到数据库机器B的连接是否成功,尝试过增加mysql connection_timeout的时间到300s,发现错误还是request time out after 10000ms,说明jar里有自己的时间设置。

百度良久,最后在mysql的my.ini文件(默认C:\PragramData\MySQL\MySQLServer 5.7目录下)中增加skip-name-resolve,重启mysql服务后,问题解决。原因是

MySQL处理用户连接时进行如下过程来验证用户的合法性(参考http://www.cnblogs.com/timeship/archive/2013/02/28/2937730.html):

When a new client connects to mysqld, mysqld spawns a new thread to handle the request. This thread first checks whether the host name is in the host name cache. If not, the thread attempts to resolve the host name:
The thread takes the IP address and resolves it to a host name (using gethostbyaddr()). It then takes that host name and resolves it back to the IP address (using gethostbyname()) and compares to ensure it is the original IP address.

logstash-output-jdbc遇到connection is not available,request time out after 10000ms的问题解决的更多相关文章

  1. Filebeat之input和output(包含Elasticsearch Output 、Logstash Output、 Redis Output、 File Output和 Console Output)

    前提博客 https://i.cnblogs.com/posts?categoryid=972313 Filebeat啊,根据input来监控数据,根据output来使用数据!!! Filebeat的 ...

  2. 使用 Logstash 和 JDBC 确保 Elasticsearch 与关系型数据库保持同步

    为了充分利用 Elasticsearch 提供的强大搜索功能,很多公司都会在既有关系型数据库的基础上再部署Elasticsearch.在这种情况下,很可能需要确保 Elasticsearch 与所关联 ...

  3. JDBC driver connection string大全

    Database   / data source URL format /   driver name Value Default port MySQL URL format: jdbc:mysql: ...

  4. Logstash使用jdbc同步MySQL中的数据

    [--26T20::,][WARN ][logstash.inputs.jdbc ] Exception when executing JDBC query {:exception=>#< ...

  5. atitit.故障排除------有时会错误com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset by peer: soc

    atitit.故障排除------有时会错误com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset by peer: soc ...

  6. SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30001ms.

    SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after ...

  7. tomcat one connection one thread one request one thread

    java - What is the difference between thread per connection vs thread per request? - Stack Overflow ...

  8. logstash output到kafka记录与总结( No entry found for connection 2)

    简述 本文记录logstash的output配置为kafka的过程.这里是简单的例子,输入为stdin,本文主要目的是为了记录在这次配置过程中遇到的问题和解决的过程及总结. 关于kafka集群的搭建可 ...

  9. logstash input jdbc连接数据库

    示例 以下配置能够实现从 SQL Server 数据库中查询数据,并增量式的把数据库记录导入到 ES 中. 1. 查询的 SQL 语句在 statement_filepath => " ...

随机推荐

  1. 【C++札记】友元

    C++封装的类增加了对类中数据成员的访问限制,从而保证了安全性.如想访问类中的私有成员需要通过类中提供的公共接口来访问,这样间接的访问方式,无疑使得程序的运行效率有所降低. 友元的提出可以使得类外的函 ...

  2. Delphi 开发微信公众平台 (一)- 定义数据结构

    先定义数据类型: unit rtcMW.Wechat.Types; interface uses Generics.Collections, Rest.Json, System.Json.Serial ...

  3. day34——僵尸进程和孤儿进程、互斥锁、进程之间的通信

    day34 僵尸进程和孤儿进程 基于unix环境(linux,macOS) 主进程需要等待子进程结束之后,主进程才结束 主进程时刻监测子进程的运行状态,当子进程结束之后,一段时间之内,将子进程进行回收 ...

  4. docker(一): 安装

    开始 docker是一个可以帮助开发者使用容器(containers)开发.部署和运行应用程序的平台.llinux下使用容器部署系统称为containerization. container 是映像( ...

  5. Sql CLR创建一个简单的表值函数

    1.创建面目: 2. 添加函数代码: using System; using System.Data.Sql; using Microsoft.SqlServer.Server; using Syst ...

  6. java之初识hibernate

    1. 使用jdbc进行数据库操作:获取数据库连接,编写sql语句,执行sql操作,关闭连接. 比如:每次创建连接,释放资源----使的执行效率降低: 解决方案:连接池. 编写sql语句动作----简单 ...

  7. 【BZOJ 2351】Matrix(Hash)

    题目链接 二维\(Hash\)类似二维前缀和,每一行看成一个\(h\)进制数,每一个以(1,1)为左上角的矩阵看成一个由每一行的\(Hash\)值组成的\(l\)进制数. 然后自己推推柿子就行. #i ...

  8. 从MVC -> MVVM ? 开发模式

    MVVM 到底是什么? view :由 MVC 中的 view 和 controller 组成,负责 UI 的展示,绑定 viewModel 中的属性,触发 viewModel 中的命令: viewM ...

  9. SpringMVC、SpringFox和Swagger整合项目实例

    目标 在做项目的时候,有时候需要提供其它平台(如业务平台)相关的HTTP接口,业务平台则通过开放的HTTP接口获取相关的内容,并完成自身业务~ 提供对外开放HTTP API接口,比较常用的是采用Spr ...

  10. redis被攻击,怎么预防

    今天,自己的redis服务器被黑客攻击了,数据全部被删除 从图中可以看到,在db0中多了一个crackit,他就是罪魁祸首,他的值就是ssh无密码连接时需要的authorized_keys. 我们被攻 ...