arkdb / arkproxy

高性能、高可靠的数据库跨云中间件,完全兼容MySQL技术体系,由极数云舟出品开源
GNU Lesser General Public License v2.1
102 stars 30 forks source link

设置proxy_digest_trace和proxy_sql_trace参数不生效 #6

Open mawenbin666 opened 4 years ago

mawenbin666 commented 4 years ago
proxy_digest_trace = ON
proxy_sql_trace = ON
Mickyun commented 4 years ago
您好,默认digest会存储到Kafka中,您需要修改Arkproxy的配置文件,修改storage为MYSQL,添加将digest数据存储到的数据库IP、port、username、password【具体修改参数见下面的图片】
然后重启Arkproxy,通过业务端口执行的语句都会被存储到指定的MySQL数据库的mysql.query_digest表中。

image

下图为测试结果

image

image

如果在修改的过程中有疑问,随时issue沟通,感谢~

mawenbin666 commented 4 years ago
proxy_digest_trace = ON
proxy_sql_trace = ON
这两个参数不能热加载,
比如 config reload,config flush 执行了都不生效,
需要物理重启才能生效,当遇到遇到分析具体问题的时候,这种物理重启会造成线上业务短暂的不可用,不太方便。
如果能做到热加载就完美了。
Mickyun commented 4 years ago

您好: 支持动态加载的,这个是我在自己的测试环境测试的步骤,您可以按照下面的操作测试一下。 操作步骤如下:

  1. 使用set global的方式关闭trace和digest
    
    mysql> set global proxy_sql_trace = off;

mysql> set global proxy_digest_trace =off;

2. 将配置加载到外部的配置文件中

show variables; //获取proxy_config_file参数值

config write outfile '/data/arkagent/package/arkproxy/conf/arkproxy_14444.cnf'; //用proxy_config_file值替换

mysql> show variables; +--------------------------------------+---------------------------------------------------------+ | Variable_name | Value | +--------------------------------------+---------------------------------------------------------+ | proxy_async_connect_server | ON | | proxy_backend_passwd | arkproxy | | proxy_backend_user | arkproxy | | proxy_check_consistend_period | 10 | | proxy_check_slave_lag_period | 10 | | proxy_config_file | /data/arkagent/package/arkproxy/conf/arkproxy_14444.cnf | | proxy_config_host | | | proxy_config_passwd | | | proxy_config_port | 0 | | proxy_config_user | | | proxy_consistend_max_delay_time | 1000 | | proxy_digest_trace | ON | | proxy_enable_consistend_read | 0 | | proxy_flush_thread_num | 5 | | proxy_format_fullpath | OFF | | proxy_format_num_per_time | 10 | | proxy_format_parameterize | ON | | proxy_format_thread_num | 5 | | proxy_general_log | OFF | | proxy_general_log_file | /data/arkagent/package/arkproxy/log/arkproxy_14444.log | | proxy_incoming_addresses | 10.0.0.174:14544 | | proxy_init_connect | | | proxy_log_error | /data/arkagent/package/arkproxy/log/error_14444.log | | proxy_max_connections | 1000 | | proxy_multi_write_mode | OFF | | proxy_namespace | | | proxy_net_buffer_outlier_scale | 1.500000 | | proxy_net_per_buffer_max_size | 0 | | proxy_non_encrypted_ips | 127.0.0.1 | | proxy_not_router_mode | OFF | | proxy_port | 14444 | | proxy_recv_queue_size | 1000 | | proxy_send_queue_size | 10 | | proxy_server_address | 10.0.0.174 | | proxy_server_heartbeat_period | 100 | | proxy_server_uuid | 0f529943-2022-11eb-87be-080027458038 | | proxy_shell_listen_port | 14544 | | proxy_shell_password | vMFqq2EQxJopv8g6 | | proxy_shell_username | arkproxy | | proxy_sql_trace | ON | | proxy_sql_trace_thread_num | 5 | | proxy_thread_pool_idle_timeout | 60 | | proxy_thread_pool_max_threads | 65536 | | proxy_thread_pool_oversubscribe | 3 | | proxy_thread_pool_size | 8 | | proxy_thread_pool_stall_limit | 500 | | proxy_trace_busy_strategy | 0 | | proxy_trace_busy_wait_time | 500 | | proxy_trace_client_queue_size | 1000 | | proxy_trace_flush_thread_sleep_msec | 500 | | proxy_trace_format_thread_sleep_msec | 500 | | proxy_trace_hash_mem_length | 134217728 | | proxy_trace_hash_size | 200 | | proxy_trace_max_delay_time | 3 | | proxy_trace_queue_array_length | 500 | | proxy_trace_sql_bucket_length | 100 | | proxy_trace_storage | MYSQL | | proxy_trace_storage_host | 10.0.0.173 | | proxy_trace_storage_passwd | arkcontrol | | proxy_trace_storage_port | 4444 | | proxy_trace_storage_user | arkcontrol | | proxy_username_encypted | OFF | | proxy_version | 20.06.30 | +--------------------------------------+---------------------------------------------------------+ 63 rows in set (0.07 sec)


`查看variables已经为关闭状态`

mysql> show variables;
+--------------------------------------+---------------------------------------------------------+
| Variable_name                        | Value                                                   |
+--------------------------------------+---------------------------------------------------------+
| proxy_async_connect_server           | ON                                                      |
| proxy_backend_passwd                 | arkproxy                                                |
| proxy_backend_user                   | arkproxy                                                |
| proxy_check_consistend_period        | 10                                                      |
| proxy_check_slave_lag_period         | 10                                                      |
| proxy_config_file                    | /data/arkagent/package/arkproxy/conf/arkproxy_14444.cnf |
| proxy_config_host                    |                                                         |
| proxy_config_passwd                  |                                                         |
| proxy_config_port                    | 0                                                       |
| proxy_config_user                    |                                                         |
| proxy_consistend_max_delay_time      | 1000                                                    |
| proxy_digest_trace                   | OFF                                                     |
| proxy_enable_consistend_read         | 0                                                       |
| proxy_flush_thread_num               | 5                                                       |
| proxy_format_fullpath                | OFF                                                     |
| proxy_format_num_per_time            | 10                                                      |
| proxy_format_parameterize            | ON                                                      |
| proxy_format_thread_num              | 5                                                       |
| proxy_general_log                    | OFF                                                     |
| proxy_general_log_file               | /data/arkagent/package/arkproxy/log/arkproxy_14444.log  |
| proxy_incoming_addresses             | 10.0.0.174:14544                                        |
| proxy_init_connect                   |                                                         |
| proxy_log_error                      | /data/arkagent/package/arkproxy/log/error_14444.log     |
| proxy_max_connections                | 1000                                                    |
| proxy_multi_write_mode               | OFF                                                     |
| proxy_namespace                      |                                                         |
| proxy_net_buffer_outlier_scale       | 1.500000                                                |
| proxy_net_per_buffer_max_size        | 0                                                       |
| proxy_non_encrypted_ips              | 127.0.0.1                                               |
| proxy_not_router_mode                | OFF                                                     |
| proxy_port                           | 14444                                                   |
| proxy_recv_queue_size                | 1000                                                    |
| proxy_send_queue_size                | 10                                                      |
| proxy_server_address                 | 10.0.0.174                                              |
| proxy_server_heartbeat_period        | 100                                                     |
| proxy_server_uuid                    | 0f529943-2022-11eb-87be-080027458038                    |
| proxy_shell_listen_port              | 14544                                                   |
| proxy_shell_password                 | vMFqq2EQxJopv8g6                                        |
| proxy_shell_username                 | arkproxy                                                |
| proxy_sql_trace                      | OFF                                                     |
| proxy_sql_trace_thread_num           | 5                                                       |
| proxy_thread_pool_idle_timeout       | 60                                                      |
| proxy_thread_pool_max_threads        | 65536                                                   |
| proxy_thread_pool_oversubscribe      | 3                                                       |
| proxy_thread_pool_size               | 8                                                       |
| proxy_thread_pool_stall_limit        | 500                                                     |
| proxy_trace_busy_strategy            | 0                                                       |
| proxy_trace_busy_wait_time           | 500                                                     |
| proxy_trace_client_queue_size        | 1000                                                    |
| proxy_trace_flush_thread_sleep_msec  | 500                                                     |
| proxy_trace_format_thread_sleep_msec | 500                                                     |
| proxy_trace_hash_mem_length          | 134217728                                               |
| proxy_trace_hash_size                | 200                                                     |
| proxy_trace_max_delay_time           | 3                                                       |
| proxy_trace_queue_array_length       | 500                                                     |
| proxy_trace_sql_bucket_length        | 100                                                     |
| proxy_trace_storage                  | MYSQL                                                   |
| proxy_trace_storage_host             | 10.0.0.173                                              |
| proxy_trace_storage_passwd           | arkcontrol                                              |
| proxy_trace_storage_port             | 4444                                                    |
| proxy_trace_storage_user             | arkcontrol                                              |
| proxy_username_encypted              | OFF                                                     |
| proxy_version                        | 20.06.30                                                |
+--------------------------------------+---------------------------------------------------------+
63 rows in set (0.08 sec)

3. 查看配置文件

[arkproxy] proxy_async_connect_server = ON proxy_backend_passwd = arkproxy proxy_backend_user = arkproxy proxy_check_consistend_period = 10 proxy_check_slave_lag_period = 10 proxy_config_host = proxy_config_passwd = proxy_config_port = 0 proxy_config_user = proxy_consistend_max_delay_time = 1000 proxy_digest_trace = OFF ............................ proxy_sql_trace = OFF ...........................