使用 Cloud Firestore 之前,您必須先選擇資料庫的位置。為了縮短延遲時間並提高可用性,請將資料儲存在需要這些資料的使用者和服務附近。此位置設定是您專案的預設 Google Cloud Platform (GCP) 資源位置。
請注意,先前可能已設定過預設 GCP 資源位置,無論是在建立專案期間,還是設定其他服務需要位置資訊設定時 (請參閱下方說明)。
預設 GCP 資源位置
應用程式可用的幾項服務需要位置設定 (稱為專案的預設 Google Cloud Platform (GCP) 資源位置)。這個位置是您為需要位置資訊設定的 GCP 服務儲存資料的位置。
下列產品共用相同的預設 GCP 資源位置:
Cloud Firestore
請注意,預設的 GCP 資源位置「不」適用於 Firebase 即時資料庫。Cloud Storage
請注意,預設的 GCP 資源位置僅適用於預設 Cloud Storage 值區。如果您使用的是 Blaze 方案,可以建立多個值區,每個值區都有專屬的位置。Google App Engine (GAE) 應用程式
如果您設定了 App Engine 應用程式,其位置會分享您的預設 GCP 資源位置。請注意,如果您使用 Cloud Scheduler (例如執行排程函式),就必須在專案中安裝 App Engine 應用程式。
位置的類型
您可以將 Cloud Firestore 資料儲存在「多區域」位置或「單一區域」位置。
請注意,如果您有一個 App Engine 應用程式的位置是 us-central
或 europe-west
,Cloud Firestore 資料庫會視為多區域資料庫。
多地區位置
選取多地區位置,讓資料庫達到最大的可用性和耐用性。
多地區位置由一組定義的地區組成,其中儲存的資料庫有多個備用資源。每個備用資源都是讀寫備用資源,其中包含資料庫的所有資料,或見證備用資源,這類備用資源不會維護完整資料,但會參與複製作業。
透過複製多個地區的資料,即使失去整個地區,資料仍能繼續提供。而在某個地區內,資料會跨區域複製,這樣即使發生遺失可用區,資料仍可在該地區內繼續提供。
Firebase 支援下列多區域 GCP 資源位置:多地區名稱 | 多地區說明 | 讀取/寫入區域 | 見證地區 |
---|---|---|---|
eur3 |
歐洲 | europe-west1 (比利時)、europe-west4 (荷蘭) |
europe-north1 (芬蘭) |
nam5 |
美國 | us-central1 (愛荷華州)、us-central2 (奧克拉荷馬州,私人 GCP 區域) |
us-east1 (南卡羅來納州) |
地區位置
單一地區位置是指特定地理位置,例如南卡羅來納州。單一地區位置中的資料會在單一地區的多個區域中複製。所有單一區域位置彼此皆相隔至少 100 英里。
如果您的應用程式容易受到延遲影響,或需要與其他 GCP 資源共存,則選取單一地區位置可以降低成本。如果應用程式容易受到延遲影響,寫入延遲時間也較短。
Firebase 支援下列區域性 GCP 資源位置:地區名稱 | 地區說明 | |
---|---|---|
北美洲 | ||
us-west1 | 奧勒岡州 | |
us-west2 | 洛杉磯 | |
us-west3 | 鹽湖城 | |
us-west4 | 拉斯維加斯 | |
|
愛荷華州 | |
northamerica-northeast1 | 蒙特婁 | |
|
多倫多 | |
us-east1 | 南卡羅來納州 | |
us-east4 | 北維吉尼亞州 | |
這個位置不支援 Cloud Storage for Firebase。如果您打算使用 Cloud Storage for Firebase,請選擇其他位置。 |
哥倫布 | |
這個位置不支援 Cloud Storage for Firebase。如果您打算使用 Cloud Storage for Firebase,請選擇其他位置。 |
達拉斯 | |
南美洲 | ||
這個位置不支援 Cloud Storage for Firebase。如果您打算使用 Cloud Storage for Firebase,請選擇其他位置。 |
聖地牙哥 | |
southamerica-east1 | 聖保羅 | |
歐洲 | ||
europe-west2 | 倫敦 | |
|
比利時 | |
|
荷蘭 | |
這個位置不支援 Cloud Storage for Firebase。如果您打算使用 Cloud Storage for Firebase,請選擇其他位置。 |
米蘭 | |
這個位置不支援 Cloud Storage for Firebase。如果您打算使用 Cloud Storage for Firebase,請選擇其他位置。 |
馬德里 | |
|
巴黎 | |
這個位置不支援 Cloud Storage for Firebase。如果您打算使用 Cloud Storage for Firebase,請選擇其他位置。 |
杜林 | |
這個位置不支援 Cloud Storage for Firebase。如果您打算使用 Cloud Storage for Firebase,請選擇其他位置。 |
柏林 | |
europe-west3 | 法蘭克福 | |
這個位置不支援 Cloud Storage for Firebase。如果您打算使用 Cloud Storage for Firebase,請選擇其他位置。 |
芬蘭 | |
europe-central2 | 華沙 | |
europe-west6 | 蘇黎世 | |
中東地區 | ||
|
杜哈 | |
|
達曼 | |
|
特拉維夫 | |
亞洲 | ||
asia-south1 | 孟買 | |
這個位置不支援 Cloud Storage for Firebase。如果您打算使用 Cloud Storage for Firebase,請選擇其他位置。 |
德里 | |
asia-southeast1 | 新加坡 | |
asia-southeast2 | 雅加達 | |
asia-east2 | 香港 | |
asia-east1 | 台灣 | |
asia-northeast1 | 東京 | |
asia-northeast2 | 大阪 | |
asia-northeast3 | 首爾 | |
澳洲 | ||
australia-southeast1 | 雪梨 | |
這個位置不支援 Cloud Storage for Firebase。如果您打算使用 Cloud Storage for Firebase,請選擇其他位置。 |
墨爾本 | |
非洲 | ||
這個位置不支援 Cloud Storage for Firebase。如果您打算使用 Cloud Storage for Firebase,請選擇其他位置。 |
約翰尼斯堡 |
定位服務服務水準協議
您的 Cloud Firestore 位置類型會決定服務水準協議 (SLA) 運作時間百分比:
涵蓋服務 | 每月正常運作時間百分比 |
---|---|
Cloud Firestore 多區域 | >= 99.999% |
Cloud Firestore 區域性 | >= 99.99% |
位置定價
Cloud Firestore 位置會決定資料庫作業的費用。
如需各區域和各區域類型定價的完整說明,請參閱瞭解 Cloud Firestore 計費方式。
查看資料庫的位置
在 Firebase 控制台中,前往專案設定。
後續步驟
- 如要在特定位置建立 Cloud Firestore 資料庫,請參閱開始使用 Cloud Firestore。
- 如要進一步瞭解如何建構符合延遲時間、可用性與耐用性需求的應用程式,請參閱地理位置與地區。