状态查询
通过 SQL 可以查看 proxy 的配置以及状态信息,目前支持如下命令:

/proxy/help;
/proxy/show config;
/proxy/show status;
说明:
如果使用 MySQL 客户端,需要在使用客户端时增加-c选项,如 mysql -hxxx.xxx.xxx.xxx -Pxxxx -uxxx -pxxx -c。

示例如下:

mysql> /proxy/help;
commanddescription
show configshow config from conf
show statusshow proxy status,like route,shardkey and so on
set sys_log_level=Nchange the sys debug level N should be 0,1,2,3
set inter_log_level=Nchange the interface debug level N should be 0,1
set inter_time_open=Nchange the interface time debug level N should be 0,1
set sql_log_level=Nchange the sql debug level N should be 0,1
set slow_log_level=Nchange the slow debug level N should be 0,1
set slow_log_ms=Nchange the slow ms
set log_clean_time=Nchange the log clean days
set log_clean_size=Nchange the log clean size in GB

10 rows in set (0.00 sec)

mysql> /proxy/show config;
config_namevalue
versionV2R120D001
modegroup shard
rootdir/shard_922
sys_log_level0
inter_log_level0
inter_time_open0
sql_log_level0
slow_log_level0
slow_log_ms1000
log_clean_time1
log_clean_size1
rw_split1
ip_pass_through0

14 rows in set (0.00 sec)

mysql> /proxy/show status;
status_namevalue
clustergroup_1499858910_79548
set_1499859173_1:ip10.49.118.165:5025;10.175.98.109:5025@1@IDC_4@0,10.231.23.241:5025@1@IDC_2@0
set_1499859173_1:hash_range0---31
set_1499911640_3:ip10.49.118.165:5026;10.175.98.109:5026@1@IDC_4@0,10.231.23.241:5026@1@IDC_2@0
set_1499911640_3:hash_range32---63
setset_1499859173_1,set_1499911640_3

同时 proxy 增强了 explain 的返回结果,显示 proxy 修改后的 SQL。

mysql> explain select * from test1;
idselect_typetabletypepossible_keyskeykey_lenrefrowsExtrainfo
1SIMPLEtest1ALLNULLNULLNULLNULL16 set_2,explain select * from shard.test1
1SIMPLEtest1ALLNULLNULLNULLNULL16 set_1,explain select * from shard.test1

2 rows in set (0.03 sec)


腾讯云数据库
7 声望5 粉丝

腾讯云数据库是腾讯提供的高可靠、高可用、可弹性伸缩的云数据库服务产品的总称,可轻松运维主流开源及商业数据库 ( MySQL, Redis, MongoDB, SQL Server, PostgreSQL 等 ),在公有云、 私有云和专有云领域提供全...