Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
blocks:server:mirror [2020-05-20 05:56]
mattias [Cloning the Blocks Server]
blocks:server:mirror [2025-02-13 20:01] (current)
admin Added Sync Errors note
Line 1: Line 1:
 ====== Blocks Mirroring Service ====== ====== Blocks Mirroring Service ======
  
-Our Linux-based Blocks server dated 2020-05-14 and later, running Ubuntu 20.04, supports a new redundancy feature for increased system reliability. While the Blocks server software is very robust, the complete system can never be more reliable than the hardware it runs on.+Our Linux-based server supports a hardware redundancy feature for increased system reliability. While the Blocks server software is very robust, the complete system can never be more reliable than the hardware it runs on.
  
 ===== Introduction ===== ===== Introduction =====
Line 135: Line 135:
 ===== Cloning the Blocks Server ===== ===== Cloning the Blocks Server =====
  
-It'now time to configure the mirror server. Since this will be an exact copy of the main Blocks servercloning process is used to copy the main Blocks server over to the mirror server.+Once you have configured your main Blocks Server as described above and have it all working as desired, it's time to make the Mirror Server by cloning the Blocks server. This is done using program called Clonezilla. Read [[blocks:server:creating_a_server#prepare_clonezilla_usb_stick| this article]] on getting started with Clonezilla.
  
-The tool used is Clonezilla,  the same image tool used to initially setup a Blocks Linux server. Read  [[blocks:server:creating_a_server#prepare_clonezilla_usb_stick| this article]] to find out how to obtain and get started with clonezilla.+You'll also need a second USB storage device. This may be a USB stick with enough room to store the actively used data from your Blocks server's diskOr it may be an external USB disk drive. This storage device must be formatted as FAT32 or NTFS.
  
-Boot the device from bootable Clonezilla memory+Shut down and re-boot your now fully configured Blocks server from the Clonezilla USB stick. Select the USB stick as the boot device in the computer's BIOS, accessed by pressing dedicated key on the keyboard during startup.
  
- +Once Clonezilla has started, Select "English".
-Select English (This guide assumes english)+
  
 {{:blocks:server:mirror:clone:language.png?nolink&500|}} {{:blocks:server:mirror:clone:language.png?nolink&500|}}
  
-Select your keyboard mapping.+Select your keyboard layout, if you have a non-english keyboard, or just select "Keep the default".
  
 {{:blocks:server:mirror:clone:keyboard_settings.png?nolink&500|}} {{:blocks:server:mirror:clone:keyboard_settings.png?nolink&500|}}
  
-Select start Clonezilla.+Select "Start Clonezilla".
  
 {{:blocks:server:mirror:clone:startclonezilla.png?nolink&500|}} {{:blocks:server:mirror:clone:startclonezilla.png?nolink&500|}}
  
-Select the device-image option.+Select the "Device-imageoption.
  
 {{:blocks:server:mirror:clone:deviceimage.png?nolink&1000|}} {{:blocks:server:mirror:clone:deviceimage.png?nolink&1000|}}
  
-Select use local device option.+Select the "Use local deviceoption.
  
 {{:blocks:server:mirror:clone:localdevice.png?nolink&1000|}} {{:blocks:server:mirror:clone:localdevice.png?nolink&1000|}}
  
-Confirm that a usb drive has been attached with enter.+Connect the //second// USB stick or external drive. This drive must have enough free space to hold the used disk space from your Blocks server. Wait a few seconds as instructed, then press Enter.
  
 {{:blocks:server:mirror:clone:insertrepository.png?nolink&600|}} {{:blocks:server:mirror:clone:insertrepository.png?nolink&600|}}
  
-Exit this window with Ctrl-C when you can see that your USB drive has been detected.+Once your newly connccted drive appears, press Ctrl-C to continue.
  
 {{:blocks:server:mirror:clone:confirmstoragedeviceattached.png?nolink&1000|}} {{:blocks:server:mirror:clone:confirmstoragedeviceattached.png?nolink&1000|}}
  
-Select the device to mount as your destination repository+Select the newly connected drive as your destination. 
  
 {{:blocks:server:mirror:clone:mountdeviceimagerepository.png?nolink&1000|}} {{:blocks:server:mirror:clone:mountdeviceimagerepository.png?nolink&1000|}}
  
-Select Done and enter, this will create the image under the root of the drive.+Click Done and press Enter to create the image at the root level of the drive.
  
 {{:blocks:server:mirror:clone:selectdirectory.png?nolink&1000|}} {{:blocks:server:mirror:clone:selectdirectory.png?nolink&1000|}}
  
-Confirm with enter to continue.+Press Enter to continue.
  
 {{:blocks:server:mirror:clone:entertocontinue.png?nolink&600|}} {{:blocks:server:mirror:clone:entertocontinue.png?nolink&600|}}
  
-Select beginners mode.+Select "Beginner mode".
  
 {{:blocks:server:mirror:clone:selectwizard.png?nolink&600|}} {{:blocks:server:mirror:clone:selectwizard.png?nolink&600|}}
 +
 +Select the "savedisk" option to create an image from the server's internal disk.
 +
 +{{:blocks:server:mirror:clone:savelocaldiskasimage.png?nolink&1000|}}
 +
 +Give the image a descriptive name.
 +
 +{{:blocks:server:mirror:clone:nameofimage.png?nolink&600|}}
 +
 +Select your source disk (the internal disk of your Blocks server).
 +
 +{{:blocks:server:mirror:clone:selectsourcedisk.png?nolink&|}}
 +
 +Skip "check and repair the source filesystem".
 +
 +{{:blocks:server:mirror:clone:repairingsourcefilesystem.png?nolink&|}}
 +
 +Skip "checking if the saved image is restorable".
 +
 +{{:blocks:server:mirror:clone:checkingsavedimage.png?nolink&|}}
 +
 +Choose to "not encrypt the image".
 +
 +{{:blocks:server:mirror:clone:encryptimage.png?nolink&|}}
 +
 +Choose "poweroff" to shut down the computer once the clone has been created.
 +
 +{{:blocks:server:mirror:clone:actionwhenfinished.png?nolink&600|}}
 +
 +Press Enter to continue.
 +
 +{{:blocks:server:mirror:clone:entertocontiniue.png?nolink&1000|}}
 +
 +Verify the details, then confirm by pressing y followed by Enter.
 +
 +{{:blocks:server:mirror:clone:confirm1.png?nolink&1000|}}
 +
 +Double-check the details, then confirm by pressing y followed by Enter again.
 +
 +{{:blocks:server:mirror:clone:confirm2.png?nolink&1000|}}
 +
 +Wait for the cloning to conclude. This may take several minutes, depending on the amount of data on your source disk. Make sure the operation completes successfully.
 +
 +{{:blocks:server:mirror:clone:progresscaptureimage.png?nolink&600|}}
 +
 +The computer will shut down automatically once a clone has been made. Remove the USB sticks/drives. Restart your Blocks server and make sure it comes back OK. If it doesn't, re-enter its BIOS settings and set it back to start from its internal drive. 
 +
 +[[blocks:server:creating_a_server#writing_the_server_image_to_the_ssd|This guide]] describes how to write the image to your Mirror Server, thus making it an exact copy of your Blocks server. Store your clone image for safekeeping. It contains a complete snapshot of your Blocks server at this point in time, thus acting as a full backup.
  
  
Line 221: Line 268:
   * Server Disk Space. Indicates the amount of free space on the Blocks Server itself. This also makes sens to keep an eye on – especially before adding a significant amount of new content.   * Server Disk Space. Indicates the amount of free space on the Blocks Server itself. This also makes sens to keep an eye on – especially before adding a significant amount of new content.
   * Server Time. Shows the current time of the clock in the Blocks Server. If your server has Internet access, this is generally adjusted automatically. If not, you may want to check this every few monts to make sure that it is reasonably accurate.   * Server Time. Shows the current time of the clock in the Blocks Server. If your server has Internet access, this is generally adjusted automatically. If not, you may want to check this every few monts to make sure that it is reasonably accurate.
 +  * Sync Errors. Cumulative count of data sync errors that have occurred, if any. Check the Mirror log file for details.
  
-The SYNCHRONIZE NOW button can be used to force a full synchronization. Use this after making manual changes to the files in the /home/pixi-server directory of the Blocks server, such as updating Blocks itself or the mirroring service (the files PIXILAN.jar and MIRROR.jar respectvely). Doing so pushes those changes over to the Mirror Server immediately rather than waiting for the next scheduled full synchronization.+The "Synchtronize Now" button can be used to force a full synchronization. Use this after making manual changes to the files in the /home/pixi-server directory of the Blocks server, such as updating Blocks itself or the mirroring service (the files PIXILAN.jar and MIRROR.jar respectvely). Doing so pushes those changes over to the Mirror Server immediately rather than waiting for the next scheduled full synchronization.
  
 ===== Testing the Mirror Server ===== ===== Testing the Mirror Server =====
Line 264: Line 312:
 ===== Mirror Server Configuration ===== ===== Mirror Server Configuration =====
  
-The mirroring service can be configured in the PIXILAB-Blocks-config-yml file also used by Blocks. Add a top-level entry in this file with the following settings (where all settings are optional, with reasonable defaults):+The mirroring service can be configured in the PIXILAB-Blocks-config.yml file also used by Blocks. Add a top-level entry in this file with the following settings (where all settings are optional, with reasonable defaults):
  
 <code> <code>
Line 280: Line 328:
   * Set fullSyncOnStartup to //true// to run a full synchronization once when mirroring service is started.   * Set fullSyncOnStartup to //true// to run a full synchronization once when mirroring service is started.
   * Set java.util.logging.FileHandler.level to //ERROR// for less verbose logging, or //INFO// for more details (sometimes useful when troubleshooting).   * Set java.util.logging.FileHandler.level to //ERROR// for less verbose logging, or //INFO// for more details (sometimes useful when troubleshooting).
 +
 +The following additional, advanced settings are available in version 7.1 and later, then specified under the "mirror:" heading as shown above. 
 +
 +<code>
 +  interface: enp2s0
 +  subnet: 192.168.0.0/24
 +</code>
 +
 +:!: **NOTE**: There are two spaces at the beginning of each line, as required when used under the "mirror:" heading.
 +
 +  * The //interface// setting is useful if your computer have more than one network interface with link local addressing. If so, use this setting to specify the name of the desired synchronization backdoor network interface.
 +  * The //subnet// setting lets you specify a non link local subnet (in CIDR notation) for use as the data synchronization backdoor. This is useful in cases where you may want to use this interface for other purposes, such as remote management of the servers. You would then either set fixed addresses (within the specified subnet) or use dynamically assigned addresses (DHCP).
 +
  
 The settings under //logging// follow the java.util.logging standard, sometimes referred to as JUL, allowing you to use any settings available there, for example to log to an external log handler. The settings under //logging// follow the java.util.logging standard, sometimes referred to as JUL, allowing you to use any settings available there, for example to log to an external log handler.
  
  
 +=====Troubleshooting=====
 +Unless the advanced //subnet// setting is used (see above), the server-to-server backdoor connection assumes the use of self-assigned ("link local") addresses. Such adresses are in the 169.254.x.x address range. There must not be any additional network interfaces in either computer having such IP addresses. If there are, do either of the following:
 +  * Disable any such interface(s). in some cases this may need to be done in the computer's BIOS settings.
 +  * Change their addresses to keep them out of this address range.
 +  * Use the advanced //nic// setting to specify which interface to use. 
 + 
 +=== Verifying over SSH ===
 +The mirroring service shows its status window while running, as described above. If you're accessing your server using a terminal session over SSH, you can instead use this command to ascertain whether the mirroring service is running, while being logged in as the pixi-server user:
 +
 +<code>
 +systemctl --user status blocks.mirror
 +</code>
 +
 +
 +=====Implementation Notes=====
 +
 +These notes provide additional understanding of how the mirroring service works. While not generally something you need to know, these details may be of assistans in some installations or when troubleshooting a system.
 +
 +===Synchronized files===
 +The following directories and files are synchronized:
 +
 +  * /home/pixi-server/PIXILAB-BLOCKS-root/*
 +  * /home/pixi-server/native/*
 +  * /home/pixi-server/*.sh (e.g., the command-line start and stop scripts)
 +  * /home/pixi-server/PIXILAN.jar (the Blocks software)
 +  * /home/pixi-server/MIRROR.jar (the Mirroring software)
 +  * /home/pixi-server/PIXILAB-Blocks-config.yml (if it exists)
 +
 +:!: **NOTE:** Any additional files you want to synchronize, such as SSL certificates, must be placed inside the PIXILAB-BLOCKS-root
 +
 +===Starting/stopping Blocks===
 +The Linux [[https://en.wikipedia.org/wiki/Systemd|systemd]] feature is used to start and manage most programs that aren't started manually. This includes Blocks as well as the Mirroring service. You can see how this is done inside the start.sh and stop.sh scripts located in the home directory of the pixi-server user. When //not// using the mirroring service, //systemd// directly starts and manages Blocks. 
 +
 +However, when using the mirroring service, //systemd// starts the mirroring service (referred to by the name //blocks.mirror//). Then, when appropriate (i.e., when the license key is connected) the mirroring service starts Blocks. Likewise, if the license key is disconnected (e.g., to be moved to the other server), the mirroring service shuts down Blocks. Here, //systemd// isn't directly responsible for starting/stopping Blocks. Therefore, viewing its //systemd// status (e.g. using the //systemctl --user status blocks// command) will show its status as inactive, even though it's running. Other system commands can be used to look at running processes.
  
 +The mirroring service also generates its own log, found in the logs directory inside your Blocks root directory. Check these log files if you encounter any problems related to the mirroring service.