Setup MyLVS

From MyLVS
Revision as of 16:19, 1 September 2015 by Admin (talk | contribs)
Jump to navigation Jump to search

Get and install myLVS

tar -C / -xvf mylvs2.1.tar.gz
  • This will create:
    • /etc/apache2/sites-enabled/
    • /etc/apache2/mylvs/

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 will find the script within the archive or on your disk in: /var/www/mylvs/templates/mysql_data/mylvs.sql

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:

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.mylvs.foo.conf

Restart Apache

service apache2 restart

Add a demo account to apache, this will be the login through the browser, note that this step is required:

root@mylvs01:/# htpasswd -c /var/www/mylvs/wwwroot/.htpasswd.users demo

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 Command path and name of ipvsadm
Operator Mailfrom Command path and name of ipvsadm
Operator MailTo Command path and name of ipvsadm
Operator MailCC Command path and name of ipvsadm
Operator MailBCC Command path and name of ipvsadm
Maintenance FileAge Command path and name of ipvsadm
Maintenance SQLAge Command path and name of ipvsadm



  • HTTP Related Settings
Element Attribute Description
ShowAmount ActiveWarning Command path and name of ipvsadm
ShowAmount InActiveWarning Command path and name of ipvsadm
ShowAmount HTTP_ERR Command path and name of ipvsadm
ShowAmount HTTP_WARN Command path and name of ipvsadm
ShowAmount MaxConCount Command path and name of ipvsadm
Operation WebSimulate Command path and name of ipvsadm
Operation MonSimulate Command path and name of ipvsadm
Information host Command path and name of ipvsadm
Information nmap Command path and name of ipvsadm
Modules Path Command path and name of ipvsadm
StatusView SupressedAddress Command path and name of ipvsadm
View HTMLLVSOutput Command path and name of ipvsadm
Log Name Command path and name of ipvsadm
Log Path Command path and name of ipvsadm
Log gzip Command path and name of ipvsadm
Log Days Command path and name of ipvsadm
Logo Path Command path and name of ipvsadm



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:

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, it is very important to load this after mysql.service startup command
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

cp /var/www/mylvs/templates/etc/systemd/system/ mylvsmon.service /etc/systemd/system/


  • 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
root@mylvs01:/systemctl enable mylvs-init.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mylvs-init.service to /etc/systemd/system/mylvs-init.service.
  • Reload (optional)
root@mylvs01:/systemctl daemon-reload
  • Reboot to test
  • 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)