Loading...
MySQL 9.5 Reference Manual 9.5의 25.6.18 Quick Reference: NDB Cluster SQL Statements의 한국어 번역본입니다.
아래의 경우에 피드백에서 신고해주신다면 반영하겠습니다.
감사합니다 :)
이 절에서는 NDB Cluster에 연결된 MySQL 서버를 관리 및 모니터링할 때 유용하게 사용할 수 있는 여러 SQL 문과, 일부 경우에는 클러스터 자체에 대한 정보를 제공하는 SQL 문에 대해 설명합니다.
이 문장의 출력에는 서버의 클러스터 연결, NDB Cluster 객체의 생성 및 사용, NDB Cluster 복제를 위한 바이너리 로그에 관한 정보가 포함됩니다.
사용 예와 더 자세한 정보는 Section 15.7.7.17, “SHOW ENGINE Statement”를 참조하십시오.
이 문장은 MySQL 서버에서 클러스터링 지원이 활성화되어 있는지 여부와, 활성화되어 있다면 실제로 사용 중인지 여부를 확인하는 데 사용할 수 있습니다.
자세한 정보는 Section 15.7.7.18, “SHOW ENGINES Statement”를 참조하십시오.
참고
이 문장은 LIKE 절을 지원하지 않습니다. 그러나 다음 항목에서 설명하는 것처럼 Information Schema의 ENGINES 테이블에 대한 쿼리를 LIKE로 필터링할 수 있습니다.
SELECT * FROM INFORMATION_SCHEMA.ENGINES [WHERE ENGINE LIKE 'NDB%']이는 SHOW ENGINES와 동일하지만, INFORMATION_SCHEMA 데이터베이스의 ENGINES 테이블을 사용합니다. SHOW ENGINES 문과 달리, LIKE 절을 사용하여 결과를 필터링할 수 있으며, 스크립트에서 유용하게 사용할 수 있도록 특정 컬럼만 선택해서 정보를 얻을 수 있습니다. 예를 들어, 다음 쿼리는 서버가 NDB 지원으로 빌드되었는지와, 그렇다면 그것이 활성화되어 있는지를 보여 줍니다:
1mysql> SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES 2 -> WHERE ENGINE LIKE 'NDB%'; 3+------------+---------+ 4| ENGINE | SUPPORT | 5+------------+---------+ 6| ndbcluster | YES | 7| ndbinfo | YES | 8+------------+---------+
NDB 지원이 활성화되어 있지 않다면, 위 쿼리는 빈 집합을 반환합니다. 더 많은 정보는 Section 28.3.13, “The INFORMATION_SCHEMA ENGINES Table”을 참조하십시오.
SHOW VARIABLES LIKE 'NDB%'이 문장은 NDB 스토리지 엔진과 관련된 대부분의 서버 시스템 변수와 그 값을 다음과 같이 보여 줍니다:
1mysql> SHOW VARIABLES LIKE 'NDB%'; 2+--------------------------------------------+----------------------------------+ 3| Variable_name | Value | 4+--------------------------------------------+----------------------------------+ 5| ndb_allow_copying_alter_table | ON | 6| ndb_applier_allow_skip_epoch | OFF | 7| ndb_applier_conflict_role | NONE | 8| ndb_autoincrement_prefetch_sz | 512 | 9| ndb_batch_size | 32768 | 10| ndb_blob_read_batch_bytes | 65536 | 11| ndb_blob_write_batch_bytes | 65536 | 12| ndb_clear_apply_status | ON | 13| ndb_cluster_connection_pool | 1 | 14| ndb_cluster_connection_pool_nodeids | | 15| ndb_connectstring | 127.0.0.1 | 16| ndb_data_node_neighbour | 0 | 17| ndb_default_column_format | FIXED | 18| ndb_deferred_constraints | 0 | 19| ndb_distribution | KEYHASH | 20| ndb_eventbuffer_free_percent | 20 | 21| ndb_eventbuffer_max_alloc | 0 | 22| ndb_extra_logging | 1 | 23| ndb_force_send | ON | 24| ndb_fully_replicated | OFF | 25| ndb_index_stat_enable | ON | 26| ndb_index_stat_option | loop_enable=1000ms, 27loop_idle=1000ms,loop_busy=100ms,update_batch=1,read_batch=4,idle_batch=32, 28check_batch=8,check_delay=10m,delete_batch=8,clean_delay=1m,error_batch=4, 29error_delay=1m,evict_batch=8,evict_delay=1m,cache_limit=32M,cache_lowpct=90, 30zero_total=0 | 31| ndb_join_pushdown | ON | 32| ndb_log_apply_status | OFF | 33| ndb_log_bin | OFF | 34| ndb_log_binlog_index | ON | 35| ndb_log_empty_epochs | OFF | 36| ndb_log_empty_update | OFF | 37| ndb_log_exclusive_reads | OFF | 38| ndb_log_fail_terminate | OFF | 39| ndb_log_orig | OFF | 40| ndb_log_transaction_compression | OFF | 41| ndb_log_transaction_compression_level_zstd | 3 | 42| ndb_log_transaction_dependency | OFF | 43| ndb_log_transaction_id | OFF | 44| ndb_log_update_as_write | ON | 45| ndb_log_update_minimal | OFF | 46| ndb_log_updated_only | ON | 47| ndb_metadata_check | ON | 48| ndb_metadata_check_interval | 60 | 49| ndb_metadata_sync | OFF | 50| ndb_mgm_tls | relaxed | 51| ndb_mgmd_host | 127.0.0.1 | 52| ndb_nodeid | 0 | 53| ndb_optimization_delay | 10 | 54| ndb_optimized_node_selection | 3 | 55| ndb_read_backup | ON | 56| ndb_recv_thread_activation_threshold | 8 | 57| ndb_recv_thread_cpu_mask | | 58| ndb_replica_batch_size | 2097152 | 59| ndb_replica_blob_write_batch_bytes | 2097152 | 60| ndb_report_thresh_binlog_epoch_slip | 10 | 61| ndb_report_thresh_binlog_mem_usage | 10 | 62| ndb_row_checksum | 1 | 63| ndb_schema_dist_lock_wait_timeout | 30 | 64| ndb_schema_dist_timeout | 120 | 65| ndb_schema_dist_upgrade_allowed | ON | 66| ndb_show_foreign_key_mock_tables | OFF | 67| ndb_slave_conflict_role | NONE | 68| ndb_table_no_logging | OFF | 69| ndb_table_temporary | OFF | 70| ndb_tls_search_path | $HOME/ndb-tls | 71| ndb_use_copying_alter_table | OFF | 72| ndb_use_exact_count | OFF | 73| ndb_use_transactions | ON | 74| ndb_version | 524544 | 75| ndb_version_string | ndb-8.4.0 | 76| ndb_wait_connected | 120 | 77| ndb_wait_setup | 120 | 78| ndbinfo_database | ndbinfo | 79| ndbinfo_max_bytes | 0 | 80| ndbinfo_max_rows | 10 | 81| ndbinfo_offline | OFF | 82| ndbinfo_show_hidden | OFF | 83| ndbinfo_table_prefix | ndb$ | 84| ndbinfo_version | 524544 | 85+--------------------------------------------+----------------------------------+ 8674 rows in set (0.01 sec)
자세한 정보는 Section 7.1.8, “Server System Variables”를 참조하십시오.
SELECT * FROM performance_schema.global_variables WHERE VARIABLE_NAME LIKE 'NDB%'이 문장은 앞 항목에서 설명한 SHOW VARIABLES 문과 동일한 기능을 제공하며, 다음과 같이 거의 동일한 출력을 제공합니다:
1mysql> SELECT * FROM performance_schema.global_variables 2 -> WHERE VARIABLE_NAME LIKE 'NDB%'; 3+--------------------------------------+---------------------------------------+ 4| VARIABLE_NAME | VARIABLE_VALUE | 5+--------------------------------------+---------------------------------------+ 6| ndb_allow_copying_alter_table | ON | 7| ndb_autoincrement_prefetch_sz | 512 | 8| ndb_batch_size | 32768 | 9| ndb_blob_read_batch_bytes | 65536 | 10| ndb_blob_write_batch_bytes | 65536 | 11| ndb_clear_apply_status | ON | 12| ndb_cluster_connection_pool | 1 | 13| ndb_cluster_connection_pool_nodeids | | 14| ndb_connectstring | 127.0.0.1 | 15| ndb_data_node_neighbour | 0 | 16| ndb_default_column_format | FIXED | 17| ndb_deferred_constraints | 0 | 18| ndb_distribution | KEYHASH | 19| ndb_eventbuffer_free_percent | 20 | 20| ndb_eventbuffer_max_alloc | 0 | 21| ndb_extra_logging | 1 | 22| ndb_force_send | ON | 23| ndb_fully_replicated | OFF | 24| ndb_index_stat_enable | ON | 25| ndb_index_stat_option | loop_enable=1000ms,loop_idle=1000ms, 26loop_busy=100ms,update_batch=1,read_batch=4,idle_batch=32,check_batch=8, 27check_delay=10m,delete_batch=8,clean_delay=1m,error_batch=4,error_delay=1m, 28evict_batch=8,evict_delay=1m,cache_limit=32M,cache_lowpct=90,zero_total=0 | 29| ndb_join_pushdown | ON | 30| ndb_log_apply_status | OFF | 31| ndb_log_bin | OFF | 32| ndb_log_binlog_index | ON | 33| ndb_log_empty_epochs | OFF | 34| ndb_log_empty_update | OFF | 35| ndb_log_exclusive_reads | OFF | 36| ndb_log_orig | OFF | 37| ndb_log_transaction_id | OFF | 38| ndb_log_update_as_write | ON | 39| ndb_log_update_minimal | OFF | 40| ndb_log_updated_only | ON | 41| ndb_metadata_check | ON | 42| ndb_metadata_check_interval | 60 | 43| ndb_metadata_sync | OFF | 44| ndb_mgmd_host | 127.0.0.1 | 45| ndb_nodeid | 0 | 46| ndb_optimization_delay | 10 | 47| ndb_optimized_node_selection | 3 | 48| ndb_read_backup | ON | 49| ndb_recv_thread_activation_threshold | 8 | 50| ndb_recv_thread_cpu_mask | | 51| ndb_report_thresh_binlog_epoch_slip | 10 | 52| ndb_report_thresh_binlog_mem_usage | 10 | 53| ndb_row_checksum | 1 | 54| ndb_schema_dist_lock_wait_timeout | 30 | 55| ndb_schema_dist_timeout | 120 | 56| ndb_schema_dist_upgrade_allowed | ON | 57| ndb_show_foreign_key_mock_tables | OFF | 58| ndb_slave_conflict_role | NONE | 59| ndb_table_no_logging | OFF | 60| ndb_table_temporary | OFF | 61| ndb_use_copying_alter_table | OFF | 62| ndb_use_exact_count | OFF | 63| ndb_use_transactions | ON | 64| ndb_version | 524308 | 65| ndb_version_string | ndb-9.5.0 | 66| ndb_wait_connected | 30 | 67| ndb_wait_setup | 30 | 68| ndbinfo_database | ndbinfo | 69| ndbinfo_max_bytes | 0 | 70| ndbinfo_max_rows | 10 | 71| ndbinfo_offline | OFF | 72| ndbinfo_show_hidden | OFF | 73| ndbinfo_table_prefix | ndb$ | 74| ndbinfo_version | 524308 | 75+--------------------------------------+---------------------------------------+
SHOW VARIABLES 문과는 달리, 개별 컬럼을 선택할 수 있습니다. 예를 들면 다음과 같습니다:
1mysql> SELECT VARIABLE_VALUE 2 -> FROM performance_schema.global_variables 3 -> WHERE VARIABLE_NAME = 'ndb_force_send'; 4+----------------+ 5| VARIABLE_VALUE | 6+----------------+ 7| ON | 8+----------------+
더 유용한 쿼리는 다음과 같습니다:
1mysql> SELECT VARIABLE_NAME AS Name, VARIABLE_VALUE AS Value 2 > FROM performance_schema.global_variables 3 > WHERE VARIABLE_NAME 4 > IN ('version', 'ndb_version', 5 > 'ndb_version_string', 'ndbinfo_version'); 6+--------------------+---------------+ 7| Name | Value | 8+--------------------+---------------+ 9| ndb_version | 524544 | 10| ndb_version_string | ndb-8.4.0 | 11| ndbinfo_version | 524544 | 12| version | 8.4.0-cluster | 13+--------------------+---------------+ 144 rows in set (0.00 sec)
자세한 내용은 Section 29.12.15, “Performance Schema Status Variable Tables” 및 Section 7.1.8, “Server System Variables”를 참조하십시오.
SHOW STATUS LIKE 'NDB%'이 문장은 MySQL 서버가 클러스터 SQL 노드로 동작 중인지 여부를 한눈에 보여 주며, 그렇다면 MySQL 서버의 클러스터 노드 ID, 연결된 클러스터 관리 서버의 호스트 이름 및 포트, 그리고 클러스터 내 데이터 노드 수를 다음과 같이 제공합니다:
1mysql> SHOW STATUS LIKE 'NDB%'; 2+----------------------------------------------+-------------------------------+ 3| Variable_name | Value | 4+----------------------------------------------+-------------------------------+ 5| Ndb_metadata_detected_count | 0 | 6| Ndb_cluster_node_id | 100 | 7| Ndb_config_from_host | 127.0.0.1 | 8| Ndb_config_from_port | 1186 | 9| Ndb_number_of_data_nodes | 2 | 10| Ndb_number_of_ready_data_nodes | 2 | 11| Ndb_connect_count | 0 | 12| Ndb_execute_count | 0 | 13| Ndb_scan_count | 0 | 14| Ndb_pruned_scan_count | 0 | 15| Ndb_schema_locks_count | 0 | 16| Ndb_api_wait_exec_complete_count_session | 0 | 17| Ndb_api_wait_scan_result_count_session | 0 | 18| Ndb_api_wait_meta_request_count_session | 1 | 19| Ndb_api_wait_nanos_count_session | 163446 | 20| Ndb_api_bytes_sent_count_session | 60 | 21| Ndb_api_bytes_received_count_session | 28 | 22| Ndb_api_trans_start_count_session | 0 | 23| Ndb_api_trans_commit_count_session | 0 | 24| Ndb_api_trans_abort_count_session | 0 | 25| Ndb_api_trans_close_count_session | 0 | 26| Ndb_api_pk_op_count_session | 0 | 27| Ndb_api_uk_op_count_session | 0 | 28| Ndb_api_table_scan_count_session | 0 | 29| Ndb_api_range_scan_count_session | 0 | 30| Ndb_api_pruned_scan_count_session | 0 | 31| Ndb_api_scan_batch_count_session | 0 | 32| Ndb_api_read_row_count_session | 0 | 33| Ndb_api_trans_local_read_row_count_session | 0 | 34| Ndb_api_adaptive_send_forced_count_session | 0 | 35| Ndb_api_adaptive_send_unforced_count_session | 0 | 36| Ndb_api_adaptive_send_deferred_count_session | 0 | 37| Ndb_trans_hint_count_session | 0 | 38| Ndb_sorted_scan_count | 0 | 39| Ndb_pushed_queries_defined | 0 | 40| Ndb_pushed_queries_dropped | 0 | 41| Ndb_pushed_queries_executed | 0 | 42| Ndb_pushed_reads | 0 | 43| Ndb_last_commit_epoch_server | 37632503447571 | 44| Ndb_last_commit_epoch_session | 0 | 45| Ndb_system_name | MC_20191126162038 | 46| Ndb_api_event_data_count_injector | 0 | 47| Ndb_api_event_nondata_count_injector | 0 | 48| Ndb_api_event_bytes_count_injector | 0 | 49| Ndb_api_wait_exec_complete_count_slave | 0 | 50| Ndb_api_wait_scan_result_count_slave | 0 | 51| Ndb_api_wait_meta_request_count_slave | 0 | 52| Ndb_api_wait_nanos_count_slave | 0 | 53| Ndb_api_bytes_sent_count_slave | 0 | 54| Ndb_api_bytes_received_count_slave | 0 | 55| Ndb_api_trans_start_count_slave | 0 | 56| Ndb_api_trans_commit_count_slave | 0 | 57| Ndb_api_trans_abort_count_slave | 0 | 58| Ndb_api_trans_close_count_slave | 0 | 59| Ndb_api_pk_op_count_slave | 0 | 60| Ndb_api_uk_op_count_slave | 0 | 61| Ndb_api_table_scan_count_slave | 0 | 62| Ndb_api_range_scan_count_slave | 0 | 63| Ndb_api_pruned_scan_count_slave | 0 | 64| Ndb_api_scan_batch_count_slave | 0 | 65| Ndb_api_read_row_count_slave | 0 | 66| Ndb_api_trans_local_read_row_count_slave | 0 | 67| Ndb_api_adaptive_send_forced_count_slave | 0 | 68| Ndb_api_adaptive_send_unforced_count_slave | 0 | 69| Ndb_api_adaptive_send_deferred_count_slave | 0 | 70| Ndb_slave_max_replicated_epoch | 0 | 71| Ndb_api_wait_exec_complete_count | 4 | 72| Ndb_api_wait_scan_result_count | 7 | 73| Ndb_api_wait_meta_request_count | 172 | 74| Ndb_api_wait_nanos_count | 1083548094028 | 75| Ndb_api_bytes_sent_count | 4640 | 76| Ndb_api_bytes_received_count | 109356 | 77| Ndb_api_trans_start_count | 4 | 78| Ndb_api_trans_commit_count | 1 | 79| Ndb_api_trans_abort_count | 1 | 80| Ndb_api_trans_close_count | 4 | 81| Ndb_api_pk_op_count | 2 | 82| Ndb_api_uk_op_count | 0 | 83| Ndb_api_table_scan_count | 1 | 84| Ndb_api_range_scan_count | 1 | 85| Ndb_api_pruned_scan_count | 0 | 86| Ndb_api_scan_batch_count | 1 | 87| Ndb_api_read_row_count | 3 | 88| Ndb_api_trans_local_read_row_count | 2 | 89| Ndb_api_adaptive_send_forced_count | 1 | 90| Ndb_api_adaptive_send_unforced_count | 5 | 91| Ndb_api_adaptive_send_deferred_count | 0 | 92| Ndb_api_event_data_count | 0 | 93| Ndb_api_event_nondata_count | 0 | 94| Ndb_api_event_bytes_count | 0 | 95| Ndb_metadata_excluded_count | 0 | 96| Ndb_metadata_synced_count | 0 | 97| Ndb_conflict_fn_max | 0 | 98| Ndb_conflict_fn_old | 0 | 99| Ndb_conflict_fn_max_del_win | 0 | 100| Ndb_conflict_fn_epoch | 0 | 101| Ndb_conflict_fn_epoch_trans | 0 | 102| Ndb_conflict_fn_epoch2 | 0 | 103| Ndb_conflict_fn_epoch2_trans | 0 | 104| Ndb_conflict_trans_row_conflict_count | 0 | 105| Ndb_conflict_trans_row_reject_count | 0 | 106| Ndb_conflict_trans_reject_count | 0 | 107| Ndb_conflict_trans_detect_iter_count | 0 | 108| Ndb_conflict_trans_conflict_commit_count | 0 | 109| Ndb_conflict_epoch_delete_delete_count | 0 | 110| Ndb_conflict_reflected_op_prepare_count | 0 | 111| Ndb_conflict_reflected_op_discard_count | 0 | 112| Ndb_conflict_refresh_op_count | 0 | 113| Ndb_conflict_last_conflict_epoch | 0 | 114| Ndb_conflict_last_stable_epoch | 0 | 115| Ndb_index_stat_status | allow:1,enable:1,busy:0, 116loop:1000,list:(new:0,update:0,read:0,idle:0,check:0,delete:0,error:0,total:0), 117analyze:(queue:0,wait:0),stats:(nostats:0,wait:0),total:(analyze:(all:0,error:0), 118query:(all:0,nostats:0,error:0),event:(act:0,skip:0,miss:0),cache:(refresh:0, 119clean:0,pinned:0,drop:0,evict:0)),cache:(query:0,clean:0,drop:0,evict:0, 120usedpct:0.00,highpct:0.00) | 121| Ndb_index_stat_cache_query | 0 | 122| Ndb_index_stat_cache_clean | 0 | 123+----------------------------------------------+-------------------------------+
MySQL 서버가 NDB 지원으로 빌드되었지만 현재 클러스터에 연결되어 있지 않은 경우, 이 문장의 출력에 있는 모든 행의 Value 컬럼 값은 0 또는 빈 문자열입니다.
Section 15.7.7.38, “SHOW STATUS Statement”도 참조하십시오.
SELECT * FROM performance_schema.global_status WHERE VARIABLE_NAME LIKE 'NDB%'이 문장은 앞 항목에서 논의한 SHOW STATUS 문과 유사한 출력을 제공합니다. SHOW STATUS와는 달리, SELECT 문을 사용하여 값을 SQL로 추출하고, 모니터링 및 자동화를 위한 스크립트에서 사용할 수 있습니다.
자세한 내용은 Section 29.12.15, “Performance Schema Status Variable Tables”를 참조하십시오.
SELECT * FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'NDB%'이 문장은 Information Schema의 PLUGINS 테이블에서 NDB Cluster와 연관된 플러그인에 대한 정보(예: 버전, 작성자, 라이선스)를 다음과 같이 표시합니다:
1mysql> SELECT * FROM INFORMATION_SCHEMA.PLUGINS 2 > WHERE PLUGIN_NAME LIKE 'NDB%'\G 3*************************** 1. row *************************** 4 PLUGIN_NAME: ndbcluster 5 PLUGIN_VERSION: 1.0 6 PLUGIN_STATUS: ACTIVE 7 PLUGIN_TYPE: STORAGE ENGINE 8 PLUGIN_TYPE_VERSION: 90500.0 9 PLUGIN_LIBRARY: NULL 10PLUGIN_LIBRARY_VERSION: NULL 11 PLUGIN_AUTHOR: Oracle Corporation 12 PLUGIN_DESCRIPTION: Clustered, fault-tolerant tables 13 PLUGIN_LICENSE: GPL 14 LOAD_OPTION: ON 15*************************** 2. row *************************** 16 PLUGIN_NAME: ndbinfo 17 PLUGIN_VERSION: 0.1 18 PLUGIN_STATUS: ACTIVE 19 PLUGIN_TYPE: STORAGE ENGINE 20 PLUGIN_TYPE_VERSION: 90500.0 21 PLUGIN_LIBRARY: NULL 22PLUGIN_LIBRARY_VERSION: NULL 23 PLUGIN_AUTHOR: Oracle Corporation 24 PLUGIN_DESCRIPTION: MySQL Cluster system information storage engine 25 PLUGIN_LICENSE: GPL 26 LOAD_OPTION: ON 27*************************** 3. row *************************** 28 PLUGIN_NAME: ndb_transid_mysql_connection_map 29 PLUGIN_VERSION: 0.1 30 PLUGIN_STATUS: ACTIVE 31 PLUGIN_TYPE: INFORMATION SCHEMA 32 PLUGIN_TYPE_VERSION: 90500.0 33 PLUGIN_LIBRARY: NULL 34PLUGIN_LIBRARY_VERSION: NULL 35 PLUGIN_AUTHOR: Oracle Corporation 36 PLUGIN_DESCRIPTION: Map between MySQL connection ID and NDB transaction ID 37 PLUGIN_LICENSE: GPL 38 LOAD_OPTION: ON
SHOW PLUGINS 문을 사용해서도 이 정보를 표시할 수 있지만, 그 문의 출력은 쉽게 필터링할 수 없습니다. 또한, PLUGINS 테이블의 정보가 어디에서 어떻게 얻어지는지에 대해서는 The MySQL Plugin API를 참조하십시오.
또한 ndbinfo 정보 데이터베이스의 테이블을 쿼리하여 많은 NDB Cluster 작업에 대한 실시간 데이터를 얻을 수도 있습니다. Section 25.6.15, “ndbinfo: The NDB Cluster Information Database”를 참조하십시오.
25.6.17 NDB Cluster and the Performance Schema
25.6.19 NDB Cluster Security