Mysql, Maria DB 14

python을 이용한 maria DB 접속 로그 (1) - grafana 시각화 모니터링

grafana는 다양한 Data-Source를 사용할 수 있는 시각화 프로그램이다. 위와 같이 다양한 Data-Source를 연결할 수 있는데, 여기서는 mysql과 연동하여 간단한 대쉬보드를 만들겠다. 설치는 쉽기 때문에 패스하며, https://grafana.com/grafana/download URL을 참고하여 설치하면 된다. 1. grafana에 로그인을 하여 아래와 같이 data source를 클릭 2. mysql 선택 3. 기본적인 정보를 입력하고, Save & Test를 눌러 OK가 나오면 정상적으로 연결된다. 4. 다음으로 DashBoard를 선택하여, 그래프를 선택한다. 여러 그래프가 많지만 간단하게 'Table" 을 선택 5. 기본적으로 데이터가 없기 때문에 'Panel Title'에서..

Mysql, Maria DB 2019.06.10

[Python] maria DB 접속 로그 (1) - 설정 및 모니터링

1. maria DB 로깅설정 set global general_log = 1; set global log_output = 'TABLE'; show variables where Variable_name in ('version', 'log' , 'general_log') 2. 접속로그 확인 쿼리 select * from general_log where command_type = 'Connect' 3. 파이썬(python)을 이용한 접속로그 출력 import pymysql conn = pymysql.connect(host='ip', user='root', password='password',db='mysql', charset='utf-8') c = conn.cursor() c.execute('select *..

Mysql, Maria DB 2018.05.12

[Python] mysql lock monitoring. (실행 중인 스레드 모니터링)

파이썬 pymysql 모듈을 이용하여 실행 중인 스레드 모니터링을 할 수 있다. - mysql 명령어 : SHOW PROCESSLIST (DOCS : https://dev.mysql.com/doc/refman/5.5/en/show-processlist.html) import pymysql strFormat = '%-10s\t%-10s\t%-20s\t%-20s\t%-30s\t%-10s\t%-30s\t%-30s\t%-10s\n' strOut = strFormat % ('Id', 'User', 'Host', 'db', 'Command', 'Time', 'State','Info','Progress') strOut += '----------\t----------\t---------------------\t----..

Mysql, Maria DB 2018.05.05