3

运行配置为使用具有适当实例名称的第二代 MYSQL 实例的 Google Nodejs 应用程序时,重复发生 ENOENT 错误。这适用于使用 cloudproxy 的本地主机,但会在计算集群实例中产生以下错误。应用引擎部署也会发生类似的错误。

error when connecting to db: { Error: connect ENOENT cybers-cafe:us-east1:cybers-cafe
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1085:14)
    --------------------
    at Protocol._enqueue (/home/jordocote/cybers-cafe-service/node_modules/mysql/lib/protocol/P
    at Protocol.handshake (/home/jordocote/cybers-cafe-service/node_modules/mysql/lib/protocol/
    at Connection.connect (/home/jordocote/cybers-cafe-service/node_modules/mysql/lib/Connectio
    at Timeout.handleDisconnect [as _onTimeout] (/home/jordocote/cybers-cafe-service/entities/r
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'connect',
  address: 'cybers-cafe:us-east1:cybers-cafe',
  fatal: true }

我尝试过使用各种 socketPath 值:

  • 网络咖啡馆:us-east1:网络咖啡馆,
  • /cloudsql/cybers-cafe:us-east1:cybers-cafe,
  • MYSQL 实例的 IP 地址(带和不带端口),
  • 仅 3306

它们都在计算集群实例和应用引擎部署中产生相同的错误。我也无法使用计算集群实例中的 mysql 客户端直接连接到 MYSQL 实例。

我已按照https://cloud.google.com/sql/docs/mysql/connect-app-engine等文档中的设置过程进行操作,如下所示:

env_variables:
  MYSQL_USER: ******
  MYSQL_PASSWORD: ***********
  MYSQL_DATABASE: cyberscafe
  # This path was printed to the console when you started the proxy, and is of
  # the format: `/[DIR]/[YOUR_PROJECT_ID]:[YOUR_REGION]:[YOUR_INSTANCE_NAME]`
  MYSQL_SOCKET_PATH: cybers-cafe:us-east1:cybers-cafe
beta_settings:
  # The connection name of your instance on its Overview page in the Google
  # Cloud Platform Console, or use `[YOUR_PROJECT_ID]:[YOUR_REGION]:[YOUR_INSTANCE_NAME]`
  cloud_sql_instances: cybers-cafe:us-east1:cybers-cafe
4

0 回答 0