![[AWS Technical Support Note] วิธีการตรวจสอบสถานะการทำงานของ RDS ด้วย CloudWatch Metrics](https://devio2024-media.developers.io/image/upload/f_auto,q_auto,w_3840/v1774347913/user-gen-eyecatch/uwmoqucpglx1bdukfzr4.webp)
[AWS Technical Support Note] วิธีการตรวจสอบสถานะการทำงานของ RDS ด้วย CloudWatch Metrics
ปัญหาที่เกิดขึ้น
อยากตรวจสอบสถานะการทำงานของ RDS โดยใช้ CloudWatch Metrics
ถ้ามี Metrics ที่ทำหน้าที่คล้ายกับ StatusCheckFailed ของ EC2 ก็จะดีมาก
แต่ใน RDS มี Metrics ที่ใช้ตรวจสอบสถานะได้แบบนั้นด้วยไหม?
รบกวนแนะนำวิธีอื่นๆที่ทำได้ด้วยนะ
วิธีแก้ปัญหา
ในขณะนี้ยังไม่มี CloudWatch Metrics สำหรับ RDS ที่ทำหน้าที่เทียบเท่ากับ StatusCheckFailed ของ EC2 สำหรับการตรวจสอบสถานะการทำงานโดยตรง
อย่างไรก็ตาม ในแง่ของการมอนิเตอร์โดยทั่วไป มีตัวอย่างวิธีการที่สามารถนำมาใช้ได้ดังนี้
- ตั้งค่า Threshold ให้กับ CloudWatch Metrics (CPUUtilization, FreeableMemory, FreeStorageSpace และอื่นๆ) เพื่อมอนิเตอร์สถานะ Performance และตรวจสอบว่า Resource ไม่ถูกใช้งานจนหมด
※ การตั้งค่าที่เหมาะสมนั้นขึ้นอยู่กับ Workload กรุณาพิจารณาโดยอ้างอิงจาก Document ด้านล่างนี้
Performance baseline
To achieve your monitoring goals, you need to establish a baseline. To do this, measure performance under different load conditions at various times in your Amazon RDS environment. You can monitor metrics such as the following:
- Network throughput
- Client connections
- I/O for read, write, or metadata operations
(แปลไทย)
Performance baseline
เพื่อให้บรรลุเป้าหมายในการมอนิเตอร์ คุณจำเป็นต้องกำหนด Baseline ก่อน โดยการวัด Performance ภายใต้เงื่อนไข Load ที่แตกต่างกันในช่วงเวลาต่างๆ ใน Amazon RDS Environment ของคุณ โดย Metrics ที่สามารถมอนิเตอร์ได้มีดังนี้
- Network Throughput
- Client Connections
- I/O สำหรับการดำเนินการ Read, Write หรือ Metadata
Monitoring metrics in an Amazon RDS instance (English)
- ตรวจสอบความถูกต้องของระบบโดยการเช็คสถานะของ DB Instance ผ่าน API และอื่นๆ ว่าอยู่ในสถานะ "Available" หรือไม่
The status of a DB instance indicates its current operational state. You can use the following procedures to view the DB instance status in the Amazon RDS console, the AWS CLI command, or the API operation.
(แปลไทย)
สถานะของ DB Instance จะแสดงถึงสถานะการทำงานในปัจจุบัน สามารถดูสถานะของ DB Instance ได้จาก Amazon RDS Console, AWS CLI Command หรือ API Operation ตามขั้นตอนต่อไปนี้
Viewing instance status (English)
- มอนิเตอร์ RDS Event เพื่อตรวจสอบว่าไม่มีพฤติกรรมที่ผิดปกติเกิดขึ้น
ใน RDS เมื่อมีการ Reboot หรือ Failover เกิดขึ้น จะมีการสร้าง Event ที่เกี่ยวข้องขึ้นมา กรุณาอ้างอิง Document ด้านล่างนี้สำหรับรายละเอียดเกี่ยวกับกลไกการมอนิเตอร์ Event เหล่านั้น
Amazon RDS generates a significant number of events in categories that you can subscribe to using the Amazon RDS Console, AWS CLI, or the API.
(แปลไทย)
Amazon RDS จะสร้าง Event จำนวนมากในหลากหลายหมวดหมู่ ซึ่งคุณสามารถ Subscribe เพื่อรับการแจ้งเตือนได้ผ่าน Amazon RDS Console, AWS CLI หรือ API
Amazon RDS event categories and event messages (English)
Amazon RDS groups events into categories that you can subscribe to so that you can be notified when an event in that category occurs.
(แปลไทย)
Amazon RDS จะจัดกลุ่ม Event ออกเป็นหมวดหมู่ต่างๆ ที่คุณสามารถ Subscribe ได้ เพื่อรับการแจ้งเตือนเมื่อมี Event ในหมวดหมู่นั้นเกิดขึ้น
Overview of Amazon RDS event notification (English)
- ส่ง Query ที่เหมาะสมไปยัง DB Instance เป็นระยะๆ จาก Client Application
วิธีนี้จะมีประสิทธิภาพในกรณีที่ต้องการตรวจสอบการเชื่อมต่อระหว่าง Application กับ RDS
ดังที่กล่าวไปข้างต้นว่าในขณะนี้ยังไม่มี Metrics สำหรับตรวจสอบสถานะการทำงานโดยตรงอย่าง StatusCheckFailed แต่เราสามารถพิจารณาวิธีการมอนิเตอร์ที่เหมาะสมโดยอ้างอิงจากตัวอย่างด้านบนที่ได้ยกมา
เอกสารอ้างอิง
- Performance baseline (English)
- Viewing Amazon RDSDB instance status (English)
- Amazon RDS event categories and event messages (English)
- Overview of Amazon RDS event notification (English)
บทความอื่นๆที่เกี่ยวข้องกับ Amazon RDS
- วิธีการสร้างและ Restore Snapshot ใน RDS หรือ Aurora (Thai)
- วิธีทำให้ endpoint เป็นตัวเดียวกับ instance ดั้งเดิม เมื่อกู้คืน RDS instance ด้วย snapshot (Thai)
บทความต้นฉบับ
- RDS の死活監視を CloudWatch メトリクスから行う方法について教えてください (Japanese)







