我使用gcloud app引擎来部署laravel,并使用cloud sql来部署数据库。之后我添加了read-replica。
database.php中
'driver' => 'mysql',
'read' => [
'host' => env('DB_HOST_READ', env('DB_HOST', '127.0.0.1')),
'unix_socket' => env('DB_SOCKET_READ', env('DB_SOCKET', '')),
],
'write' => [
'host' => env('DB_HOST_WRITE', env('DB_HOST', '127.0.0.1')),
'unix_socket' => env('DB_SOCKET_WRITE', env('DB_SOCKET', '')),
],
的app.yaml
DB_HOST_READ: 'localhost'
DB_SOCKET_READ: '/cloudsql/my-app-engine:asia-northeast1:cloudsql-db-read'
DB_HOST_WRITE: 'localhost'
DB_SOCKET_WRITE: '/cloudsql/my-app-engine:asia-northeast1:cloudsql-db'
我收到了错误 SQLSTATE [HY000] [2002]没有这样的文件或目录。
我正在做这件事吗?