How to migrate a Linux Mid server from one server to another with minimum downtimeIssue There are situations when a MID Server running on an Linux server with resource limitation constraints or hardware preemptive failures must be migrated, with minimum downtime, to a complete new Linux server. The requirements for accomplish this switch from an old Linux server to a new Linux server are as follows: The new Linux server is meeting the requirements for MID Server installation: Install a MID Server on LinuxThe network connectivity is already validated: KB0970162 - Prepare network connections for MID ServersAccess as root on both Linux hosts running OLD and NEW MID Servers is granted.ReleaseParis onwardsResolutionON OLD SERVER Open a console on the Linux host running the MID Server java processes and switch user to the linux servicenow user #1 - stop the midserver (as linux servicenow user if RUN_AS_USER=<linux_run_as_user> is used) cd <agent_home> cd bin ./mid.sh stop #2 - create a failsafe archive for all the files and folders from agent (as root) cd <agent_home> cd .. && tar -czvf oldsrv_failsafe_backup.tar.gz ./agent #3 - disable the automatic startup (as root) cd <agent_home> cd bin ./mid.sh remove #4 - compress configuration files needed for switch over to new Mid Server (as root user) cd <agent_home> tar -cvf backup_old_mid_server.tar.gz config.xml conf keystore jre/lib/security tar -tvf backup_old_mid_server.tar.gz ON NEW Server #1 - create directory structure and download the FULL Mid Server package by using the "ZIP" link from Downloads module link from instance: https://<instance>.service-now.com/mid_server_download_ui.do #2 - create directories and unpack the archive (as root): mkdir -p /opt/servicenow/mid cd /opt/servicenow/mid wget https://<install_link_from_instance_for FULL_MID_Server_package.zip> tar -xvf <full_MID_Server_package>.zip. #3 - remove the following files (as root user) cd <agent_home> rm -fr conf config.xml keystore jre/lib/security #4 - copy the archive backup_old_mid_server.tar.gz (from OLD Server) into <agent_home>/ and extract the files (as root user) cd <agent_home> tar -xvf backup_old_mid_server.tar.gz -------------------------------------------------------------------------------------------- If the MID Server is running with root authority then the following 2 steps should be skipped. - modify user and group of processes of MID Server by updating <agent_home>/bin/mid.shconf_override RUN_AS_USER=<linux_run_as_user> GROUP_NAME=<linux_run_as_grp> - change ownership of the agent directory (as root) chown <linux_run_as_user>.<linux_run_as_grp> <agent_home> -R -------------------------------------------------------------------------------------------- #4 - install the systemd autostart script cd <agent_home> cd bin ./mid.sh install systemctl daemon-reload #5 - start the midserver (as linux servicenow user if RUN_AS_USER=<linux_run_as_user> is used) cd <agent_home> cd bin ./mid.sh start ON INSTANCE * - Accept and resolve the issues related to change of <agent_home> and <JAVA> version* - Re-key the MID Server and validate.