I have a node-mysql pool configuration of
var db_init={
host : \'ip_address_of_GCS_SQL\',
user : \'user_name_of_GCS_SQL\',
I suspect the reason is that keepalive is not enabled on the connection to the MySQL server.
node-mysql
does not have an option to enable keepalive and neither does node-mysql2
, but node-mysql2
provides a way to supply a custom function for creating sockets which we can use to enable keepalive:
var mysql = require('mysql2');
var net = require('net');
var pool = mysql.createPool({
connectionLimit : 100,
host : '123.123.123.123',
user : 'foo',
password : 'bar',
database : 'baz',
stream : function(opts) {
var socket = net.connect(opts.config.port, opts.config.host);
socket.setKeepAlive(true);
return socket;
}
});