在過去的幾個月中,我遇到了一個問題,我在亞馬遜ec2服務器上部署了我的應用程序,但每天至少有10到30次出現這些錯誤。在Amazon Ec2服務器上丟失數據庫連接
1) Error: connect ETIMEDOUT
at errnoException (net.js:904:11)
at Object.afterConnect [as oncomplete] (net.js:895:19)
2) Error: getaddrinfo ENOTFOUND
at errnoException (dns.js:37:11)
at Object.onanswer [as oncomplete] (dns.js:124:16)
--------------------
at Handshake.Sequence (/var/app/current/node_modules/mysql/lib/protocol/sequences/Sequence.js:15:20)
at new Handshake (/var/app/current/node_modules/mysql/lib/protocol/sequences/Handshake.js:9:12)
at Protocol.handshake (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:42:50)
at Connection.connect (/var/app/current/node_modules/mysql/lib/Connection.js:72:18)
at module.exports.connect (/var/app/current/node_modules/sequelize/lib/dialects/mysql/connector-manager.js:276:16)
at Object.pool.Pooling.Pool.create (/var/app/current/node_modules/sequelize/lib/dialects/mysql/connector-manager.js:125:19)
at createResource (/var/app/current/node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:258:13)
at dispense (/var/app/current/node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:250:9)
at Object.me.acquire (/var/app/current/node_modules/sequelize/node_modules/generic-pool/lib/generic-pool.js:316:5)
at module.exports.enqueue (/var/app/current/node_modules/sequelize/lib/dialects/mysql/connector-manager.js:320:19)
3) TypeError: Uncaught, unspecified "error" event.
at TypeError (<anonymous>)
at EventEmitter.emit (events.js:74:15)
at Handshake._callback (/var/app/current/node_modules/sequelize/lib/dialects/mysql/connector-manager.js:286:19)
at Handshake.Sequence.end (/var/app/current/node_modules/mysql/lib/protocol/sequences/Sequence.js:75:24)
at Protocol.handleNetworkError (/var/app/current/node_modules/mysql/lib/protocol/Protocol.js:238:14)
at Connection._handleNetworkError (/var/app/current/node_modules/mysql/lib/Connection.js:155:18)
at Socket.EventEmitter.emit (events.js:117:20)
at net.js:830:16
at process._tickDomainCallback (node.js:459:13)
任何想法如何解決這些問題?
在發佈之前,我在github上也發佈了類似的問題,我得到的答案令人不滿意,這是一個亞馬遜問題,許多人都面臨着這個問題。
那麼大家有關於這個問題的建議或解決方案?
你能描述一下你的部署嗎?是在Linux上運行的節點應用程序?是與節點應用程序在同一虛擬機上的mysql服務器?如果沒有,它是通過不可路由的本地IP地址或公共IP尋址的?它是否部署在亞馬遜RDS實例上?你有沒有修改節點應用程序虛擬機上的DNS設置? – aembke 2014-10-14 18:59:31
是節點應用程序在Linux上運行,並且mys sql server不在同一個VM上,並且它被部署在amazon RDS實例上。 – 2014-10-15 09:34:54