媲美oracle awr/statspack的mysql awr初版發佈

現發佈alpha版mysql awr,其提供的特性相似於oracle awr或statspack+集中式監控。對於原來從事oracle dba或者相關運維的人原來講,這會是個不錯的選擇。java

至於我爲何不選擇用zabbix,monyog,nagios等等監控工具,相信各數據庫專家們懂的。mysql

系統邏輯結構ios

blob.png

支持配置監控多個mysql實例。web

 

關鍵監控內容spring

blob.png

 

 

 

 

 

 

 

1、源系統配置sql

  • 建議percona server      5.6/mariadb+,支持mysql,percona,mariadb 5.6,5.7。數據庫

  • 啓用performance_schema,userstat參數apache

  • 建立perf_stat用戶,授予select      information_schema,performance_schema select/truncate權限;服務器

  • 確保安裝了lsof,或yum install lsof進行安裝。

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

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

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

 

2、perfstat配置

一、建立存儲表結構

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分鐘增量

 

二、配置監控的數據源

在當前版本的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.六、5.7通過測試,5.5不肯定

 

 

3、perfstat後臺服務

一、每隔15/20分鐘採集一次;採集時會自動過濾mysql、performance_schema、information_schema三個對象中的CRUD以及各類操做

採集時對於PS中表的操做,會設置SET sql_log_bin = off;以免truncate PS相關表時傳播到其餘節點(若是主從或者galera cluster的話)

二、自動清除7天前的日誌

 

4、訪問

http://ip:8080便可打開主頁面,如

blob.png

 

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

 

下一版本計劃更新內容:

一、支持界面增長被監控實例,簡化配置;

二、支持監控暫停與恢復;

三、支持不一樣實例不一樣調度策略;

四、增長slave監控;

相關文章
相關標籤/搜索