第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何將 Google App Engine (Flex) Go 應(yīng)用連接到 Google Cloud

如何將 Google App Engine (Flex) Go 應(yīng)用連接到 Google Cloud

Go
慕哥9229398 2023-07-10 16:30:05
我正在用 Go 構(gòu)建一個(gè)應(yīng)用程序,并使用 Google App Engine 進(jìn)行部署。我已經(jīng)在 Google Cloud 上設(shè)置了一個(gè) PostgreSQL 實(shí)例,啟用了 API,并使用本地計(jì)算機(jī)上的 SQL 代理(從本地 PSequel 客戶端和我的應(yīng)用程序)成功連接到它。gcloud app deploy但是,當(dāng)我這樣做時(shí),我收到此錯(cuò)誤:ERROR: (gcloud.app.deploy) Error Response: [9] Application startup error:panic: dial unix /cloudsql/sapling:europe-west1:sapling/.s.PGSQL.5432: connect: no such file or directory我嘗試將 Postgres 實(shí)例從版本 11 Beta 降級(jí)到 9.6。還嘗試過使用這個(gè)驅(qū)動(dòng)程序https://github.com/broady/gae-postgres,這看起來很有希望,但我無法在 Flex 環(huán)境中工作。應(yīng)用程序.yamlruntime: go#Here we select the AppEngine Flex environment which performs a lot of the backend preparation for us including the ability to scale give the demandenv: flexenv_variables:  POSTGRES_CONNECTION: "user=postgres password=thisisntmypwd dbname=postgres host=/cloudsql/sapling:europe-west1:sapling"manual_scaling:  instances: 1#Select resource sizeresources:  cpu: 1  memory_gb: 0.5  disk_size_gb: 10beta_settings:  cloud_sql_instances: sapling:europe-west1:sapling=tcp:5432配置/db.gopackage configimport (    "database/sql"    "fmt"    _ "github.com/lib/pq"    "os")var Db *sql.DB//Set up connection to the databasefunc init() {    var err error    datastoreName := os.Getenv("POSTGRES_CONNECTION")    Db, err = sql.Open(        "postgres",        datastoreName,        )    if err != nil {        panic(err)    }    err = Db.Ping()    if err != nil {        panic(err)    }    fmt.Println("Connected to database")}
查看完整描述

1 回答

?
婷婷同學(xué)_

TA貢獻(xiàn)1844條經(jīng)驗(yàn) 獲得超8個(gè)贊

我在我的測(cè)試環(huán)境中復(fù)制了這個(gè)問題,發(fā)現(xiàn)您收到的錯(cuò)誤是由于 beta_settings 指定了端口。我在最后嘗試了它=tcp:5432,它給了我同樣的錯(cuò)誤,然后我在沒有它的情況下嘗試它,它部署沒有任何問題。



查看完整回答
反對(duì) 回復(fù) 2023-07-10
  • 1 回答
  • 0 關(guān)注
  • 138 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)