How to install and Use File Synchronization Add-on?
File synchronization between application servers in a cluster ensures consistency and coherence in a distributed environment. It maintains identical sets of uploaded files across all nodes, supports horizontal scaling, prevents out-of-sync issues, allows cross-environment synchronization, enhances fault tolerance, and optimizes performance.
As your project attracts more users, ensuring optimal app performance becomes crucial. While the system automatically allocates additional capacity within predefined server scaling limits, the escalating popularity of your service may necessitate horizontal scaling by increasing the number of nodes.
For widely used applications such as WordPress, Drupal, Joomla, Liferay, and similar platforms, the challenge arises when user-provisioned content is stored on a single node that processes the corresponding file upload request. This can lead to synchronization issues when distributing across multiple web server instances.
To address this problem, the AccuWeb.Cloud platform offers a specialized File Synchronization add-on designed to maintain consistency among uploaded files across various web server instances. This synchronization extends beyond a single environment, allowing coordination between horizontally scaled nodes and even across application servers in different environments, irrespective of their running stack or application.
File Synchronization Add-on Implementation
The File Synchronization Add-on Implementation involves the inclusion of a feature that synchronizes files between multiple servers. It is a one-click add-on that uses the lsyncd daemon and cron utility. The lsyncd triggers file synchronization exclusively when actual system changes are identified. This implementation significantly reduces CPU load compared to conventional sync calls, ensuring real-time data updates.
The File Sync add-on is compatible with any platform-managed application server stack, including Docker containers. During the installation process, you’ll be prompted to choose the specific folder for synchronization. This allows you to sync only the necessary part of your app server’s file system. As a result, only modifications within the selected directory on any specified application server instances will trigger synchronization. Let’s see how you can configure, install, and use File Synchronization add-on.
1) Step-by-Step to Installing WordPress on AccuWeb.Cloud:
For this example, we will install WordPress and set up the File Synchronization add-on.
Step 1: Log in to your AccuWeb.Cloud account.
Step 2: On the upper side of the screen, click on the “MarketPlace.”
Step 3: In the Marketplace window, navigate to the “Application” category and select “Content Management. ” Choose the “WordPress Standalone Kit” option.
Step 4: Click on the “Install” button to initiate the installation of WordPress.
Step 5: Customize your WordPress Standalone by accessing advanced features in the opened installation window.
Step 6: In the “Environment” field, enter the desired name for browsing the WordPress site (e. g., accuwebcloudwp). Provide a “Display name” for how you want it to appear in the AccuWeb.Cloud environment.
Step 7: Click on the “Install” button to commence the installation of WordPress Standalone.
Adjusting Environment Topology:
Step 1. After the installation, click on “Change environment topology. ”
Step 2. Â In the “Horizontal Scaling” section, use the “+” button to add an extra app server node, effectively establishing a cluster for the WordPress application.
Step 3. Once the preferred number of app server nodes is added, click on “Apply” to implement the changes.
By following these steps, you have successfully installed the WordPress application and configured it to function within a clustered environment with two NGINX-PHP application servers. This setup paves the way for further exploration of advanced features and functionalities within the clustered solution.
2) Testing File Upload Without Synchronization:
Let’s examine how file/plugin uploads are processed without synchronization.
Step 1. Access the WordPress admin panel by appending “/wp-login. php” to your environment domain name and log in using the credentials received via email.
Step 2. Once logged in, make custom changes, such as uploading images or other files, editing themes, or adding pages or plugin. As an example, we added a plugin, Jetpack.
Step 3. Return to the platform dashboard and click on “Config” next to the app server layer.
Step 4. Navigate to the webroot (click from Favorites) > ROOT > wp-plugin directory and compare its content within both nodes.
Observation: One app server instance (Node ID 3429 in our example) contains the newly added plugin directory, while another one (Node ID 3428) does not have it yet.
3) Applying File Synchronization:
To implement content synchronization within our cluster, let’s apply the File Synchronization add-on.
Step 1. Locate and install the File Synchronization add-on within the platform Marketplace.
Step 2. In the opened dialog box, define additional sync parameters. Specify whether file synchronization should run within one environment or between two different environments. Provide details such as the sync path (relative to the webroot directory), sync delay (in seconds), environment name, and nodes.
Example:
– Sync path: /ROOT/wp-content
– Sync delay (sec): [specified seconds]
– Environment name: [select from available environments]
– Nodes: [automatically fetched app server layer upon selecting an environment]
Also, install File Synchronization on second web servers.
Step 3. Click “Install” when finished.
Step 4. After installation, you’ll receive a confirmation message.
Step 5. Â Check the presence of the uploaded file within both nodes at this point.
File synchronization will now be automatically performed every time you add or change anything in your WordPress (or any other maintained application). This ensures that data on your servers remains identical.
4) Checking Logs for File Synchronization:
You can monitor the synchronization process by examining log files situated in the webroot/lsyncd/var/log web-server directory.
Files to Review:
Lsyncd.log: This file contains crucial information regarding the synchronization process. It provides details on file changes, updates, and any potential issues.
Lsyncd.status: The lsyncd.status file offers valuable insights into the current status of synchronization. It includes information on successful synchronizations, any errors encountered, and overall process status.
Accessing Log Files:
Navigate to the webroot/lsyncd/var/log directory to locate and review these log files.
By checking these log files regularly, you can stay informed about the synchronization status and promptly address any issues that may arise during the process.
Conclusion
In conclusion, incorporate the File Synchronization add-on into your AccuWeb.Cloud environment offers a streamlined and efficient way to manage and synchronize your files seamlessly. By following the step-by-step installation guide provided in this article, users can effortlessly set up and utilize this add-on to ensure consistency and accessibility of their files across various platforms. The benefits of improved collaboration, data integrity, and time-saving make the File Synchronization add-on a valuable tool for optimizing your cloud experience on AccuWeb.Cloud.