HotSync

Nota

Questo pacchetto non è supportato in NethServer Enterprise

Avvertimento

Il moduflo HotSync è da considerarsi una release beta. Pertanto è opportuno provarla in ambienti di test prima di procedere in produzione.

Avvertimento

For a correct restore, it’s suggested to configure HotSync on two identical servers or two servers with same network cards number, name and position. If the master and slave servers differ, the restore procedure may behave unexpectedly (see Troubleshooting).

Suggerimento

If you have configured slave host before release 2.2.0, update to a newer one on master and slave with yum update -y nethserver-hotsync –enablerepo=nethforge or from Software Center. After that, on slave host, launch signal-event nethserver-hotsync-save or do it from Cockpit HotSync interface by pressing Save button.

HotSync mira a ridurre i tempi di inattività in caso di problemi, sincronizzando il NethServer con un altro sistema gemello, che verrà attivato manualmente in caso di guasto del server master.

Normalmente, quando si verifica un problema hardware, il tempo necessario per ripristinare il servizio è:

  1. riparazione/approvvigionamento nuovo server: da 4h a 2 giorni

  2. installazione sistema operativo: 30 minuti

  3. ripristino backup: da 10 minuti a 8 ore

In summary, users are able to start working again with data from the night before failure after a few hours/days. Using HotSync, time 1 and 3 are 0, 2 is 5 minutes (time to activate spare server). Users are able to start working again in few minutes, using data from a few minutes before the crash.

Per impostazione predefinita, tutti i dati inclusi nel backup vengono sincronizzati ogni 15 minuti. Anche i database MariaDB sono sincronizzati, a meno che la sincronizzazione dei database non sia disabilitata. Le applicazioni che utilizzano PostgreSQL sono sincronizzate (Mattermost, Webtop5) a meno che la sincronizzazione dei database non sia disabilitata.

Terminologia

  • MASTER è il sistema di produzione SLAVE è il server di riserva

  • SLAVE è acceso, con un indirizzo IP diverso da MASTER

  • Ogni 15 minuti, MASTER esegue un backup su SLAVE

  • Se si verifica un errore, viene inviata un’e-mail a root (ad admin se è installato il server di posta)

  • SLAVE controlla gli aggiornamenti ed effettua alcune operazioni di sistema ogni 60 minuti

Installazione

Installa nethserver-hotsync sia su MASTER che su SLAVE da Software Center o esegui dalla riga di comando:

yum install -y nethserver-hotsync --enablerepo=nethforge

Configurazione

You can configure HotSync from Cockpit interface: access it from Master and Slave, select role and fill required fields with password and IP. The <PASSWORD> must be the same on master and slave.

È inoltre possibile configurare HotSync dalla riga di comando utilizzando questi comandi:

Master

[root@master]# config setprop rsyncd password <PASSWORD>
[root@master]# config setprop hotsync role master
[root@master]# config setprop hotsync SlaveHost <SLAVE_IP>
[root@master]# signal-event nethserver-hotsync-save

Slave

[root@slave]# config setprop rsyncd password <PASSWORD>
[root@slave]# config setprop hotsync role slave
[root@slave]# config setprop hotsync MasterHost <MASTER_IP>
[root@slave]# signal-event nethserver-hotsync-save

If mysql or postgresql are installed, they will be synchronized by default. You can disable databases sync from Master Cockpit interface or from command line on master machine with this command:

[root@master]# config setprop hotsync databases disabled
[root@master]# signal-event nethserver-hotsync-save

Nota

If you are using HotSync to restore FreePBX leave databases enabled, otherwise FreePBX database will not be restored properly.

Abilitazione/Disabilitazione

HotSync è abilitato di default.Per disabilitarlo rimuovi la spunta dalla checkbox nella sezione HotSync dell’interfaccia Cockpit o utilizza questo comando:

[root@slave]# config setprop hotsync status disabled
[root@slave]# signal-event nethserver-hotsync-save

and to re-enable it re-check the checkbox on interface or use CLI:

[root@slave]# config setprop hotsync status enabled
[root@slave]# signal-event nethserver-hotsync-save

Nota

After HotSync is configured, it’s a good practice to launch hotsync command on master host. After master has properly syncronized, access the slave and execute hotsync-slave. You can force these commands also from Cockpit GUI and check /var/log/messages logs. As best practice, the first syncrhonization should be done via command line to better check if everything is properly configured.

Avvertimento

After HotSync is configured and hotsync command executed properly, note that hotsync-slave command must be executed at least one time before proceed with hotsync-promote. You can launch it manually or wait 60 minutes for automatic execution.

Ripristino: promuovere lo SLAVE in produzione

La seguente procedura mette in produzione lo SLAVE in caso di arrewsto anomalo del master.

  1. Spegne il MASTER.

  2. se la macchina SLAVE deve funzionare come gateway di rete, collegarlo al router/modem con un cavo di rete

  3. Su SLAVE, se sei connesso tramite una console SSH, avvia il comando `` screen``, in modo che sia possibile recuperare la sessione in caso di interruzioni di rete

    [root@slave]# screen
    

    Come best practice, eseguire la seguente procedura utilizzando una console locale e non tramite connessione SSH.

  4. lanciare sullo SLAVE il seguente comando e leggere attentamente l’output generato

    [root@slave]# hotsync-promote
    

    If no Internet connection is detected (e.g. you are restoring a firewall on a machine that was passing through crashed master for Internet connection), the scripts will purpose you some options

    1. Restore master network configuration (IMPORTANT: use this option only if two servers are identical - NIC number, names and positions must be identical)
    2. Fix network configuration from Cockpit GUI (when restoring on different hardware)
    3. Continue without internet: assign correct roles before proceed with this option. Some events could fails (not recommended)
    

    altrimenti il ripristino inizierà automaticamente. Se esegui il ripristino su un hardware diverso, potresti riscontrare errori con il controller di dominio.

Avvertimento

When restoring on identical hardware choose option 1 and network configuration will be overwritten, else choose option 2. It’s not recommended to start the promote procedure without Internet access. When restoring on a different hardware and you’ve choosed option 2, you can encounter DC errors. Please see Troubleshooting.

  1. Se necessario andare su Server Manager o Cockpit GUI, nella pagina Rete e riassegnare i ruoli alle interfacce di rete come master. Ricorda anche di ricreare il bridge se hai configurato il DC. In caso di errori sul DC consultare la sezione risoluzione dei problemi prima di procedere con il ripristino della rete.

  2. Dopo che tutto è stato ripristinato, lancia il comando:

    [root@slave]# /sbin/e-smith/signal-event post-restore-data
    
  3. Aggiorna il sistema all’ultima versione dei pacchetti

    [root@slave]# yum clean all && yum -y update
    
  4. Se sul MASTER era configurato un backup su USB, collegare il disco di backup allo SLAVE

Troubleshooting

Dopo il ripristino su hardware diverso, il controller di dominio non funziona

La console potrebbe segnalare alcuni errori come questi

[ERROR] /usr/libexec/nethserver/sambads: failed to add service primaries to system keytab
Action: /etc/e-smith/events/nethserver-mail-server-update/S50nethserver-sssd-initkeytabs FAILED

Per risolvere questo problema, ripristinare la configurazione di rete come master (inclusi i bridge) e quindi avviare:

/sbin/e-smith/signal-event nethserver-dc-save
/sbin/e-smith/signal-event nethserver-sssd-save

Dopo il ripristino le autorizzazioni sulle ibay non sono corrette

Restore permissions from Cockpit GUI, under File Server, open shared folder menu and click on Restore permissions.

Dopo il ripristino il server è irraggiungibile

If you cannot reach server after a network reconfiguration, check configuration and, if it’s correct, try launching this commands

/sbin/e-smith/signal-event interface-update
/sbin/e-smith/signal-event nethserver-firewall-base-update

Se non riesci ancora a raggiungere il server, utilizza lo strumento network-recovery.

Suggested check after restore

Quando tutti i problemi sono stati risolti, assicurati che: - la configurazione venga ripristinata correttamente - tutti i servizi abilitati funzionino - le interfacce delle applicazioni (es. Freepbx, webtop) funzionino - il file server funzioni e gli utenti possano accedere alle cartelle condivise - il server email funzioni e gli utenti possano inviare e ricevere e-mail: asterisk funzioni e gli utenti possano effettuare chiamate

Infine, riavvia il sistema e verifica che tutti i servizi funzionino dopo l’avvio.

Pacchetti supportati

Tutti i pacchetti nethserver sono supportati. Di seguito un elenco dei principali pacchetti NethServer:

  • nethserver-antivirus

  • nethserver-backup-config

  • nethserver-backup-data

  • nethserver-base

  • nethserver-c-icap

  • nethserver-cockpit

  • nethserver-collectd

  • nethserver-cups

  • nethserver-dante

  • nethserver-dc

  • nethserver-dedalo

  • nethserver-directory

  • nethserver-dnsmasq

  • nethserver-duc

  • nethserver-ejabberd

  • nethserver-evebox

  • nethserver-fail2ban

  • nethserver-firewall-base

  • nethserver-freepbx > 14.0.3

  • nethserver-httpd

  • nethserver-hylafax

  • nethserver-iaxmodem

  • nethserver-ipsec-tunnels

  • nethserver-janus

  • nethserver-letsencrypt

  • nethserver-lightsquid

  • nethserver-mail

  • nethserver-mattermost

  • nethserver-mysql

  • nethserver-ndpi

  • nethserver-netdata

  • nethserver-nextcloud

  • nethserver-ntopng

  • nethserver-nut

  • nethserver-openssh

  • nethserver-openvpn

  • nethserver-pulledpork

  • nethserver-restore-data

  • nethserver-roundcubemail

  • nethserver-samba

  • nethserver-samba-audit

  • nethserver-squid

  • nethserver-squidclamav

  • nethserver-squidguard

  • nethserver-sssd

  • nethserver-subscription

  • nethserver-suricata

  • nethserver-vpn-ui

  • nethserver-vsftpd

  • nethserver-webtop5 (lo stato di z-push non è sincronizzato)

Packages nethserver-ntopng and nethserver-evebox are reinstalled without migrating history.

Avvertimento

To avoid errors on the slave host, do not make any changes to the modules from the Cockpit GUI except the HotSync module.