數據庫的監控工具天兔(lepus)安裝備案

前言

關閉防火牆和selinux。
lepus安裝ip地址:192.168.1.17

1.安裝apache

下載解壓httpd:

# tar xf httpd-2.2.31.tar.gz                          

進入httpd-2.2.31

1.2.編譯安裝

編譯命令如下:

# ./configure --prefix=/usr/local/apache2 --enable-rewrite --enable-so  

如果報錯看看是不是沒有安裝gcc之類的基礎環境

# yum install gcc 

然後再繼續編譯安裝

# make && make install

1.3.測試Apache能否運行

# cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
# etc/init.d/httpd start

打開網頁192.168.1.17 查看 it works顯示成功

2.MySQL的安裝

# rpm -ivh  MySQL-client-5.5.45-1.linux2.6.x86_64.rpm MySQL-devel-5.5.45-1.linux2.6.x86_64.rpm MySQL-server-5.5.45-1.linux2.6.x86_64.rpm MySQL-shared-5.5.45-1.linux2.6.x86_64.rpm  
# service mysql start

2.2. 登錄MySQL測試

設置mysql密碼:

# /usr/bin/mysqladmin -u root password '123456' 

3.安裝PHP

# tar -xvf php-5.6.11.tar.gz
# ./configure --with-mysql --with-mysqli --with-mysql-sock --enable-pdo --with-pdo-mysql --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib-dir=/usr/include/zlib.h --with-gd
# make && make install

編譯過程中可能會遇到一些錯誤可能是某些包沒有安裝可以參考一下CentOS編譯PHP5過程中常見錯誤信息的解決方法
php安裝好:

# cat /usr/local/apache/conf/httpd.conf
.........................
   DirectoryIndex index.html index.php
   application/x-httpd-php .php
.........................

在htdocs文件夾下新建:

# vim index.php
<?php
phpinfo();
?>

保存,重啓apache服務器,打開網頁192.168.1.17查看。

4.安裝lepus

安裝 MySQLdb for python

# wget http://cdn.lepus.cc/cdncache/software/MySQLdb-python.zip
# unzip MySQLdb-python.zip 
# cd MySQLdb1-master/ 
# which mysql_config 
# /usr/bin/mysql_config

修改文件site.cfg:

# cat site.cfg
mysql_config = /usr/bin/mysql_config
# python setup.py build 
# python setup.py install

然後進入python目錄下,執行:

#python test_driver_mysql.py 

測試有沒有安裝成功!

解壓Lepus軟件:

# unzip Lepus數據庫企業監控系統3.7_vx.x.x.zip

進入MySQL新建數據庫及用戶:

 mysql> create database lepus default character set utf8;
 mysql> grant select,insert,super,update,delete,create on *.* to 'lepus_user'@'192.168.1.17' identified by '123456';
 mysql> flush privileges;
 mysql> \q

導入SQL文件夾裏的SQL文件(表結構和數據文件):

# cd lepus_v3.7
# mysql -uroot –p  lepus < sql/lepus_table.sql 
# mysql -uroot –p  lepus < sql/lepus_data.sql

安裝Lpeus程序
進入到軟件包的python文件夾

# cd python/

授予install.sh可執行權限,並執行:

# chmod +x install.sh
# ./install.sh

修改配置文件
進入到安裝目錄,默認爲/usr/local/lepus:

# cd /usr/local/lepus/
# cat etc/config.ini
    [monitor_server]
    host="192.168.1.17"
    port=3306
    user=" lepus_user "
    passwd="123456"
    dbname="lepus"

然後啓動

# ./lepus start
# cp -rf /root/lepus_3.7/php/* /usr/local/apache2/htdocs/

修改PHP連接監控服務器的數據庫信息:

# cat application\config\database.php
    $db['default']['hostname'] = '192.168.1.17';
    $db['default']['username'] = 'lepus_user';
    $db['default']['password'] = '123456';
    $db['default']['database'] = lepus;
    $db['default']['dbdriver'] = 'mysql';

打開瀏覽器登錄admin/Lepusadmin,添加監控。
如在其他服務器上添加MySQL監控只需要

mysql> grant select,super,process,reload,show databases,replication client on *.* to 'lepus_user'@'192.168.1.17' identified by '123456';
mysql> flush privileges;

然後在監控端的web界面添加即可。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章