Welcome to the Alteryx Knowledge Base

Alteryx Server Backup and Recovery Part 2: Procedures
user

Created/Edited - 4/22/2026 by Kevin Powney | Alteryx

How To

This is the second article in a series on Alteryx Server backup and recovery. You can find Part 1 at:

 

Alteryx Server Backup and Recovery Part 1: Best Practices

 

As long as a backup of the Mongo database is available, you can get Alteryx Server back up and running. Luckily, backing up the embedded MongoDB is pretty simple, and can be done with a few console commands. I would recommend creating a batch file or script to perform the process. Doing so will allow you to schedule the backup using Windows Task Scheduler. The actual steps to perform a MongoDB backup are covered in detail in the online help under the server configuration section or at this direct link. I will also outline the steps below for completeness.

Environment

Alteryx Server

Procedure

To create a backup of the MongoDB:

 

  1. Stop AlteryxService.
  2. Execute the following command to save a backup of the database in the specified folder:


alteryxservice emongodump="DRIVE:\BACKUP_FOLDER"
 

  1. Confirm the backup was successful. This is a necessary step as a backup failure will not be reported above and can lead to missing data on your Server. To do so, review the mongoDump.log in the MongoDB folder where the data was backed up.  Open mongoDup.log and search for "Fail" and "Fatal".
  2. Restart AlteryxService

 

You can easily script this to a batch file with a few simple console commands. Keep in mind that paths may vary on your server, but it should look something like this.

 

Example:

 

 

"C:\Program Files\Alteryx\bin\AlteryxService.exe" stop
"C:\Program Files\Alteryx\bin\AlteryxService.exe" emongodump="Z:\Path\MongoBackup"
"C:\Program Files\Alteryx\bin\AlteryxService.exe" start

 

 

You can add additional features, such as logging and date/time stamps, to the backups. As an example of additional useful features to include with your backups, I have includedthe code for a batch scriptI created that adds the following information: logging with date/time stamping, a backup that is also date/time stamped, automated archival of the backup, copying the archive to a network location, and cleanup of the temp files.

 

Once you have a batch file or other script to perform your backups, you need to test the script to ensure it works properly. Once testing is done, the next step is to schedule the backup. The easiest way to do this is to use Windows Task Scheduler. To create a scheduled task on Windows 2012 Server, follow these steps:

 

Create a scheduled task:

 

  1. Open Task Scheduler and click on “Create Task"

 

2016-05-11_8-50-15.png

 

 

  1. On the General tab, enter “Name”, “Description”, select “Run whether user is logged in or not", and select "Run with highest privileges"

 

2018-07-27_8-54-52.png

 

 

  1. On the Triggers tab, click “New”

 

2016-05-11_9-01-50.png

 

 

  1. A dialogue box will appear. Define the schedule (daily, weekly, etc...) on which you want the backup to run and click “OK”

 

2016-05-11_9-05-10.png

 

 

  1. On the Actions tab click “New”

 

2016-05-11_8-55-03.png

 

 

  1. On the dialogue window, make sure “Start a Program” is selected and click “Browse”. Select the batch file you created and click “Open”. Then click “OK”.

 

2016-05-11_8-57-49.png

 

 

  1. Click “OK” on the Create Task window to finalize the creation of the backup task.

 

Now that you have successfully implemented backup procedures and scheduled a task to automate the backups, it is time to discuss database restoration from a backup. The good news is that restoring the database is just as simple as backing it up. Assuming that 1) the server is functioning, 2) Alteryx Server is installed, and 3) you have a valid backup available, you can follow these simple steps outlined below.

 

To restore a backup of the MongoDB:

 

  1. Stop AlteryxService
  2. Execute the following command to restore the backup.  Note:  The final parameter, “,10”, ensures lower memory usage by Mongo during the restore. This reduces the chance of out-of-memory errors but may increase the time to restore. Leaving off the “,10” parameter may lead to faster restores. In either case, review the mongoRestore.log as described below to ensure the restore was successful.
alteryxservice emongorestore="DRIVE:\BACKUP_FOLDER","DRIVE:\RESTORE_FOLDER",10

  1. Confirm the Confirm the restore was successful.
    Caution -- This is a necessary step as a restore failure will not be reported above and can lead to missing data on your Server. To do so, review the mongoRestore.log in the MongoDB folder where the data was restored. Open mongoRestore.log and search for “Error”, “Failed”, and “Fatal”. Additionally, confirm that it reports "#### document(s) restored successfully, 0 document(s) failed to restore" on the last line.
  2. Restart AlteryxService

 

This simplicity and same focus on command line statements means that we can also script recovery. However, since recovery actions are much less frequent, it probably isn't necessary. Instead, you would just connect to the server, open a command prompt and, following our backup example above, execute the following commands:

 

Example:

 

 

"C:\Program Files\Alteryx\bin\AlteryxService.exe" stop
"C:\Program Files\Alteryx\bin\AlteryxService.exe" emongorestore="Z:\Path\MongoBackup","C:\ProgramData\Alteryx\Service\Persistence\MongoDB",10
"C:\Program Files\Alteryx\bin\AlteryxService.exe" start

 

 

For Alteryx Server we also recommend backing up the controller token and some settings files. While the server can be recovered without these files. Having a backup of them can expedite the recovery process, and they will also ensure you will be able to decrypt any sensitive data in the database. The settings files we recommend backing up are:

 

C:\ProgramData\Alteryx\RuntimeSettings.xml

C:\ProgramData\Alteryx\Engine\SystemAlias.xml

C:\ProgramData\Alteryx\Engine\SystemConnections.xml

 

Again, please keep in mind the exact paths may vary depending on the server configuration and where the backup is located. This example also assumes the backup isn't compressed/archived. If you are using a backup script that archives the backup and copies it to network storage, you will need to copy the backup file to the server and decompress the archive before running the recovery commands above.

 

 

Below is the code for my sample batch script:

 

::-----------------------------------------------------------------------------
::
:: AlteryxServer Backup Script v.2.0.2 - 01/04/19
:: Created By: Kevin Powney
::
:: Service start and stop checks adapted from example code by Eric Falsken
::
::-----------------------------------------------------------------------------

@echo off

::-----------------------------------------------------------------------------
:: Set variables for Log, Temp, Network, and Application Paths
::
:: Please update these values as appropriate for your environment. Note
:: that spaces should be avoided in the LogDir, TempDir, and NetworkDir paths.
:: The trailing slash is also required for these paths.
::-----------------------------------------------------------------------------

SET LogDir=C:\ProgramData\Alteryx\BackupLog\
SET TempDir=C:\Temp\
SET NetworkDir=\\ServerName\SharePath\
SET AlteryxService="C:\Program Files\Alteryx\bin\AlteryxService.exe"
SET ZipUtil="C:\Program Files\7-Zip\7z.exe"

:: Set the maximium time to wait for the service to start or stop in whole seconds. Default value is 2 hours.
SET MaxServiceWait=7200

::-----------------------------------------------------------------------------
:: Set Date/Time to a usable format and create log
::-----------------------------------------------------------------------------

FOR /f %%a IN ('WMIC OS GET LocalDateTime ^| FIND "."') DO SET DTS=%%a
SET DateTime=%DTS:~0,4%%DTS:~4,2%%DTS:~6,2%_%DTS:~8,2%%DTS:~10,2%%DTS:~12,2%
SET /a tztemp=%DTS:~21%/60
SET tzone=UTC%tztemp%

echo %date% %time% %tzone%: Starting backup process... > %LogDir%BackupLog%datetime%.log
echo. >> %LogDir%BackupLog%datetime%.log

::-----------------------------------------------------------------------------
:: Stop Alteryx Service
::-----------------------------------------------------------------------------

echo %date% %time% %tzone%: Stopping Alteryx Service... >> %LogDir%BackupLog%datetime%.log
echo. >> %LogDir%BackupLog%datetime%.log

SET COUNT=0

:StopInitState
SC query AlteryxService | FIND "STATE" | FIND "RUNNING" >> %LogDir%BackupLog%datetime%.log
IF errorlevel 0 IF NOT errorlevel 1 GOTO StopService
SC query AlteryxService | FIND "STATE" | FIND "STOPPED" >> %LogDir%BackupLog%datetime%.log
IF errorlevel 0 IF NOT errorlevel 1 GOTO StopedService
SC query AlteryxService | FIND "STATE" | FIND "PAUSED" >> %LogDir%BackupLog%datetime%.log
IF errorlevel 0 IF NOT errorlevel 1 GOTO SystemError
echo %date% %time% %tzone%: Service State is changing, waiting for service to resolve its state before making changes >> %LogDir%BackupLog%datetime%.log
SC query AlteryxService | Find "STATE"
timeout /t 1 /nobreak >NUL
SET /A COUNT=%COUNT%+1
IF "%COUNT%" == "%MaxServiceWait%" GOTO SystemError 
GOTO StopInitState

:StopService
SET COUNT=0
SC stop AlteryxService >> %LogDir%BackupLog%datetime%.log
GOTO StoppingService

:StopServiceDelay
echo %date% %time% %tzone%: Waiting for AlteryService to stop >> %LogDir%BackupLog%datetime%.log
timeout /t 1 /nobreak >NUL
SET /A COUNT=%COUNT%+1
IF "%COUNT%" == "%MaxServiceWait%" GOTO SystemError 

:StoppingService
SC query AlteryxService | FIND "STATE" | FIND "STOPPED" >> %LogDir%BackupLog%datetime%.log
IF errorlevel 1 GOTO StopServiceDelay

:StopedService
echo %date% %time% %tzone%: AlteryService is stopped >> %LogDir%BackupLog%datetime%.log

::-----------------------------------------------------------------------------
:: Backup MongoDB to local temp directory. 
::-----------------------------------------------------------------------------

echo. >> %LogDir%BackupLog%datetime%.log
echo %date% %time% %tzone%: Starting MongoDB Backup... >> %LogDir%BackupLog%datetime%.log
echo. >> %LogDir%BackupLog%datetime%.log

%AlteryxService% emongodump=%TempDir%ServerBackup_%datetime%\Mongo >> %LogDir%BackupLog%datetime%.log

::-----------------------------------------------------------------------------
:: Backup Config files to local temp directory. 
::-----------------------------------------------------------------------------

echo. >> %LogDir%BackupLog%datetime%.log
echo %date% %time% %tzone%: Backing up settings, connections, and aliases... >> %LogDir%BackupLog%datetime%.log
echo. >> %LogDir%BackupLog%datetime%.log

copy %ProgramData%\Alteryx\RuntimeSettings.xml %TempDir%ServerBackup_%datetime%\RuntimeSettings.xml >> %LogDir%BackupLog%datetime%.log
copy %ProgramData%\Alteryx\Engine\SystemAlias.xml %TempDir%ServerBackup_%datetime%\SystemAlias.xml
copy %ProgramData%\Alteryx\Engine\SystemConnections.xml %TempDir%ServerBackup_%datetime%\SystemConnections.xml
%AlteryxService% getserversecret > %TempDir%ServerBackup_%datetime%\ControllerToken.txt

::-----------------------------------------------------------------------------
:: Restart Alteryx Service
::-----------------------------------------------------------------------------

echo. >> %LogDir%BackupLog%datetime%.log
echo %date% %time% %tzone%: Restarting Alteryx Service... >> %LogDir%BackupLog%datetime%.log
echo. >> %LogDir%BackupLog%datetime%.log

SET COUNT=0

:StartInitState
SC query AlteryxService | FIND "STATE" | FIND "STOPPED" >> %LogDir%BackupLog%datetime%.log
IF errorlevel 0 IF NOT errorlevel 1 GOTO StartService
SC query AlteryxService | FIND "STATE" | FIND "RUNNING" >> %LogDir%BackupLog%datetime%.log
IF errorlevel 0 IF NOT errorlevel 1 GOTO StartedService
SC query AlteryxService | FIND "STATE" | FIND "PAUSED" >> %LogDir%BackupLog%datetime%.log
IF errorlevel 0 IF NOT errorlevel 1 GOTO SystemError
echo %date% %time% %tzone%: Service State is changing, waiting for service to resolve its state before making changes >> %LogDir%BackupLog%datetime%.log
SC query AlteryxService | Find "STATE"
timeout /t 1 /nobreak >NUL
SET /A COUNT=%COUNT%+1
IF "%COUNT%" == "%MaxServiceWait%" GOTO SystemError 
GOTO StartInitState

:StartService
SET COUNT=0
SC start AlteryxService >> %LogDir%BackupLog%datetime%.log
GOTO StartingService

:StartServiceDelay
echo %date% %time% %tzone%: Waiting for AlteryxService to start >> %LogDir%BackupLog%datetime%.log
timeout /t 1 /nobreak >NUL
SET /A COUNT=%COUNT%+1
IF "%COUNT%" == "%MaxServiceWait%" GOTO SystemError 

:StartingService
SC query AlteryxService | FIND "STATE" | FIND "RUNNING" >> %LogDir%BackupLog%datetime%.log
IF errorlevel 1 GOTO StartServiceDelay

:StartedService
echo %date% %time% %tzone%: AlteryxService is started >> %LogDir%BackupLog%datetime%.log

::-----------------------------------------------------------------------------
:: This section compresses the backup to a single zip archive
::
:: Please note the command below requires 7-Zip to be installed on the server.
:: You can download 7-Zip from http://www.7-zip.org/ or change the command to
:: use the zip utility of your choice as defined in the variable above.
::-----------------------------------------------------------------------------

echo. >> %LogDir%BackupLog%datetime%.log
echo %date% %time% %tzone%: Archiving backup... >> %LogDir%BackupLog%datetime%.log

%ZipUtil% a %TempDir%ServerBackup_%datetime%.7z %TempDir%ServerBackup_%datetime% >> %LogDir%BackupLog%datetime%.log

::-----------------------------------------------------------------------------
:: Move zip archive to network storage location and cleanup local files
::-----------------------------------------------------------------------------

echo. >> %LogDir%BackupLog%datetime%.log
echo %date% %time% %tzone%: Moving archive to network storage >> %LogDir%BackupLog%datetime%.log
echo. >> %LogDir%BackupLog%datetime%.log

copy %TempDir%ServerBackup_%datetime%.7z %NetworkDir%ServerBackup_%datetime%.7z >> %LogDir%BackupLog%datetime%.log

del %TempDir%ServerBackup_%datetime%.7z >> %LogDir%BackupLog%datetime%.log
rmdir /S /Q %TempDir%ServerBackup_%datetime% >> %LogDir%BackupLog%datetime%.log

::-----------------------------------------------------------------------------
:: Done
::-----------------------------------------------------------------------------

echo. >> %LogDir%BackupLog%datetime%.log
echo %date% %time% %tzone%: Backup process completed >> %LogDir%BackupLog%datetime%.log
GOTO :EOF

:SystemError
echo. >> %LogDir%BackupLog%datetime%.log
echo %date% %time% %tzone%: Error starting or stopping service. Service is not accessible, is offline, or did not respond to the start or stop request within the designated time frame. >> %LogDir%BackupLog%datetime%.log

Multi-Node Environments

Multi node environments require all nodes to be brought down before performing the backup. This may not seem necessary, but we have seen instances in Support where not following this procedure has resulted in corruption in MongoDb. To bring all nodes down and back up gracefully, please follow these steps.

 

  1. Stop AlteryxService on Gallery machine (if Gallery is on the same node as the Controller, skip this step)
  2. Stop AlteryxService on all Worker nodes not on the Controller node
    1. Wait for service to fully stop. Workflows running can cause this to take some time.
  3. Stop Alteryx Service on the Controller node
  4. Perform backup as documented above
  5. Start AlteryxService on the Controller node
  6. Start AlteryxService on all Worker nodes
  7. Start AlteryxService on the Gallery node

This process will require coordination between multiple servers. We leave the task of this coordination up to the user as there are too many options to list and they require individual configuration for the user's environment.

 

 
Was this article helpful?