MySQL을 실행하는 Amazon RDS 인스턴스에서 GoSH를 구성하려면 어떻게 해야 하나요?

2분 분량
0

MySQL을 실행하는 Amazon Relational Database Service(RDS) 인스턴스가 있습니다. RDS DB 인스턴스에서 글로벌 상태 기록(GoSH)을 켜고 구성하고 싶습니다. 어떻게 하면 되나요?

간략한 설명

GoSH를 사용하여 MySQL용 Amazon RDS에서 다양한 상태 변수의 기록을 유지할 수 있습니다. 먼저 GoSH를 사용하려면 먼저 이벤트 스케줄러를 켜야 합니다. 그런 다음 특정 간격으로 실행되고 테이블을 정기적으로 회전하도록 GoSH를 수정할 수 있습니다. 기본적으로 GoSH 정보는 5분마다 수집되어 mysql.rds_global_status_history 테이블에 저장되며 테이블은 7일마다 교체됩니다.

해결 방법

1.    event_scheduler켜짐으로 설정되도록 인스턴스에 연결된 사용자 지정 DB 파라미터 그룹을 수정합니다.

2.    DB 인스턴스에 로그인한 후 이 명령을 실행합니다.

SHOW PROCESSLIST;
SHOW GLOBAL VARIABLES LIKE 'event_scheduler';

3.    이 명령을 실행하여 GoSH를 켭니다.

CALL mysql.rds_enable_gsh_collector;

4.    모니터링 간격을 1분으로 수정하려면 이 명령을 실행합니다.

CALL mysql.rds_set_gsh_collector(1);

5.    이 명령을 실행하여 GoSH 테이블의 회전을 켭니다.

CALL mysql.rds_enable_gsh_rotation;

6.    이 명령을 실행하여 회전을 수정합니다.

CALL mysql.rds_set_gsh_rotation(5);

GoSH 테이블을 쿼리하여 특정 작업에 대한 정보를 가져옵니다. 예를 들어 다음 쿼리는 인스턴스에서 1분마다 수행되는 데이터 조작 언어(DML) 작업 수에 대한 세부 정보를 제공합니다.

SELECT collection_start, collection_end, sum(value) AS 'DML Queries Count' from (select collection_start, collection_end, "INSERTS" as "Operation", variable_Delta as "value" from mysql.rds_global_status_history  where variable_name = 'com_insert' union select collection_start, collection_end, "UPDATES" as "Operation", variable_Delta as "value" from mysql.rds_global_status_history  where variable_name = 'com_update' union select collection_start, collection_end, "DELETES" as "Operation", variable_Delta as "value" from mysql.rds_global_status_history  where variable_name = 'com_delete') a group by 1,2;

참고: 이 쿼리는 MySQL 8.0에는 적용되지 않습니다.


관련 정보

MySQL DB 인스턴스에 대한 일반적인 DBA 작업

글로벌 상태 기록 관리

댓글 없음