HA Cluster: Configuring Software

Hosting-related system services

Since the software responsible for HA cluster will manage system services like Plesk, nginx, etc, we should disable all these services as they should not be started automatically with system. With the next command, we disable auto-starting for these services, which should be executed on the both nodes.

ha-node1 and ha-node2# for i in \

plesk-ip-remapping \
plesk-php74-fpm.service \
plesk-php82-fpm.service \
plesk-web-socket.service \
plesk-task-manager.service \
plesk-ssh-terminal.service \
plesk-repaird.socket \
sw-engine.service \
sw-cp-server.service \
psa.service \
cron.service \
xinetd.service \
nginx.service \
apache2.service httpd.service \
mariadb.service mysql.service postgresql.service \
named.service bind9.service named-chroot.service \
postfix.service; \
do systemctl disable $i && systemctl stop $i; \

done

As an output, you may see lines like “Failed to disable unit: Unit file bind9.service does not exist”. This is not a critical error because the command contains different name of the same services for different OSes like CentOS and Ubuntu or name of different services that provides similar functionality (like MySQL and MariaDB). If you have installed any additional component with Plesk like “php80”, you also need to disable a service for that component if a service was added to the server by the Plesk component.

You may run `ps ax` to double check that there are no more running services related to Plesk or any of its component.

Plesk Files

In the previous blog post, you can see how it is possible to copy the Plesk “vhosts” directory to the NFS storage. For HA cluster, we need to do the same and a few additional steps for the rest of the Plesk directories to make them available for nodes of the HA cluster.

On the NFS server, configure exporting of “/var/nfs/plesk-ha/plesk_files” the same way as “/var/nfs/plesk-ha/vhosts”. After configuring, you should see the directories are available for remote mounting from the internal network.

ha-nfs# exportfs -v
/var/nfs/plesk-ha/vhosts

10.0.0.0/24(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash)

/var/nfs/plesk-ha/plesk_files

10.0.0.0/24(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash)

When exporting is configured, we will need to copy Plesk to the NFS. For that, we have to pre-create a directory on each node for mounting NFS storage:

ha-node1 and ha-node2# mkdir -p /nfs/plesk_files

Files: vhosts

 


  • Top 18 Best Web Hosting Services In 2024: Despite there are multiple web hosting providers available in the market, choosing the best one is really a hard nut to crack!! Because almost all service providers are offering their services with the same features and quality.
  • How to start your own Crypto currency website: For a cryptocurrency news website, choosing the right Content Management System (CMS) is crucial for managing content effectively, ensuring security, and providing a great user experience. Here are some of the best CMS options tailored for such a site, each with its unique strengths:
  • The Evolution of Coffee Brewing Methods: A Historical Perspective: Coffee has been brewed and enjoyed for centuries, with various methods evolving over time to create the perfect cup of joe. From early methods like the Ibrik method and coffee pots for coffee houses to modern technologies like the AeroPress and Hario V60, the world of coffee brewing has come a long way.
  • Stop WordPress from Creating Extra Cropped Image Sizes: Whenever you upload an image to your WordPress site through the media library, it automatically creates and stores multiple additional versions of that image. If your site doesn’t utilize these extra image sizes, they will consume valuable storage space and increase the size of your server backups.
  • Explain WordPress Portfolio and how to created them: WordPress portfolios are digital showcases for individuals or businesses to display their work, projects, or professional accomplishments. This feature is particularly useful for creatives, freelancers, and agencies looking to exhibit their skills or services in a visually appealing and organized manner. Portfolios in WordPress can be created using various methods, including themes that come with built-in portfolio functionalities, plugins that add portfolio features, or custom coding for a more personalized approach.
  • 15 Essential WordPress Plugins For Every Site: Plugins are essential for every type of website, as they provide additional features and customization options that are not available in the core WordPress platform. A study by CodeinWP found that the average WordPress site has 20 active plugins, indicating the importance of plugins in website development.
  • SAILING and YACHTING: Awesome Sailing Vlogs for the Enthusiast
  • Comparing Google and Microsoft’s Success in Capitalizing on Generative AI: The buzz of interest in AI services helped drive revenue for Microsoft’s biggest unit, cloud services—up by 7 percentage points compared to a year ago—and Microsoft’s overall sales rose 17 percent to nearly $62 billion. It also gained cloud market share, Nadella added. The number of $100 million cloud deals that Microsoft landed increased 80 percent during the quarter compared to the same period a year ago, and $10 million deals doubled.
  • The Best WordPress Hosting Solution in Australia: Each of our WordPress hosting solutions are fine-tuned, blazing fast and are ready for you! Starting a WordPress website has never been easier with our free 1-click WordPress installation, enterprise-grade security and an assortment of tutorials and helpful guides to get you started, all backed by our 99.9% uptime guarantee.
  • Elementor vs Beaver Builder: A Comparison of Design Flexibility and Performance in WordPress: Elementor and Beaver Builder are two of the most widely recognized options, each providing distinct features that cater to varying user requirements. This article conducts a comprehensive comparison of these tools, examining their design flexibility, performance metrics, and overall user experience.
  • The Best Contact Form Plugins for WordPress to Easily Manage User Inquiries: In an effort to improve user interactions on WordPress websites hosting, the examination of contact form plugins becomes essential. This article aims to present an overview of the top 5 contact form plugins available for WordPress, highlighting their features and pricing structures to facilitate an well-considered choices process.
  • What are the 20 best Joomla plugins: Joomla plugins are small, task-specific extensions that enhance or modify the core functionality of a Joomla website. They operate as event-driven scripts, listening for specific “events” triggered by Joomla or its components and executing corresponding actions. Plugins are a crucial part of Joomla’s extensibility, allowing developers to add features or customise behaviour without altering the core Joomla code.
  • How to design a strong off-page SEO strategy: Lessons learnt from earning over 50,000 contextual links for thousands of websites in the toughest niches. In 2023, virtually every business that has a website is prioritizing their investment in SEO. The reason being, amidst the chaos of the current year, customers are resorting to online channels for safe purchasing, and optimizing their online presence is a surefire way to gain an edge over rivals. While some firms have set up internal teams, and others have hired external agencies to boost their search engine rankings, a documented off-page SEO strategy is still a rarity among most businesses.
  • What are WordPress Plugins? WordPress plugins are modular pieces of software that can be added to a WordPress site to extend or enhance its functionality without modifying the core WordPress code. They allow website owners to add features, improve performance, and customise the behaviour of their websites easily, catering to a wide range of needs, from SEO and security to e-commerce and design enhancements.

 

As we previously have decided to imagine the ha-node1 as an active node, the next commands should be executed on the ha-node1. To copy existing vhosts directory, run the next commands:

ha-node1# mount -t nfs -o "hard,timeo=600,retrans=2,_netdev" 10.0.0.12:/var/nfs/plesk-ha/vhosts /mnt
ha-node1# cp -aRv /var/www/vhosts/* /mnt
ha-node1# umount /mnt

Files: Plesk-related

Also, as we previously have decided to imagine the ha-node1 as an active node, the next commands should be executed on the ha-node1.

ha-node1# mount -t nfs -o "hard,timeo=600,retrans=2,_netdev" 10.0.0.12:/var/nfs/plesk-ha/plesk_files /nfs/plesk_files

ha-node1# mkdir -p /nfs/plesk_files/etc/{apache2,nginx,psa,sw,sw-cp-server,domainkeys,psa-webmail}
ha-node1# cp -a /etc/passwd /nfs/plesk_files/etc/
ha-node1# cp -aR /etc/apache2/. /nfs/plesk_files/etc/apache2
ha-node1# cp -aR /etc/nginx/. /nfs/plesk_files/etc/nginx
ha-node1# cp -aR /etc/psa/. /nfs/plesk_files/etc/psa
ha-node1# cp -aR /etc/sw/. /nfs/plesk_files/etc/sw
ha-node1# cp -aR /etc/sw-cp-server/. /nfs/plesk_files/etc/sw-cp-server
ha-node1# cp -aR /etc/sw-engine/. /nfs/plesk_files/etc/sw-engine
ha-node1# cp -aR /etc/domainkeys/. /nfs/plesk_files/etc/domainkeys
ha-node1# cp -aR /etc/psa-webmail/. /nfs/plesk_files/etc/psa-webmail

ha-node1# mkdir -p /nfs/plesk_files/var/{spool,named}
ha-node1# cp -aR /var/named/. /nfs/plesk_files/var/named
ha-node1# cp -aR /var/spool/. /nfs/plesk_files/var/spool

ha-node1# mkdir -p /nfs/plesk_files/opt/plesk/php/{7.4,8.2}/etc
ha-node1# cp -aR /opt/plesk/php/7.4/etc/. /nfs/plesk_files/opt/plesk/php/7.4/etc
ha-node1# cp -aR /opt/plesk/php/8.2/etc/. /nfs/plesk_files/opt/plesk/php/8.2/etc

ha-node1# mkdir -p /nfs/plesk_files/usr/local/psa/{admin/conf,admin/plib/modules,etc/modules,var/modules,var/certificates}
ha-node1# cp -aR /usr/local/psa/admin/conf/. /nfs/plesk_files/usr/local/psa/admin/conf
ha-node1# cp -aR /usr/local/psa/admin/plib/modules/. /nfs/plesk_files/usr/local/psa/admin/plib/modules
ha-node1# cp -aR /usr/local/psa/etc/modules/. /nfs/plesk_files/usr/local/psa/etc/modules
ha-node1# cp -aR /usr/local/psa/var/modules/. /nfs/plesk_files/usr/local/psa/var/modules
ha-node1# cp -aR /usr/local/psa/var/certificates/. /nfs/plesk_files/usr/local/psa/var/certificates

ha-node1# umount /nfs/plesk_files

Event Handler to keep /etc/passwd up2date

We need to update the passwd and group file on the NFS storage every time when Plesk updates the system users. For that, we will create a few event handlers for scenarios like domain creating, subscription updating, etc. Event handlers are saved in a Plesk database, which means we need to run the next command only on active node.

As we previously have decided to imagine the ha-node1 as an active node, the next commands should be executed on the ha-node1.

ha-node1# plesk bin event_handler --create -command "/bin/cp /etc/passwd /nfs/plesk_files/etc/passwd" -priority 50 -user root -event phys_hosting_create
ha-node1# plesk bin event_handler --create -command "/bin/cp /etc/passwd /nfs/plesk_files/etc/passwd" -priority 50 -user root -event phys_hosting_update
ha-node1# plesk bin event_handler --create -command "/bin/cp /etc/passwd /nfs/plesk_files/etc/passwd" -priority 50 -user root -event phys_hosting_delete

ha-node1# plesk bin event_handler --create -command "/bin/cp /etc/passwd /nfs/plesk_files/etc/passwd" -priority 50 -user root -event ftpuser_create
ha-node1# plesk bin event_handler --create -command "/bin/cp /etc/passwd /nfs/plesk_files/etc/passwd" -priority 50 -user root -event ftpuser_update
ha-node1# plesk bin event_handler --create -command "/bin/cp /etc/passwd /nfs/plesk_files/etc/passwd" -priority 50 -user root -event ftpuser_delete

ha-node1# plesk bin event_handler --create -command "/bin/cp /etc/passwd /nfs/plesk_files/etc/passwd" -priority 50 -user root -event site_subdomain_create
ha-node1# plesk bin event_handler --create -command "/bin/cp /etc/passwd /nfs/plesk_files/etc/passwd" -priority 50 -user root -event site_subdomain_update
ha-node1# plesk bin event_handler --create -command "/bin/cp /etc/passwd /nfs/plesk_files/etc/passwd" -priority 50 -user root -event site_subdomain_delete
ha-node1# plesk bin event_handler --create -command "/bin/cp /etc/passwd /nfs/plesk_files/etc/passwd" -priority 50 -user root -event site_subdomain_move

Similar Posts