監控 Cloud SQL 執行個體
本頁面說明如何透過下列方式監控 Cloud SQL 執行個體:
使用 Cloud SQL 系統洞察資訊主頁
Cloud SQL 系統洞察資訊主頁可協助您偵測及分析系統效能問題。
詳情請參閱「使用系統洞察功能提升系統效能」。
使用 Cloud Monitoring 資訊主頁監控執行個體
Cloud Monitoring 為多項 Trusted Cloud by S3NS 產品提供預先定義的資訊主頁,包括預設的 Cloud SQL 監控資訊主頁。您可以透過這個資訊主頁,監控主要執行個體和副本執行個體的一般健康狀態。您也可以建立自訂資訊主頁,顯示自己感興趣的資料。
設定快訊
您可以使用 Cloud Monitoring 為專案或特定執行個體設定快訊。
舉例來說,您可以設定快訊,在 Cloud SQL 執行個體的「記憶體用量」指標超過 80% 的門檻時,將訊息傳送至特定電子郵件 ID。
在 Cloud SQL 執行個體的「總覽」頁面中查看指標
在 Cloud SQL 執行個體的「總覽」頁面中,查看部分重要指標,如下所示:
-
前往 Trusted Cloud 控制台的「Cloud SQL Instances」頁面。
前往 Cloud SQL 執行個體
-
如要開啟執行個體的「總覽」頁面,請按一下執行個體名稱。
預設指標圖表會顯示在頁面頂端。
選用:從「圖表」下拉式清單中選取其他指標。
圖表會顯示所選指標的資料。
清單中包括下列選項:
- CPU 使用率
- 有效連線數
- 儲存空間用量
- 記憶體用量
- 讀取/寫入作業數
- 輸入/輸出位元組數
- MySQL 查詢數
- MySQL 問題數
- 讀取/寫入 InnoDB 頁面
- InnoDB 資料 fsync 作業數
- InnoDB 記錄的 fsync 作業數
- 複製延遲時間 (適用於唯讀備用資源)
可用的指標
使用量圖表可協助您在應用程式需求變更時,主動採取因應措施。您可以從這些指標深入瞭解輸送量和延遲時間問題,以及執行個體用量費用。
指標 | 說明 |
儲存空間用量 (GB) |
您可以使用儲存空間用量指標來協助您瞭解儲存空間費用。如要進一步瞭解儲存空間用量費用,請參閱「儲存空間和網路定價」。
二進位記錄檔會占用儲存空間。二進位檔記錄會隨其關聯自動備份一起刪除,這通常會在約 7 天後發生。您無法手動刪除二進位記錄,也無法變更 7 天的期限。
如果二進位記錄的大小導致執行個體發生問題,您可以增加儲存空間大小,但磁碟用量中二進位記錄的大小增加可能是暫時的。為避免發生意料之外的儲存空間問題,建議您為所有執行個體啟用
自動增加儲存空間。
您可以停用二進位檔記錄,然後重新啟用,這樣系統就會刪除二進位檔記錄。但請注意,減少使用的預先寫入記錄不會縮減為執行個體佈建的磁碟大小。
儲存空間用量指標會計入暫時資料。系統會在維護期間移除暫時資料,且允許暫時資料超出使用者定義的容量限制,以免發生磁碟空間不足事件,使用者不必支付任何費用。
資料用量也會計入儲存空間用量指標。在資料用量方面,當交易修改資料庫時,Cloud SQL 會先複製資料,再修改原始資料。資料副本是復原資料。
新建立的資料庫會針對系統表格和檔案使用數百 MB 的空間。
|
|
CPU 使用率 |
您可以透過這項指標監控執行個體的 CPU 是否足以滿足應用程式需求。如果這個值變得太高,您可以增加機器類型的大小,讓您的執行個體擁有更大的 CPU 能力。
|
記憶體用量 |
執行個體使用的記憶體數。
|
讀取/寫入作業數 |
「讀取次數」指標是磁碟提供的讀取作業次數,其並非來自快取。您可以根據這項指標,判斷執行個體的大小是否適合您的環境。如有需要,您可以改用較大的機器類型,從快取提供更多要求,並縮短延遲時間。
「寫入次數」指標是磁碟的寫入作業次數。即使應用程式未處於活動狀態,系統仍會產生寫入活動,因為 Cloud SQL 執行個體會大約每秒寫入系統資料表一次 (備用資源除外)。
|
有效連線數 |
Cloud SQL 執行個體的公開連線數量。
|
輸入/輸出位元組數 (位元組數/秒) |
進入或離開執行個體的網路流量。 |
MySQL 查詢數 (查詢數/秒) |
伺服器執行的陳述式數量。如要查看哪些陳述式會計為查詢,請參閱 MySQL 參考手冊中的「
伺服器狀態變數」。 |
MySQL 問題數 (問題數/秒) |
由用戶端傳送之伺服器執行的陳述式數量。如要查看哪些陳述式會計為問題,請參閱 MySQL 參考手冊中的「
伺服器狀態變數」。 |
讀取/寫入 InnoDB 頁數 (頁數/秒) |
讀取及寫入的 InnoDB 頁數。詳情請參閱 MySQL 參考手冊中的「InnoDB 啟動選項和系統變數」。 |
InnoDB 資料 fsync 作業數 (作業數/秒) |
InnoDB fsync() 呼叫數。詳情請參閱 MySQL 參考手冊中的「InnoDB 啟動選項和系統變數」。 |
InnoDB 記錄 fsync 作業數 (作業數/秒) |
對記錄檔呼叫 InnoDB fsync() 的次數。詳情請參閱 MySQL 參考手冊中的「InnoDB 啟動選項和系統變數」。 |
執行個體狀態 |
執行個體名稱旁的狀態圖示會指出執行個體的狀態。您也可以監控 cloudsql.googleapis.com/database/instance_state 指標。 |
比較多個執行個體的指標
-
前往 Trusted Cloud 控制台的「Cloud SQL Instances」頁面。
前往 Cloud SQL 執行個體
- 在 Cloud SQL「執行個體」頁面中,選取執行個體名稱左側的核取方塊,最多可選擇五個執行個體進行比較。
-
在右側的「Info Panel」(資訊面板) 中,選取「Monitoring」(監控) 分頁標籤。
從指標下拉式選單中,選取要用於比較執行個體的指標。
將指標懸停在圖表上,即可查看特定時間的資料。
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-09-03 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-03 (世界標準時間)。"],[],[],null,["# Monitor Cloud SQL instances\n\n\u003cbr /\u003e\n\nMySQL \\| [PostgreSQL](/sql/docs/postgres/monitor-instance \"View this page for the PostgreSQL database engine\") \\| [SQL Server](/sql/docs/sqlserver/monitor-instance \"View this page for the SQL Server database engine\")\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis page describes how you can monitor Cloud SQL instances in the following ways:\n\n- [Use the Cloud SQL System Insights dashboard](/sql/docs/mysql/use-system-insights)\n\n\u003c!-- --\u003e\n\n- [Monitor an instance by using the Cloud Monitoring dashboard](#cloud-monitoring)\n- [View metrics on the Cloud SQL instance Overview page](#monitoring-overview)\n- [Compare metrics from multiple instances](#monitoring-multiple)\n\nUse the Cloud SQL System Insights dashboard\n-------------------------------------------\n\nThe Cloud SQL System Insights dashboard helps you detect and analyze\nsystem performance problems.\n\nFor more information, see [Use System Insights to improve system performance](/sql/docs/mysql/use-system-insights).\n\n\nMonitor an instance by using the Cloud Monitoring dashboard\n-----------------------------------------------------------\n\nCloud Monitoring offers predefined dashboards for several Google Cloud products,\nincluding a default Cloud SQL [monitoring dashboard](https://console.cloud.google.com/monitoring/dashboards/resourceList/cloudsql_database). You can\nuse this dashboard to monitor the general health of your primary and replica instances.\nYou can also create your own [custom dashboards](/monitoring/charts/dashboards)\nto display data that's of interest to you.\n\n### Set up alerts\n\nYou can use Cloud Monitoring to [set up alerts](/monitoring/alerts/using-alerting-ui#viewing_policies)\nfor a project or a specified instance.\n\nFor example, you can set up an alert for a message to be sent to specific email\nIDs when the **Memory usage** metric for a Cloud SQL instance exceeds\nthe threshold of 80%.\n\nView metrics on the Cloud SQL instance Overview page\n----------------------------------------------------\n\nView some of the key metrics for a Cloud SQL instance on its Overview page as follows:\n\n1. In the Google Cloud console, go to the **Cloud SQL Instances** page.\n\n [Go to Cloud SQL Instances](https://console.cloud.google.com/sql)\n2. To open the **Overview** page of an instance, click the instance name.\n3. The default metrics chart appears at the top of the page.\n4.\n Optional: Select another metric from the **Chart** drop-down list.\n\n\n The chart shows the data for the selected metric.\n\nThe list includes the following options:\n\n- CPU utilization\n- Active connections\n- Storage usage\n- Memory usage\n- Read/write operations\n- Ingress/Egress bytes\n- MySQL queries\n- MySQL questions\n- Read/write InnoDB pages\n- InnoDB data fsyncs\n- InnoDB log fsyncs\n- Replication lag (for read replicas)\n\n\u003cbr /\u003e\n\n### Available metrics\n\nThe usage charts help you respond proactively as your application needs change.\nFrom these metrics, you can gain insights into issues of throughput and latency\nas well as instance usage costs.\n\nCompare metrics from multiple instances\n---------------------------------------\n\n1. In the Google Cloud console, go to the **Cloud SQL Instances** page.\n\n [Go to Cloud SQL Instances](https://console.cloud.google.com/sql)\n2. From the Cloud SQL **Instances** page, choose up to five instances to compare by selecting the checkbox to the left of the instance name.\n3. On the **Info Panel** on the right, select the **Monitoring** tab.\n4.\n From the metrics drop-down, select the metric to use for comparing instances.\n\n You can see the data for a specific moment by holding the pointer over the\n chart.\n\nWhat's next\n-----------\n\n- [Instance settings](/sql/docs/mysql/instance-settings)\n- [Cloud SQL metrics](/sql/docs/mysql/admin-api/metrics)"]]