Skip to content
컴퓨터잡담
2010.04.27 11:03

Mysql 에러메시지

조회 수 17550 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄



super_user>mysqladmin status

Uptime: 5263  Threads: 2  Questions: 577405  Slow queries: 11  Opens: 356  Flush

 tables: 1  Open tables: 115  Queries per second avg: 109.710


super_user>mysqladmin status

Uptime: 5480  Threads: 1  Questions: 602952  Slow queries: 11  Opens: 416  Flush

 tables: 1  Open tables: 58  Queries per second avg: 110.27


super_user>mysqladmin status

Uptime: 5481  Threads: 2  Questions: 603056  Slow queries: 11  Opens: 416  Flush

 tables: 1  Open tables: 58  Queries per second avg: 110.26



Mysql을 재시작한지 불과 1시간 30분만의 결과이다.


Slow queries: 11개 / Opens :416개 / Flush tables: 1회 / 평균 쿼리/초 : 110.26


MySQL의 느린 응답을 나타낸다. => slow_queries와 slow_launch_threads

부하가 심하다는 것을 나타낸다 =>   threads_created,  max_used_connections,  opend_tables이 큰 경우 (이 경우 table_cache를 올리자)

문제는 테이블 캐시는 안늘어남.. ㅎ

인덱스를 많이 읽는다. => handler_read_key가 높은 경우

락 경쟁과 관련된 항목 =>  table_locks_waited VS table_locks_immediate , 만약 table_locks_waited가 높으면, myisam에서 innodb로 변경하는 것이 좋다.



흐미... 미친다.


왜이럴까?


phpMyAdmin 의 status 중 붉은색으로 나오는 리스트는 아래와 같다.




Handler_read_rnd 1,488k

You probably have alot of queries that require MySQL to scan whole tables or you have joins that don't use keys properly.


Handler_read_rnd_next  823k

Generally this suggests that your tables are not properly indexed or that your queries are not written to take advantage of the indexs you have.


Created_tmp_disk_tables  727

tmp_table_size를 늘리라는 설명이 있지만 사실 엄청나게 큼.

그리고 mysql 안에서의 status를 보면 0.


opened_tables  445         

your table cache value is probably too small. 

음,, 테이블캐쉬가 900이 넘는데???

사용중인건 100개도 안되는데....


table_locks_waited 1,123

If ths is high, and you have performance problems, you should first optimize your queries, and then either split your table or tables or use replication.



마지막으로 

On a busy server, the byte counters may overrun, so those statistics as reported by the MySQL server may be incorrect.






하지만 mysql에서 status를 해보면,



mysql> show status like '%con%';

+--------------------------+-------+

| Variable_name            | Value |

+--------------------------+-------+

| Aborted_connects         | 0     |

| Com_show_contributors    | 0     |

| Connections              | 17217 |

| Max_used_connections     | 15    |

| Ssl_client_connects      | 0     |

| Ssl_connect_renegotiates | 0     |

| Ssl_finished_connects    | 0     |

| Threads_connected        | 3     |

+--------------------------+-------+

8 rows in set (0.00 sec)


처음에는 아무생각없이 Max_connections을 높였다.

300, 500, 1000... 헌데, 올리면 올릴수록 문제가 생겼다.

이유는 최대접속수를 늘리면 테이블 수가 줄어들기 때문이다.

join_table과 연관이 있다는데 아직 내용을 알지는 못함.


threads_connected는 사실 cpu와 램, 하드 속도만 빠르면 크게 증가하지 않는다.

이에 따라 Max_used_connections이 많이 늘어나는 것은 접속자가 많다는 이유가 될수도 있지만

환경설정이 잘못될 경우 머무르는 시간이 길어져 늘어날 수도 있다.

물론 my.ini 환경설정도 아주 중요하지만.. ^^;;


현재로 봐서는 정상!!!



mysql> show status like '%table%';


| Created_tmp_disk_tables  | 0      |

| Created_tmp_tables       | 0      |

| Open_table_definitions   | 124    |

| Open_tables              | 93     |

| Opened_table_definitions | 0      |

| Opened_tables            | 0      |

| Slave_open_temp_tables   | 0      |

| Table_locks_immediate    | 597693 |

| Table_locks_waited       | 1227   |

+--------------------------+--------+

23 rows in set (0.00 sec)


오픈중인 테이블수 100개를 초과하지 않음.

table_locks_waited VS table_locks_immediate => table_locks_waited가 높으면, myisam에서 innodb로 변경하는 것이 좋다.

헌데 innodb를 사용하면 시스템 전체가 느려진다. 


table_cache가 증가하지 않는부분에 대해서 찾아보았지만

file descriptors와 관련이 있다고 하여 max_connections와 값을 조정해보았지만 변동이 없슴.


이 값이 '0'이면 mysqld는 max_connections*5 

또는 max_connections + table_cache*2 (whichever is larger) number of files이 필요하다 

mysqld가 'Too many open files'에러를 나타내면 이 값을 증가시켜야 한다. 

open_files_limit '0'이 아니면 mysqld는 file descriptors가 setrlimit()를 사용하도록 바꾸기위해 이것을 사용한다 

open_files_limit '0'이면, mysqld는 max_connections*5 




mysql> show status like '%thread%';

+------------------------+-------+

| Variable_name          | Value |

+------------------------+-------+

| Delayed_insert_threads | 0     |

| Slow_launch_threads    | 0     |

| Threads_cached         | 11    |

| Threads_connected      | 4     |

| Threads_created        | 15    |

| Threads_running        | 3     |

+------------------------+-------+

6 rows in set (0.00 sec)


mysql>


mysql> show status like '%key%';

+------------------------+-----------+

| Variable_name          | Value     |

+------------------------+-----------+

| Com_assign_to_keycache | 0         |

| Com_preload_keys       | 0         |

| Com_show_keys          | 0         |

| Handler_read_key       | 0         |

| Key_blocks_not_flushed | 0         |

| Key_blocks_unused      | 172626    |

| Key_blocks_used        | 58002     |

| Key_read_requests      | 217456662 |

| Key_reads              | 159168    |

| Key_write_requests     | 1009069   |

| Key_writes             | 35368     |

+------------------------+-----------+

11 rows in set (0.00 sec)


mysql>


variables는




mysql> show variables like '%max_con%';

+--------------------+-------+

| Variable_name      | Value |

+--------------------+-------+

| max_connect_errors | 10    |

| max_connections    | 151   |

+--------------------+-------+

2 rows in set (0.00 sec)



mysql> show variables like '%thread%';

+----------------------------+---------------------------+

| Variable_name              | Value                     |

+----------------------------+---------------------------+

| max_delayed_threads        | 20                        |

| max_insert_delayed_threads | 20                        |

| myisam_repair_threads      | 1                         |

| pseudo_thread_id           | 17186                     |

| thread_cache_size          | 128                       |

| thread_handling            | one-thread-per-connection |

| thread_stack               | 196608                    |

+----------------------------+---------------------------+

7 rows in set (0.00 sec)


mysql> show variables like '%table%';

+----------------------------+-----------+

| Variable_name              | Value     |

+----------------------------+-----------+

| big_tables                 | OFF       |

| lower_case_table_names     | 1         |

| max_heap_table_size        | 268435456 |

| max_tmp_tables             | 256       |

| old_alter_table            | OFF       |

| sql_big_tables             | OFF       |

| table_definition_cache     | 256       |

| table_lock_wait_timeout    | 50        |

| table_open_cache           | 943       |

| table_type                 | MyISAM    |

| tmp_table_size             | 402653184 |

| updatable_views_with_limit | YES       |

+----------------------------+-----------+

12 rows in set (0.00 sec)


mysql> show variables like '%key%';

+--------------------------+------------+

| Variable_name            | Value      |

+--------------------------+------------+

| delay_key_write          | ON         |

| foreign_key_checks       | ON         |

| have_rtree_keys          | YES        |

| key_buffer_size          | 268435456  |

| key_cache_age_threshold  | 300        |

| key_cache_block_size     | 1024       |

| key_cache_division_limit | 100        |

| max_seeks_for_key        | 4294967295 |

| ssl_key                  |            |

+--------------------------+------------+

9 rows in set (0.00 sec)


mysql>



로그인 후 댓글쓰기가 가능합니다.

?

  1. AHK_L 예제소스

  2. [PHP] 한글삭제 정규식

  3. 티맥스 앞날이 깜깜

  4. Windows 7 빌드 7600 이 Windows는 정품이 아닙니다.( 윈도우7 정품인증 패치,크랙)

  5. 엑셀 다중조건 구현하기

  6. javascript만으로 html간 변수값 주고받기

  7. 윈도우7 공유기 사용시 네트워크 연결 문제

  8. 어도비 프리미어 프로 템플릿 폴더 관리방법

  9. Spy & Capture Spy++과 같은 계열의 프로그램

  10. ahk_l 과 com 의 이해

  11. ahk_l 웹페이지 앞, 뒤페이지 제어 예제소스 및 설명첨부

  12. Mysql 에러메시지

  13. 윈도우7(WINDOWS7) IPv6 제거방법

  14. 함수와변수

  15. PHP 스누피로 사이트 긁어오기가 되지 않는 사이트를 긁어오는 3가지 방법

  16. autohotkey와 autohotkey_l 의 인터넷 창 띄우기 비교예제

  17. 음력변환

  18. 부팅 완료 체크

  19. 보안경고 - 안전하게 제공된 콘텐츠만 보시겠습니까? <= 없애는 방법

  20. List of Windows Messages

Board Pagination Prev 1 ... 34 35 36 37 38 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소