上一篇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. SpringBoot整合AbstractRoutingDataSource实现读写分离

    在配置数据源时候,已经把主库和从库的数据源配置到DynamicDataSource里了 利用AbstractRoutingDataSource实现动态切换数据源,可以通过注解或者根据方法名前缀切换要使 ...

  2. 数据分析——Pandas的用法(Series,DataFrame)

    我们先要了解,pandas是基于Numpy构建的,pandas中很多的用法和numpy一致.pandas中又有series和DataFrame,Series是DataFrame的基础. pandas的 ...

  3. crontab 定时删除

    /60 * * * /bin/find /usr/local/****/****/****/****/****.log.2019* -exec rm -f {} ; >/dev/null 2&g ...

  4. 『Go基础』第1节 Go语言简介

    1. Go语言简介 Go语言起源于2007年, 并于2009年开源. Go语言是一门全新的静态类型开发语言, 具有自动垃圾回收, 丰富的内置类型, 错误处理, 并发编程等特征.

  5. Linux守护进程编写指南

    Linux守护进程编写指南 守护进程(Daemon)是运行在后台的一种特殊进程.它独立于控制终端并且周期性地执行某种任务或等待处理某些发生的事件.守护进程是一种很有用的进 程.Linux的大多数服务器 ...

  6. sql 分组后重复数据取时间最新的一条记录

    1.取时间最新的记录 不分组有重复(多条CreateTime一样的都是最新记录) select * from test t where pid in ( select PId from Test t ...

  7. Java调用WebService方法总结(7)--CXF调用WebService

    CXF = Celtix + XFire,继承了Celtix和XFire两大开源项目的精华,是一个开源的,全功能的,容易使用的WebService框架.文中所使用到的软件版本:Java 1.8.0_1 ...

  8. Django ORM整理

    字段类型 # 自增长 Auto = models.AutoField() BigAuto = models.BigAutoField() # 二进制 Binary = models.BinaryFie ...

  9. 汇总iOS开发中需要用到的开源库

    来源:http://mobile.51cto.com/hot-431256.htm 1.iOS &iPhone 网络异步加载 asi-http-request [1-1 ASI HTTP 下载 ...

  10. [LeetCode] 581. 最短无序连续子数组 ☆

    描述 给定一个整数数组,你需要寻找一个连续的子数组,如果对这个子数组进行升序排序,那么整个数组都会变为升序排序. 你找到的子数组应是最短的,请输出它的长度. 示例 1: 输入: [2, 6, 4, 8 ...