Setup MyLVS: Difference between revisions

From MyLVS
Jump to navigation Jump to search
(Created page with "=Setup mySQL= At the very step we need to setup the database with all the required tables, please use the import script '''mylvs.sql''' to do so. You'll find the script withi...")
 
No edit summary
 
(92 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=Get and install myLVS=
*Download myLVS
wget http://mylvs.com/download/mylvs-2.0.5.tar.gz
'''Note that the target paths are used with Debian, there might be different targets for other Linux distribution
*Unextract myLVS
tar -C / -xvf mylvs2.2.tar.gz
*This will create files in:
**/etc/apache2/sites-enabled/
**/etc/apache2/mylvs/
**/etc/systemd/system
**/var/www/mylvs
<br>
==Permissions==
Please set www-data as owner with execute permissions:
root@mylvs01:# chown www-data /var/www/mylvs -R
List root of www:
root@mylvs01:/var/www/mylvs# ls -all
total 124
drwxr-xr-x 6 www-data root  4096 Aug 22 14:14 .
drwxr-xr-x 4 root    root  4096 Jun 12 14:48 ..
drwxr-xr-x 2 www-data root  4096 Aug 22 15:27 backup
-rw-r--r-- 1 www-data root  229 Feb  9  2015 LEGAL
-rwxr-xr-x 1 www-data root  3828 Aug 18 13:25 mylvsinit.pl
-rwxr-xr-x 1 www-data root 92370 Aug 18 13:30 mylvsmon.pl
drwxr-xr-x 2 www-data root  4096 Aug 22 14:59 scripts
drwxr-xr-x 4 www-data root  4096 Feb  9  2015 ws
drwxr-xr-x 4 www-data root  4096 Aug 22 14:10 wwwroot
=Setup mySQL=
=Setup mySQL=
At the very step we need to setup the database with all the required tables, please use the import script '''mylvs.sql''' to do so.  
At the very step is to setup the database with all the required tables, please use the following import script '''mylvs.sql''' to do so. <br>
You'll find the script within the download archive in /scripts or on the reference vm in /var/www/mylvs/scripts
You will find the script within the archive or on your disk in: '''/var/www/mylvs/templates/mysql_data/mylvs.sql'''<br>
  mysql -u root -p < lvs.sql
Note: The mysql pwd is '''demo'''
  mysql -u root -p < /var/www/mylvs/templates/mysql_data/mylvs.sql
 
<br>You may also see: [[SQL database setup#Create the Database and the Users|Create the Database and the Users]]<br><br>
 
=Setup Apache=
Copy the configuration to your Apache Webserver if not already done:
cp /var/www/mylvs/templates/etc/apache2/sites-available/mylvs.conf /etc/apache2/sites-available/
 
Optional copy the Webservice configuration to your Apache Webserver:
cp /var/www/mylvs/templates/etc/apache2/sites-available/ws.mylvs.foo.conf /etc/apache2/sites-available/
 
Verify the myLVS Web configuration and enable it with a2ensite:
a2ensite mylvs.conf
 
Optional verify the myLVS Monitor configuration and enable it with a2ensite:
a2ensite ws.mylvs01.foo.conf
 
Restart Apache
service apache2 restart
 
=myLVS configuration=
myLVS is using a XML configuration in /etc/myslvs/mylvs.conf.xml
*SQL related settings
{| class="wikitable"
|-
! Element !! Attribute !! Description
|-
|  SQLServer || Address || SQL Server address
|-
|  SQLServer || Database || Database name
|-
|  SQLServer || User || Username
|-
|  SQLServer || Password || Plain password
|-
 
 
|  SQLServerBackup || Address || '''SQL Backup''' Server address,<br>only used within an HA environment.
|-
|  SQLServerBackup || Database || '''(HA) Backup''' Database name
|-
|  SQLServerBackup || User || '''(HA) Backup''' Username
|-
|  SQLServerBackup || Password || '''(HA) Backup''' Plain password
|-
|  SQLServerBackup || ReplCommand || Command to be used when changes occur
|-
 
 
|  SQLConfigBackup || Path|| Path to the helper scripts
|-
|  SQLConfigBackup || ResoreApp || Name of the script to restore the sql data
|-
|  SQLConfigBackup || BackupApp || Name of the script to backup the sql data
|-
 
|}
 
*LVS
{| class="wikitable"
|-
! Element !! Attribute !! Description
|-
| LVS || Command || Command path and name of ipvsadm
|-
| Operator || Mailserver || Mailsever name or IP address
|-
| Operator || Mailfrom || Mailfrom name
|-
| Operator || MailTo || Mailto name
|-
| Operator || MailCC || MailCC
|-
| Operator || MailBCC || MailBCC
|-
| Maintenance || FileAge || Amount of days for log data retention
|-
| Maintenance || SQLAge || Amount of days for sql log data retention
|-
|}
 
 
 
 
*HTTP Related Settings
{| class="wikitable"
|-
! Element !! Attribute !! Description
|-
| ShowAmount || ActiveWarning || Amount of connections before a warning will be displayed
|-
| ShowAmount || InActiveWarning || Amount of connections before a warning will be displayed
|-
| ShowAmount || HTTP_ERR || N.A.
|-
| ShowAmount || HTTP_WARN || N.A.
|-
| ShowAmount || MaxConCount || N.A.
|-
| Operation || WebSimulate || Set 1 to simulate myLVS actions
|-
| Operation || MonSimulate || Set 1 to simulate myLVS Monitor actions
|-
 
| Information || host || path and name to the host command
|-
| Information || nmap || path and name to the nmap command
|-
| Modules || Path || Path to the shared modules
|-
| StatusView || SupressedAddress || List of IP addresses which will not be shown within the myLVS connection display
|-
| View || HTMLLVSOutput || N.A.
|-
| Log || Name || Name of the myLVS logfile
|-
| Log || Path || Path to the myLVS log
|-
| Log || gzip || Path and name for the gzip command
|-
| Log || Days || N.A.
|-
| Logo || Path || Path and name for the log for myLVS
|-
|}
 
 
 
'''Sample configuration'''
root@mylvs01:/# '''cat /etc/mylvs/mylvs.conf.xml'''
<?xml version="1.0"?>
<CONFIG>
  <!-- LVS1 SQL Config!-->
  <SQLServer Address="127.0.0.1" Database="mylvs" User="mylvsuser" Password="demo" />
  <!-- LVS2 SQL Config!-->
  <SQLServerBackup Enabled="0" Address="" Database="" User="" Password="" ReplCommand="no-sample-available-yet" />
  <!-- SQL Configuration Backup !-->
  <SQLConfigBackup Path="/var/www/mylvs/backup/" RestoreApp="/var/www/mylvs/scripts/mkrestore.sh" BackupApp="/var/www/mylvs/scripts/mkbackup.sh"/>
  <!-- LVS General command string - add sudo to support appache!-->
  <LVS Command="/usr/bin/sudo /sbin/ipvsadm"  />
  <!-- General mailing information if not given somewhere else used by the lvs monitor!-->
  <Operator Mailserver="mail.mylvs.com" Mailfrom="lvsmon@mylvs.com" MailTo="postmaster@mylvs.com" MailCC="anybody@domain.com" MailBCC=""/>
  <!-- Daily operations!-->
  <Maintenance FileAge="5" SQLAge="5"/>
  <!-- Color set which is used within the webinterface!-->
  <ShowAmount ActiveWarning="200" InActiveWarning="2000" HTTP_ERR="120" HTTP_WARN="80" MaxConCount="1000"/>
  <!-- Operation mode for testing!-->
  <Operation WebSimulate="0" MonSimulate="0"/>
  <!-- Used within the connection view, support whois and nmap which is needed to be installed!-->
  <Information host="/usr/bin/sudo /usr/bin/host" nmap="/usr/bin/sudo /usr/bin/nmap -sS -O -v" />
  <!-- Web styles/moudules!-->
  <Modules Path="/usr/local/lvs/wwwroot/modules/"/>
  <!-- Exlude addresses from the connection view!-->
  <StatusView SupressedAddress=""/>
    <!-- View Options!-->
  <View HTMLLVSOutput="0"/>
  <!-- Log Options!-->
  <Log Name="mylvslog.log" Path="/var/log/mylvs/" gzip="/bin/gzip" Days="24"/>
  <!-- Customize Logo!-->
  <Logo Path="/images/Linux_Logo.gif" />
</CONFIG>
 
=Login to myLVS=
Depending on your client OS you may add a hostheader to your host file, to do this type
*Linux
# vi /etc/hosts
*Windows (Administrator command shell)
notepad c:\Windows\System32\drivers\etc\hosts
Add:
192.168.x.y mylvs.foo
 
*Note: The Windows DNS Cache requires a reload:
ipconfig/flushdns
 
Navigate your prefered browser to '''mylvs.foo''', login using demo, demo.<br>
You should see a screen similar the this:<br>
'''MK DEBUG IMAGE CHANGE NEEDED'''<br>
[[File:myLVS-View01.png|740px]]
<br>Note: To setup a fresh configuration you could easily setup the node and servers through the setup and begin then from scratch.<br>
<br>
 
=Automatic load of myLVS setting=
To automatic load the myLVS Web configuration it is requires to setup '''sysmctl''' which comes new with Debian 8.<br>
This configuration will start on boot only using the type '''oneshot'''
 
*Enable the service (etc/systemd/system/mylvs-init.service):
 
root@mylvs01:/# '''systemctl enable mylvs-init.service'''
 
*Enable the myLVS Monitor (etc/systemd/system/mylvsmon.service):
root@mylvs01:/# '''systemctl enable mylvsmon.service'''
 
 
*'''IMPORTANT''' Enable the interface startup script, this one has the virtual interface configured (192.168.2.200)
** etc/systemd/system/mylvs-init-if.service
root@mylvs01:/# '''systemctl enable mylvs-init-if.service'''
 
*Reload, this is needed wen changes are done
root@mylvs01:/'''systemctl daemon-reload'''
 
*'''Reboot to test if all service are starting as expected'''
<br><br>


==Create Database and Users==
=Where to go next=
Create the database, login into myslq:
<br>
# mysql -u root -p
*Go here: [[Setup windows test client]]
On the SQL prompt type:
mysql> create database mylvs;
Create the default mylvs user:
GRANT ALL PRIVILEGES ON mylvs.* TO mylvsuser@localhost IDENTIFIED BY 'demo';
Then exit mysql on run:
mysql -u root -p < lvs.sql

Latest revision as of 18:03, 3 August 2017

Get and install myLVS

  • Download myLVS
wget http://mylvs.com/download/mylvs-2.0.5.tar.gz

Note that the target paths are used with Debian, there might be different targets for other Linux distribution

  • Unextract myLVS
tar -C / -xvf mylvs2.2.tar.gz
  • This will create files in:
    • /etc/apache2/sites-enabled/
    • /etc/apache2/mylvs/
    • /etc/systemd/system
    • /var/www/mylvs


Permissions

Please set www-data as owner with execute permissions:

root@mylvs01:# chown www-data /var/www/mylvs -R

List root of www:

root@mylvs01:/var/www/mylvs# ls -all
total 124
drwxr-xr-x 6 www-data root  4096 Aug 22 14:14 .
drwxr-xr-x 4 root     root  4096 Jun 12 14:48 ..
drwxr-xr-x 2 www-data root  4096 Aug 22 15:27 backup
-rw-r--r-- 1 www-data root   229 Feb  9  2015 LEGAL
-rwxr-xr-x 1 www-data root  3828 Aug 18 13:25 mylvsinit.pl
-rwxr-xr-x 1 www-data root 92370 Aug 18 13:30 mylvsmon.pl
drwxr-xr-x 2 www-data root  4096 Aug 22 14:59 scripts
drwxr-xr-x 4 www-data root  4096 Feb  9  2015 ws
drwxr-xr-x 4 www-data root  4096 Aug 22 14:10 wwwroot

Setup mySQL

At the very step is to setup the database with all the required tables, please use the following import script mylvs.sql to do so.
You will find the script within the archive or on your disk in: /var/www/mylvs/templates/mysql_data/mylvs.sql
Note: The mysql pwd is demo

mysql -u root -p < /var/www/mylvs/templates/mysql_data/mylvs.sql


You may also see: Create the Database and the Users

Setup Apache

Copy the configuration to your Apache Webserver if not already done:

cp /var/www/mylvs/templates/etc/apache2/sites-available/mylvs.conf /etc/apache2/sites-available/

Optional copy the Webservice configuration to your Apache Webserver:

cp /var/www/mylvs/templates/etc/apache2/sites-available/ws.mylvs.foo.conf /etc/apache2/sites-available/

Verify the myLVS Web configuration and enable it with a2ensite:

a2ensite mylvs.conf

Optional verify the myLVS Monitor configuration and enable it with a2ensite:

a2ensite ws.mylvs01.foo.conf

Restart Apache

service apache2 restart

myLVS configuration

myLVS is using a XML configuration in /etc/myslvs/mylvs.conf.xml

  • SQL related settings
Element Attribute Description
SQLServer Address SQL Server address
SQLServer Database Database name
SQLServer User Username
SQLServer Password Plain password
SQLServerBackup Address SQL Backup Server address,
only used within an HA environment.
SQLServerBackup Database (HA) Backup Database name
SQLServerBackup User (HA) Backup Username
SQLServerBackup Password (HA) Backup Plain password
SQLServerBackup ReplCommand Command to be used when changes occur
SQLConfigBackup Path Path to the helper scripts
SQLConfigBackup ResoreApp Name of the script to restore the sql data
SQLConfigBackup BackupApp Name of the script to backup the sql data
  • LVS
Element Attribute Description
LVS Command Command path and name of ipvsadm
Operator Mailserver Mailsever name or IP address
Operator Mailfrom Mailfrom name
Operator MailTo Mailto name
Operator MailCC MailCC
Operator MailBCC MailBCC
Maintenance FileAge Amount of days for log data retention
Maintenance SQLAge Amount of days for sql log data retention



  • HTTP Related Settings
Element Attribute Description
ShowAmount ActiveWarning Amount of connections before a warning will be displayed
ShowAmount InActiveWarning Amount of connections before a warning will be displayed
ShowAmount HTTP_ERR N.A.
ShowAmount HTTP_WARN N.A.
ShowAmount MaxConCount N.A.
Operation WebSimulate Set 1 to simulate myLVS actions
Operation MonSimulate Set 1 to simulate myLVS Monitor actions
Information host path and name to the host command
Information nmap path and name to the nmap command
Modules Path Path to the shared modules
StatusView SupressedAddress List of IP addresses which will not be shown within the myLVS connection display
View HTMLLVSOutput N.A.
Log Name Name of the myLVS logfile
Log Path Path to the myLVS log
Log gzip Path and name for the gzip command
Log Days N.A.
Logo Path Path and name for the log for myLVS


Sample configuration

root@mylvs01:/# cat /etc/mylvs/mylvs.conf.xml
<?xml version="1.0"?>
<CONFIG>
  <SQLServer Address="127.0.0.1" Database="mylvs" User="mylvsuser" Password="demo" />
  <SQLServerBackup Enabled="0" Address="" Database="" User="" Password="" ReplCommand="no-sample-available-yet" />
  <SQLConfigBackup Path="/var/www/mylvs/backup/" RestoreApp="/var/www/mylvs/scripts/mkrestore.sh" BackupApp="/var/www/mylvs/scripts/mkbackup.sh"/>
  <LVS Command="/usr/bin/sudo /sbin/ipvsadm"  />
  <Operator Mailserver="mail.mylvs.com" Mailfrom="lvsmon@mylvs.com" MailTo="postmaster@mylvs.com" MailCC="anybody@domain.com" MailBCC=""/>
  <Maintenance FileAge="5" SQLAge="5"/>
  <ShowAmount ActiveWarning="200" InActiveWarning="2000" HTTP_ERR="120" HTTP_WARN="80" MaxConCount="1000"/>
  <Operation WebSimulate="0" MonSimulate="0"/>
  <Information host="/usr/bin/sudo /usr/bin/host" nmap="/usr/bin/sudo /usr/bin/nmap -sS -O -v" />
  <Modules Path="/usr/local/lvs/wwwroot/modules/"/>
  <StatusView SupressedAddress=""/>
  <View HTMLLVSOutput="0"/>
  <Log Name="mylvslog.log" Path="/var/log/mylvs/" gzip="/bin/gzip" Days="24"/>
  <Logo Path="/images/Linux_Logo.gif" />
</CONFIG>

Login to myLVS

Depending on your client OS you may add a hostheader to your host file, to do this type

  • Linux
# vi /etc/hosts
  • Windows (Administrator command shell)
notepad c:\Windows\System32\drivers\etc\hosts

Add:

192.168.x.y	mylvs.foo
  • Note: The Windows DNS Cache requires a reload:
ipconfig/flushdns

Navigate your prefered browser to mylvs.foo, login using demo, demo.
You should see a screen similar the this:
MK DEBUG IMAGE CHANGE NEEDED

Note: To setup a fresh configuration you could easily setup the node and servers through the setup and begin then from scratch.

Automatic load of myLVS setting

To automatic load the myLVS Web configuration it is requires to setup sysmctl which comes new with Debian 8.
This configuration will start on boot only using the type oneshot

  • Enable the service (etc/systemd/system/mylvs-init.service):
root@mylvs01:/# systemctl enable mylvs-init.service
  • Enable the myLVS Monitor (etc/systemd/system/mylvsmon.service):
root@mylvs01:/# systemctl enable mylvsmon.service


  • IMPORTANT Enable the interface startup script, this one has the virtual interface configured (192.168.2.200)
    • etc/systemd/system/mylvs-init-if.service
root@mylvs01:/# systemctl enable mylvs-init-if.service
  • Reload, this is needed wen changes are done
root@mylvs01:/systemctl daemon-reload
  • Reboot to test if all service are starting as expected



Where to go next