--- title: GCP Memorystore # 簡報的名稱 tags: GCP # 簡報的標籤 --- # [GCP Memorystore ](https://cloud.google.com/memorystore?hl=zh-tw) > 適用於 Redis 的全代管記憶體內資料儲存服務 ## 功能與特色 * 服務級別 您可以依據 Redis 執行個體的費用和可用性需求選擇合適的級別。 * 安全性 Cloud Memorystore for Redis 整合了身分與存取權管理功能,並使用虛擬私人雲端網路和私人 IP,因此不會受到網際網路的安全性問題所影響,而這一切都是為了保護您的資料。另外,系統也會受到全天候監控,以確保您的應用程式和資料安全無虞。 * 全代管 可自動化處理佈建、複製、容錯移轉和修補等作業,因此能大幅減少開發運作所需的時間。 * 監控 您可以透過 Stackdriver 監控執行個體並設定自訂快訊。另外,您也能整合 OpenCensus,藉此深入瞭解用戶端指標。 * 高可用性 標準級 Cloud Memorystore for Redis 執行個體提供 99.9% 的可用性服務水準協議,並搭載自動容錯移轉功能,能夠維持執行個體的高可用性。 * 遷移 Cloud Memorystore 與 Redis 的通訊協定相容,因此您不必修改程式碼就能輕鬆遷移應用程式。您可以利用匯入/匯出功能,將 Redis 執行個體遷移至 Google Cloud。 ## [定價](https://cloud.google.com/memorystore/pricing?hl=zh-TW&_ga=2.240706432.-2061541235.1564627678&_gac=1.254028220.1584598010.EAIaIQobChMIwbjeye-l6AIVUKaWCh3u_ggMEAAYASAAEgKDJvD_BwE#pricing_overview) ### 1. 服務級別 * 基本級:提供獨立的 Redis 執行個體。 * 標準級:提供可用性高的 Redis 執行個體。 ### 2. 佈建容量 * 佈建容量的收費價格 * 使用 Redis 執行個體可達到的最大總處理量 ![](https://i.imgur.com/0bfXIII.png) ### 3. 地區 各國地區的費用不同 ## 實際操作 ### 1. 儲存空間 > Memorystore ![](https://i.imgur.com/kcX2xE6.png) ### 2. 建立執行個體 ![](https://i.imgur.com/jA7i7DA.png) ![](https://i.imgur.com/GVwAVOG.png) ### 3. 為執行個體命名 ![](https://i.imgur.com/pGtdgXx.png) ### 4. 設定執行個體屬性 ![](https://i.imgur.com/TzaghBI.png) ### 5. 選擇位置 ![](https://i.imgur.com/25baD6I.png) ### 6. 設定容量 ![](https://i.imgur.com/0WczdqD.png) ### 7. 設定redis [自訂參數](https://cloud.google.com/memorystore/docs/reference/redis-configs?hl=zh-TW&_ga=2.138578736.-2061541235.1564627678&_gac=1.209005094.1584598010.EAIaIQobChMIwbjeye-l6AIVUKaWCh3u_ggMEAAYASAAEgKDJvD_BwE) ![](https://i.imgur.com/ezGVJUK.png) [官方 redis.conf](https://raw.githubusercontent.com/antirez/redis/4.0/redis.conf) ## [連線測試](https://cloud.google.com/memorystore/docs/redis/connecting-redis-instance?hl=zh-TW) GCP Memorystore 沒有外部IP,所以要使用GCP的內網連線,測試連線可以使用 GCE 或者 GKE 來測試連線 * Google ompute Engine VM > telnet ```bash sudo apt-get install telnet telnet REDIS-IP Ip PORT ``` > redis-client ``` docker run --rm -ti redis bash redis-cli -h REDIS-IP -p PORT ``` * Google Kubernetes Engine > telnet ```bash kubectl run -i --rm --tty busybox --image=busybox -- sh telnet REDIS-IP Ip PORT ``` > redis-client ```bash kubectl run -ti --rm redis --image=redis -- bash redis-cli -h REDIS-IP -p PORT ``` ## 壓力測試 ## 圖表觀察 * 記憶體用量/記憶體上限 ![](https://i.imgur.com/Go1bvdB.png) * 快取命中率 ![](https://i.imgur.com/vLN6lj2.png) * 呼叫 ![](https://i.imgur.com/h6mRxjR.png) * 資料庫中的索引鍵 ![](https://i.imgur.com/k8zkzuN.png) * 已撤銷的金鑰/過期的金鑰 ![](https://i.imgur.com/AW2wTnn.png) * 執行個體運作時間 ![](https://i.imgur.com/GJ6IKHc.png) * 已連結/已封鎖的用戶端 ![](https://i.imgur.com/shQuOfq.png) * 傳入/傳出的網路位元組數 ![](https://i.imgur.com/zddlcTp.png) * CPU utilization percentage ![](https://i.imgur.com/pWWPrko.png) * 待複製的位元組 ![](https://i.imgur.com/eH6jCeH.png) ## [監控 redis 執行個體](https://cloud.google.com/memorystore/docs/redis/monitoring-instances?hl=zh-TW) ## [容錯轉移](https://cloud.google.com/memorystore/docs/redis/manual-failover-overview?hl=zh-TW) # Reference * [Memorystore for Redis documentation](https://cloud.google.com/memorystore/docs/redis?hl=zh-tw)