媲美oracle awr/statspack的mysql awr第一版发布

现发布alpha版mysql awr,其提供的特性类似于oracle awr或statspack+集中式监控。对于原来从事oracle dba或者相关运维的人原来说,这会是个不错的选择。

至于我为什么不选择用zabbix,monyog,nagios等等监控工具,相信各数据库专家们懂的。

系统逻辑结构

blob.png

支持配置监控多个mysql实例。

 

关键监控内容

blob.png

 

 

 

 

 

 

 

一、源系统配置

  • 建议percona server      5.6/mariadb+,支持mysql,percona,mariadb 5.6,5.7。

  • 启用performance_schema,userstat参数

  • 创建perf_stat用户,授予select      information_schema,performance_schema select/truncate权限;

  • 确保安装了lsof,或yum install lsof进行安装。

CREATE USER perf_stat@'%' IDENTIFIED BY 'hundsun';

GRANT ALL ON information_schema.* TO perf_stat@'%' ;

GRANT ALL ON performance_schema.* TO perf_stat@'%' ;

 

二、perfstat配置

1、创建存储表结构

create database perf_stat;

use perf_stat;

 

Create table apps (hostname varchar(64),port int,appname varchar(64) primary key,ver varchar(64));

 

Create table app_snaps (hostname varchar(64),appname varchar(64),snap_id int,log_time datetime); 保留7天自动删除

Create index idx_app_snaps_appname on app_snaps(appname);

 

create table IS_GLOBAL_STATUS(hostname varchar(64),appname varchar(64),log_time datetime,snap_id int,variable_name varchar(64),variable_value varchar(64)); 启动以来全量

Create index idx_global_status_app_snap on IS_GLOBAL_STATUS(appname,snap_id);

 

create table IS_GLOBAL_VARIABLES(hostname varchar(64),appname varchar(64),log_time datetime,snap_id int,variable_name varchar(64),variable_value varchar(64));  启动以来全量

Create index idx_global_VARIABLES_app_snap on IS_GLOBAL_VARIABLES(appname,snap_id);

 

 

create table ps_events_waits_summary_global_by_event_name

(

   hostname varchar(64),appname varchar(64),log_time datetime,snap_id int,

  `EVENT_NAME` varchar(128) NOT NULL,

  `COUNT_STAR` bigint(20) unsigned NOT NULL,

  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL

);

Create index idx_ewsgben_app_snap on ps_events_waits_summary_global_by_event_name(appname,snap_id);

 

 本间隔前n分钟增量

create table ps_table_io_waits_summary_by_table

(

    hostname varchar(64),appname varchar(64),log_time datetime,snap_id int,

  `OBJECT_TYPE` varchar(64) DEFAULT NULL,

  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,

  `OBJECT_NAME` varchar(64) DEFAULT NULL,

  `COUNT_STAR` bigint(20) unsigned NOT NULL,

  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `COUNT_READ` bigint(20) unsigned NOT NULL,

  `SUM_TIMER_READ` bigint(20) unsigned NOT NULL,

  `MIN_TIMER_READ` bigint(20) unsigned NOT NULL,

  `AVG_TIMER_READ` bigint(20) unsigned NOT NULL,

  `MAX_TIMER_READ` bigint(20) unsigned NOT NULL,

  `COUNT_WRITE` bigint(20) unsigned NOT NULL,

  `SUM_TIMER_WRITE` bigint(20) unsigned NOT NULL,

  `MIN_TIMER_WRITE` bigint(20) unsigned NOT NULL,

  `AVG_TIMER_WRITE` bigint(20) unsigned NOT NULL,

  `MAX_TIMER_WRITE` bigint(20) unsigned NOT NULL,

  `COUNT_FETCH` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_FETCH` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_FETCH` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_FETCH` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_FETCH` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_UPDATE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_UPDATE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_UPDATE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_UPDATE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_UPDATE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_DELETE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_DELETE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_DELETE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_DELETE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_DELETE` bigint(20) unsigned NOT NULL  DEFAULT '0'

);

Create index idx_tiwsbt_app_snap on ps_table_io_waits_summary_by_table(appname,snap_id);

 

本间隔前n分钟增量

create table ps_table_lock_waits_summary_by_table

(

    hostname varchar(64),appname varchar(64),log_time datetime,snap_id int,

  `OBJECT_TYPE` varchar(64) DEFAULT NULL,

  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,

  `OBJECT_NAME` varchar(64) DEFAULT NULL,

  `COUNT_STAR` bigint(20) unsigned NOT NULL,

  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `COUNT_READ` bigint(20) unsigned NOT NULL,

  `SUM_TIMER_READ` bigint(20) unsigned NOT NULL,

  `MIN_TIMER_READ` bigint(20) unsigned NOT NULL,

  `AVG_TIMER_READ` bigint(20) unsigned NOT NULL,

  `MAX_TIMER_READ` bigint(20) unsigned NOT NULL,

  `COUNT_WRITE` bigint(20) unsigned NOT NULL,

  `SUM_TIMER_WRITE` bigint(20) unsigned NOT NULL,

  `MIN_TIMER_WRITE` bigint(20) unsigned NOT NULL,

  `AVG_TIMER_WRITE` bigint(20) unsigned NOT NULL,

  `MAX_TIMER_WRITE` bigint(20) unsigned NOT NULL,

  `COUNT_READ_NORMAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_READ_NO_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_READ_EXTERNAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_WRITE_DELAYED` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_WRITE_NORMAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL  DEFAULT '0'

);

Create index idx_tlwsbt_app_snap on ps_table_lock_waits_summary_by_table(appname,snap_id);

 

本间隔前n分钟增量

create table ps_table_io_waits_summary_by_index_usage

(

    hostname varchar(64),appname varchar(64),log_time datetime,snap_id int,

  `OBJECT_TYPE` varchar(64) DEFAULT NULL,

  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,

  `OBJECT_NAME` varchar(64) DEFAULT NULL,

  `INDEX_NAME` varchar(64) DEFAULT NULL,

  `COUNT_STAR` bigint(20) unsigned NOT NULL,

  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `COUNT_READ` bigint(20) unsigned NOT NULL,

  `SUM_TIMER_READ` bigint(20) unsigned NOT NULL,

  `MIN_TIMER_READ` bigint(20) unsigned NOT NULL,

  `AVG_TIMER_READ` bigint(20) unsigned NOT NULL,

  `MAX_TIMER_READ` bigint(20) unsigned NOT NULL,

  `COUNT_WRITE` bigint(20) unsigned NOT NULL,

  `SUM_TIMER_WRITE` bigint(20) unsigned NOT NULL,

  `MIN_TIMER_WRITE` bigint(20) unsigned NOT NULL,

  `AVG_TIMER_WRITE` bigint(20) unsigned NOT NULL,

  `MAX_TIMER_WRITE` bigint(20) unsigned NOT NULL,

  `COUNT_FETCH` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_FETCH` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_FETCH` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_FETCH` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_FETCH` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_INSERT` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_UPDATE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_UPDATE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_UPDATE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_UPDATE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_UPDATE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `COUNT_DELETE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `SUM_TIMER_DELETE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MIN_TIMER_DELETE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `AVG_TIMER_DELETE` bigint(20) unsigned NOT NULL  DEFAULT '0',

  `MAX_TIMER_DELETE` bigint(20) unsigned NOT NULL  DEFAULT '0'

);

Create index idx_tiwsbiu_app_snap on ps_table_io_waits_summary_by_index_usage(appname,snap_id);

 

本间隔前n分钟增量

create table ps_events_statements_summary_by_digest

(

    hostname varchar(64),appname varchar(64),log_time datetime,snap_id int,

  `SCHEMA_NAME` varchar(64) DEFAULT NULL,

  `DIGEST` varchar(32) DEFAULT NULL,

  `DIGEST_TEXT` longtext,

  `COUNT_STAR` bigint(20) unsigned NOT NULL,

  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL,

  `SUM_LOCK_TIME` bigint(20) unsigned NOT NULL,

  `SUM_ERRORS` bigint(20) unsigned NOT NULL,

  `SUM_WARNINGS` bigint(20) unsigned NOT NULL,

  `SUM_ROWS_AFFECTED` bigint(20) unsigned NOT NULL,

  `SUM_ROWS_SENT` bigint(20) unsigned NOT NULL,

  `SUM_ROWS_EXAMINED` bigint(20) unsigned NOT NULL,

  `SUM_CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,

  `SUM_CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,

  `SUM_SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,

  `SUM_SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,

  `SUM_SELECT_RANGE` bigint(20) unsigned NOT NULL,

  `SUM_SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,

  `SUM_SELECT_SCAN` bigint(20) unsigned NOT NULL,

  `SUM_SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,

  `SUM_SORT_RANGE` bigint(20) unsigned NOT NULL,

  `SUM_SORT_ROWS` bigint(20) unsigned NOT NULL,

  `SUM_SORT_SCAN` bigint(20) unsigned NOT NULL,

  `SUM_NO_INDEX_USED` bigint(20) unsigned NOT NULL,

  `SUM_NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,

  `FIRST_SEEN` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,

  `LAST_SEEN` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP

);

Create index idx_digest_app_snap on ps_events_statements_summary_by_digest(appname,snap_id);

本间隔前n分钟增量

 

FLUSH INDEX_STATISTICS

create table IS_INDEX_STATISTICS

(

   hostname varchar(64),appname varchar(64),log_time datetime,snap_id int,

  `TABLE_SCHEMA` varchar(192) NOT NULL DEFAULT '',

  `TABLE_NAME` varchar(192) NOT NULL DEFAULT '',

  `INDEX_NAME` varchar(192) NOT NULL DEFAULT '',

  `ROWS_READ` bigint(21) unsigned NOT NULL DEFAULT '0'

);

Create index idx_index_statistics_app_snap on IS_INDEX_STATISTICS(appname,snap_id);

 本间隔前n分钟增量

FLUSH TABLE_STATISTICS

create table IS_TABLE_STATISTICS

(

    hostname varchar(64),appname varchar(64),log_time datetime,snap_id int,

  `TABLE_SCHEMA` varchar(192) NOT NULL DEFAULT '',

  `TABLE_NAME` varchar(192) NOT NULL DEFAULT '',

  `ROWS_READ` bigint(21) unsigned NOT NULL DEFAULT '0',

  `ROWS_CHANGED` bigint(21) unsigned NOT NULL DEFAULT '0',

  `ROWS_CHANGED_X_INDEXES` bigint(21) unsigned NOT NULL DEFAULT '0'

);

Create index idx_table_statistics_app_snap on IS_TABLE_STATISTICS(appname,snap_id);

 本间隔前n分钟增量

 

2、配置监控的数据源

在当前版本的mysql awr实现中,暂不支持通过web控制台方式增加监控节点(下一个版本会支持)。

要增加监控的节点,需要在三个地方进行改动,如下所示:

(1)、在WEB-INF/conf/spring-servlet.xml中增加一个类似如下的数据源:

    <bean id="hitop_pxc_db1_ds" class="org.apache.commons.dbcp.BasicDataSource"

        destroy-method="close">

        <property name="url" value="${hitop_pxc_db1_ds.jdbc.url}" />

        <property name="driverClassName" value="${hitop_pxc_db1_ds.jdbc.driverClassName}" />

        <property name="username" value="${hitop_pxc_db1_ds.jdbc.username}" />

        <property name="password" value="${hitop_pxc_db1_ds.jdbc.password}" />

        <property name="maxActive" value="${hitop_pxc_db1_ds.jdbc.maxActive}" />

        <property name="maxIdle" value="${hitop_pxc_db1_ds.jdbc.maxIdle}" />

        <property name="maxWait" value="${hitop_pxc_db1_ds.jdbc.maxWait}" />

        <property name="validationQuery" value="select 1" />

        <property name="defaultAutoCommit" value="true" />

    </bean>

同时在dataSource中增加对应的条目,如下所示:

    <bean id="dataSource" class="com.cyl.kernel.DynamicDataSource">

            <property name="targetDataSources"> 

            <map key-type="java.lang.String"> 

                <entry key="localSrc_ds" value-ref="localSrc_ds" />

                <entry key="hitop_pxc_db1_ds" value-ref="hitop_pxc_db1_ds" /> 

                <entry key="perfstat_ds" value-ref="perfstat_ds" /> 

            </map> 

        </property>

        <property name="defaultTargetDataSource" ref="perfstat_ds" />

    </bean>

 

(2)、在WEB-INF/conf/jdbc-mysql.properties中增加对应的系统配置,如下所示:

hitop_pxc_db1_ds.jdbc.driverClassName=com.mysql.jdbc.Driver

hitop_pxc_db1_ds.jdbc.url=jdbc:mysql://172.28.1.102:3306/performance_schema?useUnicode=true&characterEncoding=gbk&autoReconnect=true&failOverReadOnly=false

hitop_pxc_db1_ds.jdbc.username=root

hitop_pxc_db1_ds.jdbc.password=hundsun

hitop_pxc_db1_ds.jdbc.maxActive=5

hitop_pxc_db1_ds.jdbc.maxIdle=2

hitop_pxc_db1_ds.jdbc.maxWait=10000

 

(3)登录使用perf_stat用户登录监控服务器mysql,执行如下insert语句:

USE perf_stat;

INSERT INTO apps(hostname,PORT,appname,ver) VALUES('mysql服务器地址',端口,'唯一标识该mysql实例的id,不得重复','mysql大版本');

如:

INSERT INTO apps(hostname,PORT,appname,ver) VALUES('localhost',3306,'localSrc','5.6');

INSERT INTO apps(hostname,PORT,appname,ver) VALUES('localhost',3306,'localSrc','5.7'); 5.6、5.7经过测试,5.5不确定

 

 

三、perfstat后台服务

1、每隔15/20分钟采集一次;采集时会自动过滤mysql、performance_schema、information_schema三个对象中的CRUD以及各种操作

采集时对于PS中表的操作,会设置SET sql_log_bin = off;以避免truncate PS相关表时传播到其他节点(如果主从或者galera cluster的话)

2、自动清除7天前的日志

 

四、访问

http://ip:8080即可打开主页面,如

blob.png

 

war包下载地址,baidu pan http://pan.baidu.com/s/1slf8h5b。

 

下一版本计划更新内容:

1、支持界面增加被监控实例,简化配置;

2、支持监控暂停与恢复;

3、支持不同实例不同调度策略;

4、增加slave监控;

转载于:https://www.cnblogs.com/zhjh256/p/5686948.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值