天兔(Lepus)数据库监控系统安装笔记
一、部署:
本次 *** 作系统:centos6.9 IP:192.168.153.145
Lepus_v3.8_beta
MySQL-python-1.2.5
xampp-linux-x64-1.8.2-5-installer.run
Lepus安装需要Lamp环境,lepus官网手册也建议采用XAMPP的方式安装,XAMPP的一键部署LAMP环境省心省力
注意:xampp会把apache,mysql,php都安装,所以建议干净的环境中进行安装,高版本的XAMPP中可能不是Mysql而是MariaDB
.安装XAMPP:
本次采用的是:xampp-linux-x64-1.8.--installer.run 本次放在/opt下面了。
[root@localhost opt]# wget https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/1.8.2/xampp-linux-x64-1.8.2-5-installer.run/download
[root@localhost opt]# chmod +x xampp-linux-x64-1.8.--installer.run
[root@localhost opt]# ./xampp-linux-x64-1.8.--installer.run
[root@localhost opt]# /opt/lampp/lampp start
[root@localhost opt]# vim /etc/profile #追加环境变量
export PATH=$PATH:/opt/lampp/bin/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/lampp/lib
[root@localhost opt]# source /etc/profile
.安装MySQL-python,本次下载的 MySQL-python-1.2..zip [下载网址 https://pypi.org/project/MySQL-python/]
[root@localhost opt]# wget https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
[root@localhost opt]# unzip MySQL-python-1.2..zip
[root@localhost opt]# cd MySQL-python-1.2.
[root@localhost MySQL-python-1.2.]# which mysql_config
/opt/lampp/bin/mysql_config
[root@localhost MySQL-python-1.2.]# vim site.cfg #添加内容
mysql_config = /opt/lampp/bin/mysql_config
[root@localhost MySQL-python-1.2.]# python setup.py build
[root@localhost MySQL-python-1.2.]# python setup.py install
.安装lepus:[Lepus数据库企业监控系统3. Beta版本官方下载.zip ,lepus官网下载http://www.lepus.cc/soft/download/18]
[root@localhost opt]# unzip Lepus数据库企业监控系统3. Beta版本官方下载.zip
#解压后,先配置mysql数据库。
mysql> create database lepus default character set utf8;
mysql>grant select,insert,update,delete,create on lepus.* to 'lepus'@'localhost' identified by '密码';
mysql> flush privileges;
[root@localhost opt]# mysql -uroot -p lepus < /opt/Lepus_v3.8_beta/sql/lepus_table.sql
[root@localhost opt]# mysql -uroot -p lepus < /opt/Lepus_v3.8_beta/sql/lepus_data.sql
mysql>use lepus
mysql>alter table mysql_status modify column max_connect_errors bigint();
mysql>alter table mysql_status_history modify column max_connect_errors bigint();
#添加被监控主机建议建立数据库账号,如备机上的数据库,创建lepus_monitor账号即可
mysql> grant select,super,process,reload,show databases,replication client on *.* to'lepus_monitor'@'%' identified by '密码';
mysql> flush privileges;
[root@localhost opt]# cd Lepus_v3.8_beta/python/
[root@localhost python]# chmod +x install.sh
[root@localhost python]# ./install.sh
[root@localhost python]# vim /usr/local/lepus/etc/config.ini
[monitor_server]
host="192.168.153.145"
port=
user="lepus"
passwd="密码"
dbname="lepus"
[root@localhost opt]# cp -r /opt/Lepus_v3.8_beta/php/* /opt/lampp/htdocs/
[root@localhost opt]# vim /opt/lampp/htdocs/application/config/database.php
$db['default']['hostname']= '192.168.153.145';
$db['default']['port'] = '3306';
$db['default']['username']= 'lepus';
$db['default']['password']= '密码';
$db['default']['database']= 'lepus';
$db['default']['dbdriver']= 'mysql';
[root@localhost opt]# cd /usr/local/lepus/
[root@localhost opt]# lepus start
lepus server startsuccess!
#有问题看日志
[root@localhost opt]# tail -f /usr/local/lepus/nohup.out
[root@localhost opt]# tail -f /usr/local/lepus/logs/lepus.log
.配置http
vim /opt/lampp/etc/extra/httpd-vhosts.conf 删除原有的,改为
<VirtualHost*:>
AddDefaultCharset UTF-
DocumentRoot "/opt/lampp/htdocs"
ServerName xxxx.com #此处自定义,与/etc/hosts参照[可选]
<Directory"/opt/lampp/htdocs">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
</Directory>
ErrorLog"|/usr/local/apache/bin/rotatelogs /home/logs/apache/php_%Y%m%d_error.log86400 480"
CustomLog"|/usr/local/apache/bin/rotatelogs /home/logs/apache/php_%Y%m%d_access.log86400 480" common
</VirtualHost>
通过浏览器输入192.168.153.145打开监控界面,即可登录系统。
默认管理员账号密码admin/Lepusadmin登录后请修改管理员密码,增加普通账号。
.设置开机启动:
#让xampp开机自动启动
sudo ln -s /opt/lampp/lampp /etc/init.d/lampp
sudo chkconfig --add lampp
二、扩展阅读:安装过程中可能遇到的报错如:
1.安装好lepus之后启动 lepus start
lepus server start fail!
解决办法: 看日志tail -f /usr/local/lepus/logs/lepus.log 发现错误:
egrep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
egrep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/bin/bash: error while loading shared libraries: libdl.so.2: cannot open shared object file: No such file or directory
egrep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
解决办法:有人说少了glibc包,32/64的都安装了,然并没有用。
vim /opt/lampp/lampp找到export LD_ASSUME_KERNEL=2.2.5这一行,并修改内容为export LD_ASSUME_KERNEL=2.8.0,保存退出就可以解决了。
当然修改为不低于2.6.32的其他值也可以。
找了下这个设置的资料解释,原来这个配置是为了旧 *** 作系统的一些兼容性问题。
【参考资料https://www.cnblogs.com/shengulong/p/7262346.html?utm_source=itdadao&utm_medium=referral】
2.安装MySQL-python过程中,如:ImportError: No module named setuptools
解决办法:setuptools安装完成之后再安装[https://files.pythonhosted.org/packages/6f/10/5398a054e63ce97921913052fde13ebf332a3a4104c50c4d7be9c465930e/setuptools-26.1.1.zip]
[root@localhost opt]# cd setuptools-26.1.1
[root@localhost setuptools-26.1.1]# python setup.py install
3.lepus安装过程中如果报错,根据报错信息来 *** 作比如:
ln -s /usr/lib64/libssl.so.1.0.1e /usr/lib64/libssl.so.1.0.0
ln -s /usr/lib64/libcrypto.so.1.0.1e /usr/lib64/libcrypto.so.1.0.0
4.[root@HE3 lepus]#vi check_redis.py
148
149 except Exception, e:
150 logger_msg="check redis %s:%s : %s" %(host,port,e)
151 #logger.warning(logger_msg)
152
153 try:
154 connect=0
155 sql="insert into redis_status(server_id,host,port,tags,connect) values(% s,%s,%s,%s,%s)"
151行的注释掉就解决redis不能监控slave的bug了
5.---MySQL复制监控中无法看图形
vi /opt/lampp/htdocs/application/controllers/lp_mysql.php
337行,去掉'mysql/replication',改为parent::check_privilege();
原来为parent::check_privilege('mysql/replication');
6.---修复mysql复制图表时间偏移导致数据不准确
影响:线型图表时间偏移
修复:修改vi /opt/lampp/htdocs/application/controllers/lp_mysql.php
352行找到public function replication()的$chart_reslut[$i]['delay']=$dbdata['delay'],修该为:
$chart_reslut[$i]['delay'] = !empty($dbdata['delay']) ? $dbdata['delay'] : 0;
7.---修复mysql5.7复制监控没数据
mysql> set global show_compatibility_56=on;
8.默认用nginx跑web管理台会有问题,需要加个rewrite
location /
{
if (!-e $request_filename)
{
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
加入后仍然报 File not found....错误,nginx.conf配置文件进一步检查。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)