1.orzdba_monitor.sh脚本使用

  • ./orzdba_monitor.sh 主要是用nohup同时在后台调用orzdba,启动下面三个命令
[root@node02 scripts]# ps -ef |grep orzdba
root 19887 1 0 17:40 ? 00:00:00 /usr/bin/perl -w /scripts/orzdba -i 10 -t -mysql -innodb_rows -L /r2/monitor/log_orzdba_mysql -logfile_by_day
root 19888 1 0 17:40 ? 00:00:00 /usr/bin/perl -w /scripts/orzdba -i 10 -t -sys -d sda -L /r2/monitor/log_orzdba_sys -logfile_by_day
root 19889 1 0 17:40 ? 00:00:00 /usr/bin/perl -w /scripts/orzdba -i 10 -processlist -L /r2/monitor/log_orzdba_proc -logfile_by_day
  • 根据实际情况,需要修改变量:

    • SCRIPTS_FILE=/scripts --脚本所在目录
    • MONITOR=/r2/monitor --监控日志保存目录
    • DEVICE_NAME="sda" --数据库所在的硬盘盘符
    • DELETE_DAYS=15 --日志保存天数
  • 添加权限

[root@node02 scripts]# chmod 755 orzdba
[root@node02 scripts]# chmod 755 orzdba_monitor.sh
  • 计划任务

    • crontab -e
    • 每5分钟执行一次脚本,如果没有进程就启动
    • */5 * * * * /scripts/orzdba_monitor.sh >/dev/null 2>&1
  • 日志,分别生成三个日志,根据日期截断日志,可以设置保存日志的天数

    • 日志目录显示如下:
[root@node01 monitor]# ll /r2/monitor/
total 194052
-rw-r--r-- 1 root root 225257 Apr 24 15:36 log_orzdba_mysql.2018-04-24
-rw-r--r-- 1 root root 180040747 Apr 24 15:36 log_orzdba_proc.2018-04-24
-rw-r--r-- 1 root root 202990 Apr 24 15:36 log_orzdba_sys.2018-04-24
-rw-r--r-- 1 root root 114 Apr 24 15:35 orzdba.log

2.orzdba

  • 根据实际情况,在orzdba中修改帐号信息。
my $user="root";       # -u   --mysql帐号
my $pass="iforgot"; # -p --mysql密码
my $host="localhost"; # -h --mysqlhost
  • 验证帐号如下:
[root@node02 scripts]#  ./orzdba -u root -p iforgot -h localhost -innodb  -C 5 -i 2  2>/dev/null
.=================================================.
| Welcome to use the dba tool ! |
'=============== Date : 2018-04-23 ===============' Local_Host: node02.mysql.com Local_IP: 192.168.49.247 MySQL_Host: localhost MySQL_DB :
ttt MySQL_Var : binlog_format[ROW] character_set_server[utf8] enforce_gtid_consistency[ON] gtid_mode[ON]
log_bin[ON] max_allowed_packet[4194304] max_binlog_cache_size[17179869184G] max_binlog_size[1G]
max_connect_errors[100000] max_connections[10000] max_user_connections[9990] open_files_limit[50000]
skip_name_resolve[ON] sync_binlog[0] table_definition_cache[912] table_open_cache[1024]
thread_cache_size[64] wait_timeout[31536000] innodb_adaptive_flushing[ON] innodb_adaptive_hash_index[ON] innodb_buffer_pool_size[4G] innodb_file_per_table[ON]
innodb_flush_log_at_trx_commit[2] innodb_flush_method[O_DIRECT] innodb_io_capacity[200] innodb_lock_wait_timeout[5]
innodb_log_buffer_size[16M] innodb_log_file_size[2G] innodb_log_files_in_group[2] innodb_max_dirty_pages_pct[75.000000]
innodb_open_files[1024] innodb_read_io_threads[4] innodb_thread_concurrency[64] innodb_write_io_threads[4] -------- ---innodb bp pages status-- -----innodb data status---- --innodb log-- his --log(byte)-- read ---query---
time | data free dirty flush| reads writes read written|fsyncs written| list uflush uckpt view inside que|
18:08:12| 0 0 0 0| 0 0 0 0| 0 0| 0 0 0 0 0 0|
18:08:14| 104298 157834 3 0| 0 0 0 0| 0 0| 61 0 9 0 0 0|
18:08:16| 104298 157834 0 1| 0 1 0 24k| 0 0| 61 0 9 0 0 0|
  • 帮助命令(./orzdba -I)
Usage :
Command line options : -I,--help Print Help Info.
-i,--interval Time(second) Interval.
-C,--count Times.
-t,--time Print The Current Time.
-nocolor Print NO Color. -l,--load Print Load Info.
-c,--cpu Print Cpu Info.
-s,--swap Print Swap Info.
-d,--disk Print Disk Info.
-n,--net Print Net Info. -u MySQL User(default root).
-P MySQL Password(default iforgot).
-P,--port Port number to use for mysql connection(default 3306).
-S,--socket Socket file to use for mysql connection.
-h,--host Host (hostname/IP). -mysql Print MySQLInfo (include -t,-com,-hit,-T,-B).
-innodb Print InnodbInfo(include -t,-innodb_pages,-innodb_data,-innodb_log,-innodb_status)
-com Print MySQL Status(Com_select,Com_insert,Com_update,Com_delete).
-hit Print Innodb Hit%.
-processlist Print Show Full Processlist
-innodb_rows Print Innodb Rows Status(Innodb_rows_inserted/updated/deleted/read).
-innodb_pages Print Innodb Buffer Pool Pages Status(Innodb_buffer_pool_pages_data/free/dirty/flushed)
-innodb_data Print Innodb Data Status(Innodb_data_reads/writes/read/written)
-innodb_log Print Innodb Log Status(Innodb_os_log_fsyncs/written)
-innodb_status Print Innodb Status from Command: 'Show Engine Innodb Status';
(history list/ log unflushed/uncheckpointed bytes/ read views/ queries inside/queued) -T,--threads Print Threads Status(Threads_running,Threads_connected,Threads_created,Threads_cached).
-B,--bytes Print Bytes received from/send to MySQL(Bytes_received,Bytes_sent).
-rt Print MySQL DB RT(us). -sys Print SysInfo (include -t,-l,-c,-s).
-lazy Print Info (include -t,-l,-c,-s,-com,-hit). -L,--logfile Print to Logfile.
-logfile_by_day One day a logfile,the suffix of logfile is 'yyyy-mm-dd';
and is valid with -L.
Sample :
shell> ./orzdba -u xxxxx -p xxxxx -innodb -C 5 -i 2 2>/dev/null
shell> ./orzdba -u xxxxx -p xxxxx -lazy -d sda -C 5 -i 2 2>/dev/null
shell> ./orzdba -h xxxxx -u xxxxx -p xxxxx -processlist -C 5 -i 2 2>/dev/null
shell> nohup ./orzdba -u xxxxx -p xxxxx -lazy -d sda -C 5 -i 2 -L /tmp/orzdba.log > /dev/null 2>&1 &

3.问题

1.没有创建监控目录,请排查脚本执行权限

2.监控目录里面没有获取到日志文件,请排查MySQL访问权限或者监控盘符配置错误

3.报"orzdba_xxxx未启动,开始执行",但没获取到日志,请排查是否有已启动的线程,kill掉,重新执行

orzdba_monitor.sh脚本使用的更多相关文章

  1. orzdba_monitor.sh和orzdba

    1.脚本 #!/bin/bash # line: V1.0 # mail: gczheng@139.com # data: 2018-04-23 # script_name: orzdba_monit ...

  2. sh脚本异常:/bin/sh^M:bad interpreter: No such file or directory

    在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory. 分析:这是不同系统编码格式引起的:在windows系统中 ...

  3. linux执行sh脚本文件命令

    linux执行sh脚本文件命令 很多时候需要多个命令来完成一项工作,而这个工作又常常是重复的,这个时候我们自然会想到将这些命令写成sh脚本,下次执行下这个脚本一切就都搞定了,下面就是发布代码的一个脚本 ...

  4. .sh脚本判断判断某一变量是否为某一数值

    .sh脚本中,判断某一变量(例如:OEM_CUSTOMER_SUPPORT)是否为某一数值(例如:0),并根据条件做不同处理,写法如下: if [ $OEM_CUSTOMER_SUPPORT -eq  ...

  5. sh脚本学习之: sh脚本 、sed、awk

    sh脚本 sh命令的批处理文件,支持更复杂的逻辑. Shell中的变量 参数 $0 当前脚本路径 $1....$n 脚本执行对应的第n个参数 条件判断 文件判断 test [op] path e存在 ...

  6. 安装GRID时跑root.sh脚本报错(ORA-27091: unable to queue I/O)

    在安装GRID过程中,运行root.sh脚本时报如下信息: Adding Clusterware entries to upstart CRS-2672: Attempting to start 'o ...

  7. sh脚本异常:bad interpreter: No such file or directory

    转:http://bluedest.iteye.com/blog/1674963 在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file o ...

  8. ubuntu sh脚本双击运行

    自从13.04以后,双击sh脚本文件就已经默认是geidt打开了,要想运行,从nautilus-->文件-->首选项-->行为-->可执行文件 有三个选项,默认是第二个,如果想 ...

  9. sh脚本执行Java程序

    1.不引用Jar包或者资源文件夹 最简单的程序Hello World. 首先创建Hello.java public class Hello { public static void main(Stri ...

随机推荐

  1. 配置mysql 允许远程连接

    今天折腾了好常时间远程连接mysql ,在云服务器里面打开了3306端口,使用了service mysql status查看到mysql进程正常. netstat -anp | grep mysql ...

  2. TypeError: pivot_table() got an unexpected keyword argument 'rows'

    利用Python进行数据分析>第二章,处理MovieLens 1M数据集,有句代码总是报错: mean_rating = data.pivot_table('rating', rows='tit ...

  3. EasyDSS RTMP流媒体服务器videojs flash播放RTMP/HLS提示错误的解决方案

    本文转自EasyDSS团队成员StarIT的博客:http://blog.csdn.net/staritstarit/article/details/73692715 问题 在博客<EasyDS ...

  4. Android 框架学习3:从 EventBus 中学到的精华

    关联文章: EventBus 3.0 的特点与如何使用 源码分析 EventBus 3.0 如何实现事件总线 学习的目的是为了超越,经过前面对 EventBus 3.0 的学习,我们已经对它相当熟悉了 ...

  5. python 多维list声明时的小问题

    a=[[]]*3 a Out[18]: [[], [], []] a[0].append(1) a Out[20]: [[1], [1], [1]] b=[[] for _ in range(3)] ...

  6. 层序遍历二叉树 完整层序重建二叉树 python

    给定一个二叉树的完整的层次遍历序列(包含所有节点,包括空节点),利用这个序列生成一颗二叉树. 我们首先来看怎样对一颗二叉树进行层序遍历,下图所示的二叉树层次遍历的结果为[a,b,c,d,e],在这个过 ...

  7. Could not load the "light_rain.png" image referenced from a nib in the bundle with identifier

    导入图片文件夹的时候勾选create groups

  8. 去除inline-block元素间间距的N种方法(转)

    一.现象描述 真正意义上的inline-block水平呈现的元素间,换行显示或空格分隔的情况下会有间距,很简单的个例子: <input /> <input type="su ...

  9. Python 实现windows后台服务

    # -*- coding: utf-8 -*- import sys import win32api import win32con import win32event import win32ser ...

  10. 原生Ajax使用

    Ajax基础 Ajax(Asynchronous JavaScript And XML)概念:通过XMLHttpRequest对象向服务器提出请求并处理响应,进行页面的局部更新. AJAX都有哪些优点 ...