Setup MyLVS: Difference between revisions

From MyLVS
Jump to navigation Jump to search
Line 220: 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'''


*Enable the service (etc/systemd/system/mylvs-init.service):
*Enable the service (etc/systemd/system/mylvs-init.service):

Revision as of 18:43, 4 September 2015

Get and install myLVS

  • Download myLVS
wget http://mylvs.com/download/mylvs2.2.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 startuo script, this one has the virtual interface configured (192.168.2.200)
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
  • Live Status
root@mylvs01:/home/demo# systemctl status mylvs-init.service
mylvs-init.service - myLVS Startup Script
  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)

Where to go next