Setup MyLVS: Difference between revisions

From MyLVS
Jump to navigation Jump to search
No edit summary
 
(47 intermediate revisions by the same user 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. <br>
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 will find the script within the archive or on your disk in: '''/var/www/mylvs/templates/mysql_data/mylvs.sql'''<br>
You will find the script within the archive or on your disk in: '''/var/www/mylvs/templates/mysql_data/mylvs.sql'''<br>
 
Note: The mysql pwd is '''demo'''
  mysql -u root -p < /var/www/mylvs/templates/mysql_data/mylvs.sql
  mysql -u root -p < /var/www/mylvs/templates/mysql_data/mylvs.sql


Line 8: Line 42:


=Setup Apache=
=Setup Apache=
Copy the configuration to your Apache Webserver:
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-enabled/
  cp /var/www/mylvs/templates/etc/apache2/sites-available/mylvs.conf /etc/apache2/sites-available/


Optional copy the Webservice configuration to your Apache Webserver:
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-enabled/
  cp /var/www/mylvs/templates/etc/apache2/sites-available/ws.mylvs.foo.conf /etc/apache2/sites-available/


Verify the configuration and enable it with a2ensite:
Verify the myLVS Web configuration and enable it with a2ensite:
  a2ensite ws.mylvs.foo.conf
  a2ensite mylvs.conf


Optional verify the configuration and enable it with a2ensite:
Optional verify the myLVS Monitor configuration and enable it with a2ensite:
  a2ensite mylvs.conf
  a2ensite ws.mylvs01.foo.conf


Restart Apache
Restart Apache
  service apache2 restart
  service apache2 restart


Add a demo account to apache, this will be the login through the browser, note that this step is required:
=myLVS configuration=
  root@mylvs01:/# htpasswd -c /var/www/mylvs/wwwroot/.htpasswd.users demo
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=
=Login to myLVS=
Line 40: Line 213:
Navigate your prefered browser to '''mylvs.foo''', login using demo, demo.<br>
Navigate your prefered browser to '''mylvs.foo''', login using demo, demo.<br>
You should see a screen similar the this:<br>
You should see a screen similar the this:<br>
'''MK DEBUG IMAGE CHANGE NEEDED'''<br>
[[File:myLVS-View01.png|740px]]
[[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>Note: To setup a fresh configuration you could easily setup the node and servers through the setup and begin then from scratch.<br>
Line 46: Line 220:
=Automatic load of myLVS setting=
=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>
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''', it is very important to load this after mysql.service startup command<br>
This configuration will start on boot only using the type '''oneshot'''
Get the configuration from the templates and copy it to the systemd user directory
'''cp /var/www/mylvs/templates/etc/systemd/system/mylvs-init.service /etc/systemd/system/'''


Alternative get the myLVS Monitor startup configuration from the templates and copy it to the systemd user directory
*Enable the service (etc/systemd/system/mylvs-init.service):
'''cp /var/www/mylvs/templates/etc/systemd/system/ mylvsmon.service /etc/systemd/system/'''


root@mylvs01:/# '''systemctl enable mylvs-init.service'''


*Enable the myLVS Monitor (etc/systemd/system/mylvsmon.service):
root@mylvs01:/# '''systemctl enable mylvsmon.service'''


*First status
root@mylvs01:/systemctl status mylvs-init.service
mylvs-init.service - myLVS Startup Script
  Loaded: loaded (/etc/systemd/system/mylvs-init.service; disabled)
  Active: inactive (dead)


*Enable: systemctl enable mylvs-init.service
*'''IMPORTANT''' Enable the interface startup script, this one has the virtual interface configured (192.168.2.200)
Output:
** etc/systemd/system/mylvs-init-if.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mylvs-init.service to /etc/systemd/system/mylvs-init.service.
root@mylvs01:/# '''systemctl enable mylvs-init-if.service'''


*Reload (optional): systemctl daemon-reload
*Reload, this is needed wen changes are done
root@mylvs01:/'''systemctl daemon-reload'''


*'''Reboot to test'''
*'''Reboot to test if all service are starting as expected'''
<br><br>


*Live Status
=Where to go next=
root@mylvs01:/home/demo# systemctl status mylvs-init.service
<br>
mylvs-init.service - myLVS Startup Script
*Go here: [[Setup windows test client]]
  Loaded: loaded (/etc/systemd/system/mylvs-init.service; enabled)
  Active: inactive (dead) since Mon 2015-08-17 14:53:48 EDT; 1min 38s ago
  Process: 933 ExecStart=/usr/bin/perl /var/www/mylvs/mylvsinit.pl -a (code=exited, status=0/SUCCESS)
Main PID: 933 (code=exited, status=0/SUCCESS)
 
=Automatic load of myLVS Monitor setting=
 
Create File: '''/etc/systemd/system/mylvsmon.service'''
 
Add:
 
[Unit]
Description=myLVS Monitor
After=network.target auditd.service mysql.service
[Service]
ExecStart=/var/www/mylvs/mylvsmon.pl
ExecStop=/usr//bin/killall -9 mylvsmon.pl
KillMode=process
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
 
Note: The above has been tested on Debian 8/9<br>
 
To manage use:<br>
*Enable: systemctl enable mylvs-init.service
*Reload (optional): systemctl daemon-reload

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