Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
cloudappliance/highavailabilitysetup [2018_06_11 11:33] dancloudappliance:highavailabilitysetup [2023_06_22 05:41] – external edit 127.0.0.1
Line 1: Line 1:
-===== SME HA Setup "2 x 2" =====+===== SME File Fabric HA Setup "2 x 2" With Manual Failover ===== 
 + 
 +== last edited on October 17, 2022 ==
 ==== Disclaimer ==== ==== Disclaimer ====
  
 The information in this document is provided on an as-is basis. You use it at your own risk.  We accept no responsibility for errors or omissions, nor do we have any obligation to provide support for implementing or maintaining the configuration described here.  Furthermore, we do not warrant that the design presented here is appropriate for your requirements.  The information in this document is provided on an as-is basis. You use it at your own risk.  We accept no responsibility for errors or omissions, nor do we have any obligation to provide support for implementing or maintaining the configuration described here.  Furthermore, we do not warrant that the design presented here is appropriate for your requirements. 
  
-SME designs, implements and supports HA File Fabric solutions for customers on a paid professional services basis.  For more information please contact sales@storagemadeeasy.com+SME designs, implements and supports HA (High Availability) File Fabric solutions for customers on a paid professional services basis.  For more information please contact sales@storagemadeeasy.com
  
 ==== Introduction ==== ==== Introduction ====
Line 29: Line 31:
  
 == Initial State == == Initial State ==
-This guide assumes you set up the four appliance following the instructions in the Appliance Installation guide [[cloudappliance/applinstallv1705|here]]   +This guide assumes you set up the four appliances following the instructions in the Appliance Installation guideFor easy failover of the application in case of a database failover, you must assign a virtual IP address for the database servers. This will mean that you can change the primary DB server without changing the configuration on the application servers. There are many ways in Linux to configure automatic failover of the VIP, but this guide will configure the DB servers requiring manual failover. This is often preferred in our scenario of master - slave replication.
-For easy failover of the application in case of DB failover, you must assign a virtual IP address for the database servers. This will mean that you can change the primary DB server without changing the configuration on the application servers. There are countless ways in linux to configure automatic failover of the VIP, but this guide will configure the DB servers requiring manual failover. This is often preferred in our scenario of master - slave replication.+
  
 === Preparation === === Preparation ===
Line 44: Line 45:
  
 == Linux Login == == Linux Login ==
 +
 For Linux command line operations, you must run the commands shown in this document as the root user unless otherwise specified. However, for security reasons you cannot connect with ssh to the machine directly. Instead, you should ssh to the box using smeconfiguser and then su to root:  For Linux command line operations, you must run the commands shown in this document as the root user unless otherwise specified. However, for security reasons you cannot connect with ssh to the machine directly. Instead, you should ssh to the box using smeconfiguser and then su to root: 
-<code> + 
-# ssh smeconfiguser@smeweb01 +    # ssh smeconfiguser@smeweb01 
-</code>+
  
 Enter the smeconfiguser password at the prompt. Once logged in, elevate your privileges to root. Enter the smeconfiguser password at the prompt. Once logged in, elevate your privileges to root.
Line 76: Line 78:
 </code> </code>
  
 +<WRAP center round info 100%>
 +Please note this information above was updated with the 2106 release of the File Fabric. Please see this [[:cloudappliance/high-availability-cron|guide for further information]].
 +</WRAP>
  
 +==== Part II - Database Servers ====
  
-==== Part II ==== 
 === Configuring the Database Servers === === Configuring the Database Servers ===
 +
 You must perform these steps to create a specialized database server from the standard SME appliance distribution. In this guide we also run memcached as a part of the DB server. You must perform these steps to create a specialized database server from the standard SME appliance distribution. In this guide we also run memcached as a part of the DB server.
  
Line 95: Line 101:
  
 == crontab == == crontab ==
-You must also disable some jobs in crontab, these should only run on one application server. Again, as root on smesql01 and smesql02:+You must also disable some jobs in crontab. Again, as root on smesql01 and smesql02:
 <code> <code>
 # crontab -e -u smestorage # crontab -e -u smestorage
 </code> </code>
  
-Place a "#" infront of the seven jobs listed, when you are done, it should look like this:+Place a "#" in front of the lines to mirror the output below: 
 + 
 +``` 
 +MAILTO='' 
 +#Ansible: 
 +#* * * * * /var/www/smestorage/cron/scheduler_minute.pl 
 +#Ansible: #3 
 +#5 4 * * * /var/www/smestorage/cron/scheduler_daily.pl 
 +#Ansible: #2 
 +#* * * * * /var/www/smestorage/cron/taskmanager.pl 
 +#Ansible: #5 
 +#10 2 1 * * /var/www/smestorage/cron/scheduler_monthly.pl 
 +#Ansible: #4 
 +#5 * * * * /var/www/smestorage/cron/scheduler_hour.pl 
 +#Ansible: #7 
 +30 1 * * * /var/www/smestorage/cron/logroller.pl 
 +#Ansible: #6 
 +#10 * * * * /var/www/smestorage/cron/scheduler.pl 
 +* * * * * /var/www/smestorage/cron/scheduler_syncnodes.pl 
 +``` 
 + 
 +<WRAP center round info 100%> 
 +Please note this information above was updated with the 2106 release of the File Fabric. Please see this [[:cloudappliance/high-availability-cron|guide for further information]]. 
 +</WRAP>
  
-{{::407ae286-9576-4a13-97bb-e2f0489a2a17.png?400|}}+<WRAP center round important 100%> 
 +There must always be exactly one cron node per File Fabric clusterIf the node that was acting as the cron node ceases to be available as part of the cluster, another node must be made the cron node.  
 +</WRAP>
  
 === iptables for dbservers === === iptables for dbservers ===
Line 138: Line 169:
 By default, the appliance memcached service listens only for connections from localhost, in order to share a memcache between the two application servers, we must change that. For redundancy we will do this on both smesql01 and smesql02. By default, the appliance memcached service listens only for connections from localhost, in order to share a memcache between the two application servers, we must change that. For redundancy we will do this on both smesql01 and smesql02.
  
-To allow other machines to connect, edit /etc/sysconfig/memcached. +<code>  
-<code># vi /etc/sysconfig/memcached </code>+cd /var/www/smestorage/containers/memcached/ 
 +sed -i 's/127.0.0.1/0.0.0.0/g' .env 
 +docker-compose down 
 +docker-compose up -d 
 +</code>
  
-Change the line  +=== Redis configuration === 
-OPTIONS="-l 127.0.0.1"+By default, the appliance Redis service listens only for connections from localhost, in order to share a Redis between the two application servers, we must change thatFor redundancy we will do this on both smesql01 and smesql02.
  
-to +<code>  
- +cd /var/www/smestorage/containers/redis/ 
-OPTIONS="-0.0.0.0" +sed -i 's/127.0.0.1/0.0.0.0/g' docker-compose.yml 
- +docker-compose down 
-Making the file look like this +docker-compose up -d 
- +</code>
-{{::8dedb4ec-8388-4166-aaeb-c07007c5e097.png?400|}} +
- +
-then restart the memcached service  +
-<code># systemctl restart memcached </code>+
  
 === MySQL configuration for HA === === MySQL configuration for HA ===
Line 284: Line 315:
 Using database replication allows you to quickly continue service if a database goes down.  Using database replication allows you to quickly continue service if a database goes down. 
  
 +<WRAP center round tip 100%>
 +See [[cloudappliance:https://docs.storagemadeeasy.com/cloudappliance/db_rep_monitoring|this page]] for information about monitoring database replication.
 +</WRAP>
 In MySQL replication, there is one master and one or more slave servers.
This means that all application server calls to the database are directed to the master server. The master server handles all queries and DB changes.
Any changes are then replicated to the slave database server(s).  In MySQL replication, there is one master and one or more slave servers.
This means that all application server calls to the database are directed to the master server. The master server handles all queries and DB changes.
Any changes are then replicated to the slave database server(s). 
  
Line 402: Line 436:
 <code>exit </code> <code>exit </code>
  
-==== Part III ====+==== Part III - Application Servers ==== 
 + 
 +<WRAP center round important 100%> 
 +If you will be using a load balancer to distribute traffic to your web servers, configure the load balancer to provide session stickiness. 
 +</WRAP> 
 === Configure the application servers === === Configure the application servers ===
 +
 In this section, you change the application server's configuration to the database server by editing the PHP configuration directly from command line. By default, the database host is localhost.  In this section, you change the application server's configuration to the database server by editing the PHP configuration directly from command line. By default, the database host is localhost. 
 **These steps are repeated on both smeweb01 and smeweb02.** **These steps are repeated on both smeweb01 and smeweb02.**
Line 425: Line 465:
 In addition add a newline to define a remote memcached instance In addition add a newline to define a remote memcached instance
 <code>var $memcachehost='smesql-vip:11211';</code> <code>var $memcachehost='smesql-vip:11211';</code>
 +
 +In addition ensure the following variable is set for Redis:
 +<code>var $redishost='smesql-vip:6379';</code>
  
 Further we need to update the $dbuser and $password to match the <smestoreremote> user and password used when setting up the database in the previous section. Further we need to update the $dbuser and $password to match the <smestoreremote> user and password used when setting up the database in the previous section.
Line 447: Line 490:
 == memcached == == memcached ==
 <code> <code>
-# systemctl disable memcached +cd /var/www/smestorage/containers/memcached/ 
-# systemctl stop memcached+docker-compose down
 </code> </code>
  
 == crontab == == crontab ==
-You must also disable crontab on the smeweb02 servercrontab should only run from one application server.+The majority of smestorage's cron jobs should run on one of the application servers; only one of smestorage's cron jobs, logroller, should run on the other  application server.
 **As root on smeweb02 only:** **As root on smeweb02 only:**
 <code> <code>
Line 458: Line 501:
 </code> </code>
  
-Place a in front of the seven jobs listed in the crontab scheduleFor a screenshot, refer to the DB section above.+Your crontab should mirror the following: 
 + 
 +``` 
 +MAILTO='' 
 +#Ansible: 
 +#* * * * * /var/www/smestorage/cron/scheduler_minute.pl 
 +#Ansible: #3 
 +#5 4 * * * /var/www/smestorage/cron/scheduler_daily.pl 
 +#Ansible: #2 
 +#* * * * * /var/www/smestorage/cron/taskmanager.pl 
 +#Ansible: #5 
 +#10 2 1 * * /var/www/smestorage/cron/scheduler_monthly.pl 
 +#Ansible: #4 
 +#5 * * * * /var/www/smestorage/cron/scheduler_hour.pl 
 +#Ansible: #7 
 +30 1 * * * /var/www/smestorage/cron/logroller.pl 
 +#Ansible: #6 
 +#10 * * * * /var/www/smestorage/cron/scheduler.pl 
 +* * * * * /var/www/smestorage/cron/scheduler_syncnodes.pl 
 +``` 
 + 
 +<WRAP center round info 100%> 
 +Please note this information above was updated with the 2106 release of the File FabricPlease see this [[cloudappliance/high-availability-cron|guide for further information]]. 
 +</WRAP>
  
 Restart both servers, so on both smeweb01 and smeweb02, execute a reboot. Restart both servers, so on both smeweb01 and smeweb02, execute a reboot.