3 月 012014
 

 



mysqlMTop 安装手册

下载

 cd /root/install
安装
前期准备
unzip -o mysqlmtop_v1.0_beta_sp1.zip
 yum -y install  vim-enhanced gcc gcc-c++ flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel  pam-devel libtool libtool-ltdl openssl openssl-devel fontconfig-devel libxml2-devel curl-devel  libicu libicu-devel libmcrypt libmcrypt-devel libmhash libmhash-devel
yum -y install php php-devel  php-mysql httpd
yum -y install MySQL-python php-gd
安装sql

mysql> create database mtop default character set utf8;

mysql> grant select,insert,update,delete,create,drop,alter,index on mtop.* to ‘mtop’@’localhost’ identified by ‘mtop321’;

mysql> flush privileges;

导入SQL文件夹里的SQL文件

#mysql -uroot -p mtop < mtop.sql

#mysql -uroot -p mtop < mtop_data.sql
cp -rf mysqlmtop/ /usr/local/
vi  etc/config.ini
[monitor_server]
host=”localhost”
port=3306
user=”mtop”
passwd=”mtop321″
dbname=”mtop”
#本地数据库#
###MySQL数据库用户密码###
[mysql_db]
username=”mtop”
password=”mtop321″
#监控账号和密码#
###邮件报警服务器地址###
[mail_server]
mail_host=””
mail_user=””
mail_pass=””
mail_postfix=”

2.3授予可执行文件执行权限并启动进程

# chmod a+x  *.py

# ln -s /usr/local/mysqlmtop/mtopctl /usr/local/bin/  (这部可以省略)

#  /usr/local/mysqlmtop/mtopctl start

mv frontweb /var/www/html/sqljk
chown -Rf apache:apache /var/www/html/sqljk/
vi application/config/database.php
修改数据库配置文件
vi application/controllers/grapha.php
ini_set(“include_path”, “D:/wwwroot/mysqlmtop/frontweb/public”);
修改成正确的路径
授权
grant select,REPLICATION client,process on *.* to ‘mtop’@’172.21.27.76’ identified by ‘mtop321!@#’;
flush privileges;
问题
vi /var/www/html/sqljk/application/views/widget/bigtable.php
修改大表的单位
 <td><?php echo $item[‘table_size’] ?>M</td>
vi ./check_mysql_widget_bigtable.py
修改
bigtable=cur.execute(“SELECT table_schema as ‘DB’,table_name as ‘TABLE’,CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024  ), 2), ”) ‘TOTAL’ , table_comment as COMMENT FROM information_schema.TABLES ORDER BY data_length + index_length DESC LIMIT 1; ;”);
取最大的值,之前设置的是G,现在改成了M
if table_size > 0:
如果表超过多少的时候,才插入。

 

 Posted by at 下午 3:50

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny