[关闭]
@zhangyy 2021-01-12T17:53:20.000000Z 字数 3173 阅读 133

CentOS7.5 安装配置天兔(lepus)监控数据库

运维系列


  • 一: 天兔(lepus) 监控介绍
  • 二: 天兔(lepus) 安装环境配置
  • 三: 天兔(lepus)部署

一: 天兔(lepus) 监控介绍

  1. Lepus(天兔)数据库企业监控系统是一套由专业DBA个人(目前就职于某互联网公司),针对互联网企业开发的一款专业、强大的企业数据库监控管理系统,企业通过Lepus可以对数据库的实时健康和各种性能指标进行全方位的监控。目前已经支持MySQLOracleMongoDBRedis数据库的全面监控.
  2. 参考:官方文档
  3. http://www.lepus.cc/manual/index/

二: 天兔(lepus) 安装环境配置

2.1安装环境介绍

  1. 搭建环境如下:
  2. CentOS 7.5x64
  3. 已关闭iptables / selinux
  4. 安装天兔版本: lepus3.8Beta
  5. 主机名配置:
  6. 192.168.20.73 lepus.flyfish

image_1d3qj4jdnaut12e0nvabn18j29.png-81.3kB

2.2 环境安装初始化

  1. 1. 配置LAMP 环境 安装php httpd 服务
  2. yum install -y php httpd
  3. service httpd start
  4. chkconfig httpd on

image_1d3qji02j1tfqqutk8gkkd773m.png-353.6kB

image_1d3qjikd6183fraq1h6ei86109713.png-203.5kB

  1. 2.安装mysql-server
  2. yum remove -y mariadb-libs
  3. yum install -y perl-Data-Dumper
  4. tar -xvf MySQL-5.6.43-1.el7.x86_64.rpm-bundle.tar
  5. rpm -ivh MySQL-shared-compat-5.6.43-1.el7.x86_64.rpm
  6. rpm -ivh MySQL-shared-5.6.43-1.el7.x86_64.rpm
  7. rpm -ivh MySQL-devel-5.6.43-1.el7.x86_64.rpm
  8. rpm -ivh MySQL-embedded-5.6.43-1.el7.x86_64.rpm
  9. rpm -ivh MySQL-test-5.6.43-1.el7.x86_64.rpm
  10. rpm -ivh MySQL-server-5.6.43-1.el7.x86_64.rpm

image_1d3vbc7vc8talpd1j9618if1431bq.png-467.7kB
image_1d3vbggihe9n1jisadj5dfv8pc7.png-330.8kB

1.png-509.7kB

2.png-509.8kB

3.png-528.5kB

4.png-567.8kB

  1. 找到mysql的初次登录密码
  2. cat .mysql_secret
  3. service mysql start
  4. chkconfig mysql on

5.png-176.6kB

6.png-278.6kB

  1. mysql -uroot -p
  2. set password = password ("flyfish225");
  3. flush privileges;

7.png-146.2kB


  1. 3.安装lepus server需要的依赖包
  2. yum install gcc python-devel net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xml -y

image_1d3qkvsaoo52el9119j113q1cru4h.png-867.1kB

  1. 4. 配置php的环境
  2. sed -i "s/;date.timezone =/date.timezone = Asia\/Shanghai/g" /etc/php.ini
  3. sed -i "s#max_execution_time = 30#max_execution_time = 300#g" /etc/php.ini
  4. sed -i "s#post_max_size = 8M#post_max_size = 32M#g" /etc/php.ini
  5. sed -i "s#max_input_time = 60#max_input_time = 300#g" /etc/php.ini
  6. sed -i "s#memory_limit = 128M#memory_limit = 128M#g" /etc/php.ini
  7. sed -i "/;mbstring.func_overload = 0/ambstring.func_overload = 2\n" /etc/php.ini

image_1d3ql5djv1rtqql4cmq14o32q74u.png-269.8kB

  1. 5.安装MySQLdb-python
  2. unzip MySQL-python-1.2.5.zip
  3. which mysql_config

image_1d3ql8cmh1knl1r8o1s6685s1eo65b.png-418.9kB

image_1d3v7ph591teivbf1ie016bf1hd04n.png-185.8kB

  1. cd Mysql_python-1.2.5
  2. vim site.cfg
  3. ----
  4. mysql_config = /usr/bin/mysql_config
  5. ----

image_1d3v7qhsfj5p1q83j6i1t647u854.png-261kB

  1. yum install python-setuptools
  2. python setup.py build
  3. python setup.py install

image_1d3vc7cfdv0il7kmnq12mafi1fo.png-659.9kB

image_1d3v7uir71ti41d3l4jk1lrt49m5h.png-808.9kB

image_1d3v7v77bbvn16se1e1l5fvo1v5u.png-799.3kB


  1. 6. 安装redis 如果不监控redis 可以不安装
  2. wget https://pypi.python.org/packages/source/r/redis/redis-2.10.3.tar.gz
  3. tar -zxvf redis-2.10.3.tar.gz
  4. cd redis-2.10.3
  5. python setup.py install

image_1d3v85ibc1smqsm8h60agk17s16b.png-858.2kB

image_1d3v8620d1l051j8n191m12t01qvc6o.png-340.6kB

image_1d3v86h1v1k0u20q1k3d19bt1ibq75.png-472.4kB


三:天兔(lepus)部署

3.1 下载天兔(lepus)采集器

  1. 下载Lepus软件包下载地址:http://www.lepus.cc/soft/17,然后登录数据库创建lepus数据库和MySQL用户
  2. ----
  3. unzip Lepus数据库企业监控系统3.8_Beta版本官方下载.zip
  4. cd Lepus_v3.8_beta/

image_1d3v8f36encqvkk1tan17l21e8q7i.png-579.9kB

image_1d3v8fkm31pmqhodl8oui91npk7v.png-290.8kB

3.2 配置mysql 的授权访问

  1. mysql 当中 创建lepus库并授权
  2. mysql -uroot -pflyfish225
  3. create database lepus default character set utf8;
  4. grant select,insert,update,delete,create on lepus.* to 'lepus'@'localhost' identified by 'lepus';
  5. grant select,insert,update,delete,create on lepus.* to 'lepus'@'127.0.0.1' identified by 'lepus';
  6. flush privileges;

image_1d3v8mpd814jpr23hc4541a4e8c.png-386.7kB

3.3 导入 lepus 初始化数据

  1. 导入lepus数据库初始化数据
  2. cd /root/Lepus_v3.8_beta/sql
  3. mysql -uroot -pflyfish225 lepus < lepus_table.sql
  4. mysql -uroot -pflyfish225 lepus < lepus_data.sql

image_1d3vcf8hg5dfe6h15e4i2718dlg5.png-322.5kB

  1. 安装lepus并,运行脚本install.sh
  2. cd /root/Lepus_v3.8_beta/python
  3. sh install.sh

image_1d3vch2drm6u1vhl5t61kq3pdpgi.png-623.1kB

  1. 给全部脚本有执行权限,修改lepus连接数据库的配置文件
  2. cd /usr/local/lepus/
  3. chmod +x *.py
  4. chmod +x *.sh

image_1d3vcj8fc1o3d19ak11i3tlkni8gv.png-600.4kB

  1. cd /usr/local/lepus/etc/
  2. vim config.ini
  3. ---
  4. ###监控机MySQL数据库连接地址###
  5. [monitor_server]
  6. host="127.0.0.1"
  7. port=3306
  8. user="lepus"
  9. passwd="lepus"
  10. dbname="lepus"
  11. ---

image_1d3v9hh101kc11imnsjj1lpn1qcbb0.png-286.2kB

image_1d3v9icb3ck9lt2c314351s1tbd.png-180.5kB


  1. 启动:lepus
  2. lepus --help

image_1d3vcl38d1d7lhj6170a8goo9uhc.png-218.2kB

  1. lepus start

image_1d3vclseafgdqru1d9l1fm5jnehp.png-183.5kB

3.4 配置lepus的web界面

  1. cd /root/Lepus_v3.8_beta/php
  2. cp -ap * /var/www/html/
  3. cd /var/www/html/application/config
  4. vim database.php
  5. ----
  6. $db['default']['hostname'] = '127.0.0.1';
  7. $db['default']['port'] = '3306';
  8. $db['default']['username'] = 'lepus';
  9. $db['default']['password'] = 'lepus';
  10. $db['default']['database'] = 'lepus';
  11. $db['default']['dbdriver'] = 'mysql';
  12. ----

image_1d3ve38b119p71j7ss5ik71pdfi6.png-261.5kB

  1. 重新启动httpd 服务
  2. service httpd restart

image_1d3ve5ual1higfql1aokkji1i0dij.png-166.1kB

  1. 使用web访问:
  2. http://192.168.20.73

image_1d3veb9tm12gpcs113bcmkjh0ij0.png-658.2kB

  1. 默认用户名: admin 密码: Lepusadmin

image_1d3veetk71v9p1ja91drlk9e1a1tjd.png-384.6kB

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注