Programing

MySQL은 상태를 보여-활성 또는 총 연결?

lottogame 2020. 5. 17. 10:28
반응형

MySQL은 상태를 보여-활성 또는 총 연결?


내가 실행 show status like 'Con%'하면 9972 개의 연결 수가 지속적으로 증가하고 있습니다. 총 활성 연결 수입니까?


docs 에 따르면 , 이력 전체의 총 수를 의미합니다.

Connections

MySQL 서버에 대한 연결 시도 횟수 (성공 여부)

상태 변수 를 통해 활성 연결 수를 확인할 수 있습니다 Threads_connected.

Threads_connected

현재 열려있는 연결 수입니다.

mysql> show status where `variable_name` = 'Threads_connected';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| Threads_connected | 4     |
+-------------------+-------+
1 row in set (0.00 sec)

... 또는 show processlist명령을 통해 :

mysql> show processlist;
+----+------+-----------------+--------+---------+------+-------+------------------+
| Id | User | Host            | db     | Command | Time | State | Info             |
+----+------+-----------------+--------+---------+------+-------+------------------+
|  3 | root | localhost       | webapp | Query   |    0 | NULL  | show processlist | 
|  5 | root | localhost:61704 | webapp | Sleep   |  208 |       | NULL             | 
|  6 | root | localhost:61705 | webapp | Sleep   |  208 |       | NULL             | 
|  7 | root | localhost:61706 | webapp | Sleep   |  208 |       | NULL             | 
+----+------+-----------------+--------+---------+------+-------+------------------+
4 rows in set (0.00 sec)

SHOW STATUS WHERE `variable_name` = 'Threads_connected';

열린 연결이 모두 표시됩니다.


지금까지 서버에 대한 총 연결 수입니다. 현재 연결 상태를 찾으려면

mysqladmin -u -p 확장 상태 | grep -wi 'threads_connected \ | threads_running'| awk '{print $ 2, $ 4}'

이것은 당신에게 보여줄 것입니다 :

Threads_connected 12

Threads_running 1  

Threads_connected: Number of connections

Threads_running: connections currently running some sql

보다 완전한 목록을 보려면 다음을 실행하십시오.

show session status;

또는

show global status;

사용법을 더 잘 이해하려면 이 링크참조하십시오 .

데이터베이스에 대한 세부 사항을 알고 싶다면 다음을 실행할 수 있습니다.

status;

당신은 또한 할 수 있습니다

SHOW STATUS WHERE `variable_name` = 'Max_used_connections';

문서에 따라 http://dev.mysql.com/doc/refman/5.0/en/server-status-variables.html#statvar_Connections

사이

MySQL 서버에 대한 연결 시도 횟수 (성공 여부)


현재 활성 연결 수 여야합니다. 명령 processlist실행하여 확인하십시오.

참조를위한 URL : http://www.devdaily.com/blog/post/mysql/how-show-open-database-connections-mysql

EDIT: Number of DB connections opened Please take a look here, the actual number of threads (connections) are described here!

참고URL : https://stackoverflow.com/questions/7432241/mysql-show-status-active-or-total-connections

반응형