node mysql timeout_Error: Handshake inactivity timeout in Node.js MYSQL module

问题

I'm using node-mysql and most of the queries. Working. some queries not working.

I tried every version of Node (from 0.5...) until (5.6.0), I also tried (4.0) and (4.1), Nothing helps.

I tried to change maually, and didn't work. I tried to change the sequence file to: this._idleTimeout = -1; and didn't help.

I read the issues and GitHub, and nothing helped.

I can try to fix it by myself, but I need more information. Where is the timeout, why? when? what is this type of message? Where is the timeout came from?

MYSQL_ERROR { [Error: Handshake inactivity timeout]

code: 'PROTOCOL_SEQUENCE_TIMEOUT', fatal: true,

timeout: 10000 }

回答1:

Ok, the timeout comes from the Protocol.js file line:162. If you checkout node-mysql you'll see that it is a variable "timeout" for queries. If you set the timeout to something a lot higher than 10000, the default, then the error should go away. An example is

pool = require('mysql').createPool({

connectionLimit : 1000,

connectTimeout : 60 * 60 * 1000,

acquireTimeout : 60 * 60 * 1000,

timeout : 60 * 60 * 1000,

host : process.env.DB_HOST,

user : process.env.DB_USERNAME,

password : process.env.DB_PASSWORD,

database : process.env.DB_DATABASE

});

You can also edit the timeout in the Sequence.js file (node_modules/mysql/lib/protocol/sequence/Sequence.js)

this._timeout = 100000;

回答2:

If you are using Amazon's services, I was able to resolve this by changing the allowed IP Addresses in the security settings or by changing the open connections ports.

回答3:

For those deploying on AWS and experiencing this error, you'll need to make a change to the security group of your database/cluster and add an inbound rule where the source is the security group of your instance/s.

The inbound rule should look as follows:

Type: MySQL/Aurora

Protocol: TCP (default)

Port: 3306 (default)

Source:

Description:

回答4:

for those deploying on aws and heroku! enter in rds db instance settigns and change the inboud rule --> source: any..

Heroku dont provide a ip specific, remember!

来源:https://stackoverflow.com/questions/35553432/error-handshake-inactivity-timeout-in-node-js-mysql-module

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值