Searching...

Matching results

    AMM Backup Procedure

    Performing a nightly backup of a server is essential for safeguarding data and ensuring a quick recovery in the event of an unexpected diaster.

    As the backups will contain secrets and other security information, they should be maintained at the same level of security as the AMM login itself.

    The duration of backups can significantly differ based on your configuration. To ensure a smooth backup process, it is advisable to schedule it at a time when users are not active, allowing ample time for the backup operation to complete.

    To ensure the integrity of the data, the following procedure to backup an AMM should be followed.

    1. Become user root either by logging in on the console as root, or by logging in as user imtadmin and executing su - .
    2. To stop the AMM server, type ammctl stop.
    3. To stop the database, type /bin/systemctl stop mysqld
    4. Perform the backup to a destination that is not on the AMM local drive.
    5. Once the backup is completed, start the AMM server.
    6. To start the database and AMM server, type ammctl start

    There are numerous data backup methods available with two common backup methods outlined below. Nevertheless, it is advisable to assess your own specific requirements to determine the most suitable backup method.

    The following example creates a snapshot of the entire system using a block level or system level backup. If you need assistance with a backupdatadisk.sh script, please contact Technical Support.

    #!/bin/bash
    set -ue
    touch /var/log/inmotion/backupdatadisk.log
    
    # stop AMM and database services
    /usr/sbin/ammctl stop &> /dev/null
    /bin/systemctl stop mysqld &> /dev/null
    
    sync
    echo 1 > /proc/sys/vm/drop_caches
    
    /usr/sbin/ammctl status >> /var/log/inmotion/backupdatadisk.log
    echo "`date +%Y%m%d:%H:%M:%S` :Core services stopped prior to snapshot" >> /var/log/inmotion/backupdatadisk.log
    ## Run Snapshot and cleanup.  backupdatadisk.sh in this example would contain the commands to perform the backup.
    /opt/inmotiontechnology/scripts/hosted/backupdatadisk.sh
    
    # Restart services
    /usr/sbin/ammctl start &> /dev/null
    /usr/sbin/ammctl status >> /var/log/inmotion/backupdatadisk.log
    echo "`date +%Y%m%d:%H:%M:%S` :Services restarted after snapshot" >> /var/log/inmotion/backupdatadisk.log
    

    The following example will backup only AMM data files. Several prerequisites must be put in place for this backup script to function properly.

    1. Setup a remote Linux server with storage disk size >= AMM amm_data partition size.
    2. In AMM, run ssh-keygen to generate public key pair.
    3. On the remote server, create /root/.ssh folder with permission 0700.
    4. Copy and paste AMM’s public key in the remote server’s /root/.ssh/authorized_keys file.
    5. The permission of the authorized_keys file must be 0600.

    #!/bin/bash
    set -ue
    
    REMOTE=10.0.0.1  # change 10.0.0.1 to IP address of remote server
    
    sshopts="-oStrictHostKeyChecking=no -oPasswordAuthentication=no -oUserKnownHostsFile=/dev/null -oLogLevel=ERROR"
    ssh $sshopts root@$REMOTE mkdir -p /mnt/BACKUP/home/inmotion \
     /mnt/BACKUP/var/lib \
     /mnt/BACKUP/etc \
     /mnt/BACKUP/opt/inmotiontechnology \
     /mnt/BACKUP/mnt/amm_data/opt/tomcat/webapps \
     /mnt/BACKUP/mnt/amm_data/etc/openvpnmgr
    
    echo "$(date +%Y%m%d:%H:%M:%S) Backup start" >> /var/log/inmotion/backup.log
    /usr/sbin/ammctl stop &> /dev/null
    systemctl stop mysqld &> /dev/null
    
    srcdirs="/home/inmotion/ftp /home/inmotion/MHS_certs  /home/inmotion/MHS_config  /home/inmotion/MHS_software  /home/inmotion/MHS_api_usage_logs  /home/inmotion/MHS_donetask  /home/inmotion/MHS_reports"
    rsync -a -e "ssh $sshopts" --delete $srcdirs root@$REMOTE:/mnt/BACKUP/home/inmotion/
    
    rsync -a -e "ssh $sshopts" --delete /mnt/amm_data/var/lib/mysql /mnt/amm_data/var/lib/tftpboot root@$REMOTE:/mnt/BACKUP/var/lib/
    rsync -a -e "ssh $sshopts" --delete /etc/openvpnmgr root@$REMOTE:/mnt/BACKUP/etc
    rsync -a -e "ssh $sshopts" --delete /mnt/amm_data/etc/openvpnmgr/ root@$REMOTE:/mnt/BACKUP/mnt/amm_data/etc/openvpnmgr/
    rsync -a -e "ssh $sshopts" --delete /mnt/amm_data/opt/inmotion root@$REMOTE:/mnt/BACKUP/opt/
    rsync -a -e "ssh $sshopts" --delete /mnt/amm_data/opt/tomcat/webapps/inmotion root@$REMOTE:/mnt/BACKUP/mnt/amm_data/opt/tomcat/webapps/
    rsync -a -e "ssh $sshopts" --delete /mnt/amm_data/opt/inmotiontechnology/certs root@$REMOTE:/mnt/BACKUP/mnt/amm_data/opt/inmotiontechnology/
    
    /usr/sbin/ammctl start &> /dev/null
    
    echo "$(date +%Y%m%d:%H:%M:%S) Backup complete" >> /var/log/inmotion/backup.log
    

    TOP