重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
这篇文章将为大家详细讲解有关lepus安装的记录是怎样的,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。
创新互联网站建设公司,提供成都网站设计、成都做网站,网页设计,建网站,PHP网站建设等专业做网站服务;可快速的进行网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,是专业的做网站团队,希望更多企业前来合作!
安装xampp集成环境
[root@230_42-tiantu_monitor lepus]# ./xampp-linux-x64-5.6.24-1-installer.run
[root@230_42-tiantu_monitor lepus]# /opt/lampp/lampp start
[root@230_42-tiantu_monitor lepus]# /opt/lampp/bin/MySQL -uroot -p
初始密码为空
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'work123'
MariaDB [(none)]> flush privileges;
yum install -y libffi-devel python-devel openssl-devel mysql-devel libxml2 libxml2-dev
[root@230_42-tiantu_monitor lepus]# yum install -y libffi-devel python-devel openssl-devel mysql-devel libxml2 libxml2-dev libxslt* zlib openssl ncurses-devel gcc
[root@230_42-tiantu_monitor lepus]# unzip MySQL-python-1.2.5.zip
[root@230_42-tiantu_monitor lepus]# cd MySQL-python-1.2.5
[root@230_42-tiantu_monitor lepus]# python setup.py build
[root@230_42-tiantu_monitor lepus]# python setup.py install
[root@230_42-tiantu_monitor lepus]# rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
Preparing... ########################################### [100%]
1:oracle-instantclient11.########################################### [100%]
[root@230_42-tiantu_monitor lepus]# rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
Preparing... ########################################### [100%]
1:oracle-instantclient11.########################################### [100%]
[root@230_42-tiantu_monitor lepus]# rpm -ivh oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
Preparing... ########################################### [100%]
1:oracle-instantclient11.########################################### [100%]
[root@230_42-tiantu_monitor lepus]# rpm -ivh oracle-instantclient11.2-tools-11.2.0.4.0-1.x86_64.rpm
Preparing... ########################################### [100%]
1:oracle-instantclient11.########################################### [100%]
[root@230_42-tiantu_monitor ~]# cat ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export TNS_ADMIN=$ORACLE_HOME/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/local/lib
export TNS_ADMIN=/usr/local/oracle/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH
export PATH=$PATH:$ORACLE_HOME
export LD_LIBRARY_PATH
export PATH
[root@230_42-tiantu_monitor ~]# cd $ORACLE_HOME
[root@230_42-tiantu_monitor client64]# mkdir -p network/admin/
[root@230_42-tiantu_monitor client64]# vi network/admin/tnsnames.ora
[root@230_42-tiantu_monitor ~]# tar zxvf pymongo-3.3.0.tar.gz
[root@230_42-tiantu_monitor ~]# cd pymongo-3.3.0
[root@230_42-tiantu_monitor ~]# python setup.py build
[root@230_42-tiantu_monitor ~]# python setup.py install
yum -y install mysql-devel libxml2 libxml2-dev libxslt* zlib gcc openssl
yum install python-devel mysql-devel zlib-devel openssl-devel
yum install ncurses-devel
系统监控
[root@20_52-MongoDB3_test ~]# yum install net-snmp*
[root@20_52-mongodb3_test ~]# vi /etc/snmp/snmpd.conf
40 # sec.name source community
41 com2sec notConfigUser 192.168.20.136 lepus
61 # group context sec.model sec.level prefix read write notif
62 access notConfigGroup "" any noauth exact all none none
84 ## incl/excl subtree mask
85 view all included .1 80
[root@localhost ~]# vi /etc/init.d/snmpd
#OPTIONS="-LS0-6d -Lf /dev/null -p /var/run/snmpd.pid"
OPTIONS="-LS 4 d -p /var/run/snmpd.pid -a"
[root@localhost ~]# service snmpd restart
慢SQL监控
客户端配置
安装后toolkit
rpm -ivh MySQL-shared-compat-5.6.32-1.el6.x86_64.rpm
yum -y install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
yum -y install perl-IO-Socket-SSL install perl-DBI perl-DBD-MySQL perl-Time-HiRes perl-IO-Socket-SSL
tar zxvf percona-toolkit_2.2.15-2.tar.gz
cd percona-toolkit-2.2.15/
perl Makefile.PL
make
make install
######MySQL slow query
*/5 * * * * /opt/scripts/mysql/slow_query.sh
#!/bin/bash
#****************************************************************#
# ScriptName: /usr/local/sbin/lepus_slowquery.sh
# Create Date: 2014-03-25 10:01
# Modify Date: 2014-03-25 10:01
#***************************************************************#
#config lepus database server
lepus_db_host="l192.168.1.1"
lepus_db_port=3306
lepus_db_user="root"
lepus_db_password="test"
lepus_db_database="lepus"
#config mysql server
mysql_client="/usr/local/mysql/bin/mysql"
mysql_host="127.0.0.1"
mysql_port=3306
mysql_user="root"
mysql_password="test"
#config slowqury
slowquery_dir="/mysqldb/mysql/log/"
slowquery_long_time=5
slowquery_file=`$mysql_client -h$mysql_host -P$mysql_port -u$mysql_user -p$mysql_password -e "show variables like 'slow_query_log_file'"|grep log|awk '{print $2}'`
pt_query_digest="/usr/local/bin/pt-query-digest"
#config server_id
lepus_server_id=286
#collect mysql slowquery log into lepus database
$pt_query_digest --user=$lepus_db_user --password=$lepus_db_password --port=$lepus_db_port --review h=$lepus_db_host,D=$lepus_db_database,t=mysql_slow_query_review --history h=$lepus_db_host,D=$lepus_db_database,t=mysql_slow_query_review_history --no-report --limit=100% --filter=" \$event->{add_column} = length(\$event->{arg}) and \$event->{serverid}=$lepus_server_id " $slowquery_file > /tmp/lepus_slowquery.log
##### set a new slow query log ###########
tmp_log=`$mysql_client -h$mysql_host -P$mysql_port -u$mysql_user -p$mysql_password -e "select concat('$slowquery_dir','slowquery_',date_format(now(),'%Y%m%d'),'.log');"|grep log|sed -n -e '2p'`
#config mysql slowquery
$mysql_client -h$mysql_host -P$mysql_port -u$mysql_user -p$mysql_password -e "set global slow_query_log=1;set global long_query_time=$slowquery_long_time;"
$mysql_client -h$mysql_host -P$mysql_port -u$mysql_user -p$mysql_password -e "set global slow_query_log_file = '$tmp_log'; "
#delete log before 7 days
cd $slowquery_dir
/usr/bin/find ./ -name 'slowquery_*' -mtime +7|xargs rm -rf ;
关于lepus安装的记录是怎样的就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。