跳转至

备份数据

octoplant 系统提供手动备份服务器存档数据的选项,或使用批处理文件定期自动备份的选项。

前提条件

要执行服务器存档的数据备份,必须满足以下 必要 前提条件:

  • 手动执行数据备份的用户,必须在服务器系统上拥有管理员权限。
  • 在备份数据之前,必须终止 VDog MasterService 服务。
  • PostgreSQL 数据库系统(PostgreSQL.exe 应用程序)应与 VDog MasterService 一同终止。为安全起见,您可以在服务控制管理器中进行检查。

如果不满足这些要求,服务器存档可能会被破坏,数据也可能会丢失。

Warning

数据备份期间,系统不可用。建议在夜间或周末等非高峰时段执行数据备份。

节省存储空间的选择:

  • 服务器存档的 VD_TMP_VD 目录只包含临时文件。备份服务器存档时,请不要备份 VD_TMP_VD 目录。
  • 在备份之前,可以对 vdServerArchive 目录进行压缩。为了进行压缩,必须安装相应的 ZIP 应用程序。

手动备份数据

Warning

如果使用远程存档,必须始终同时备份远程存档和本地服务器存档。

本地存档

将本地目录 vdServerArchive 复制到所需的存储位置,如外部硬盘。

远程存档

将远程共享的 vdServerArchive 目录复制到所需的存储位置,如外部硬盘。

自动备份数据

您可以通过创建批处理文件并使用 Windows 作业调度器在特定时间执行该文件,自动备份 vdServerArchive 目录。

Info

不建议在已安装 octoplant 服务器的计算机上安装 octoplant hub。如果已经安装,则除了 VDog MasterService 外,还必须在批处理文件中终止并随后重启 octoplant hub 服务 octoplanthub-postgresoctoplanthubsvc。您可以在本页底部找到带有 octoplant hub 的 Backup.bat 文件示例。

示例:Backup.bat 文件

Info

要将示例中的批处理文件用于您的系统,请根据您的系统调整文件中的所有路径规格。

set SERVERARCHIVE="D:\vdServerArchive\*"
rem If no remote archive, set the variable remotearchive to an empty value.
rem set REMOTEARCHIVE=""
set REMOTEARCHIVE="\\storage\share\vdServerArchive\*"
set OUTFILE="D:\vdServerBackup.zip"
set 7ZIP="%PROGRAMFILES(x86)%\7-Zip\7z.exe"

net stop "VDog MasterService"

if NOT "%ERRORLEVEL%"=="0" (
if NOT "%ERRORLEVEL%"=="2" (
echo Could not stop server
exit /B %ERRORLEVEL%
)
)

tasklist /fi "ImageName eq VDog*" /fo csv 2>NUL | find /I "VDog">NUL
if "%ERRORLEVEL%"=="0" (
echo Server processes still running
tasklist /fi "ImageName eq VDog*" /fo csv
exit /B 1
)

tasklist /fi "ImageName eq postgres.exe" /fo csv 2>NUL | find /I "postgres.exe">NUL
if "%ERRORLEVEL%"=="0" (
tasklist /fi "ImageName eq postgres.exe" /fo csv
echo Database processes still running
exit /B 1
)

REM Backup local server archive with 7-zip
"%7ZIP%" u -t7z -r %OUTFILE% %SERVERARCHIVE%
if NOT "%ERRORLEVEL%"=="0" (
echo Could not zip server archive
exit /B %ERRORLEVEL%
)

if "%REMOTEARCHIVE%" == "" GOTO startms
REM Backup remote server archive with 7-zip
"%7ZIP%" u -t7z -r %OUTFILE% %REMOTEARCHIVE%
if NOT "%ERRORLEVEL%"=="0" (
echo Could not zip remote archive
exit /B %ERRORLEVEL%
)

:startms
net start "VDog MasterService"
if NOT "%ERRORLEVEL%"=="0" (
echo Could not start server
exit /B %ERRORLEVEL%
)

echo "success"
pause
Backup.bat 文件示例(含 octoplant hub)
set SERVERARCHIVE="D:\vdServerArchive\*"
rem If no remote archive, set the variable remotearchive to an empty value.
rem set REMOTEARCHIVE=""
set REMOTEARCHIVE="\\storage\share\vdServerArchive\*"
set OUTFILE="D:\vdServerBackup.zip"
set 7ZIP="%PROGRAMFILES(x86)%\7-Zip\7z.exe"

echo Stopping server
net stop "VDog MasterService"
if NOT "%ERRORLEVEL%"=="0" (
if NOT "%ERRORLEVEL%"=="2" (
echo Could not stop server
exit /B %ERRORLEVEL%
)
)

echo Stopping hub database
net stop "octoplanthub-postgres"
if NOT "%ERRORLEVEL%"=="0" (
if NOT "%ERRORLEVEL%"=="2" (
echo Could not stop hub database
exit /B %ERRORLEVEL%
)
)

echo Stopping hub 
net stop "octoplanthubsvc"
if NOT "%ERRORLEVEL%"=="0" (
if NOT "%ERRORLEVEL%"=="2" (
echo Could not stop hub
exit /B %ERRORLEVEL%
)
)

tasklist /fi "ImageName eq VDog*" /fo csv 2>NUL | find /I "VDog">NUL
if "%ERRORLEVEL%"=="0" (
echo Server Processes still running
tasklist /fi "ImageName eq VDog*" /fo csv
exit /B 1
)

tasklist /fi "ImageName eq postgres.exe" /fo csv 2>NUL | find /I "postgres.exe">NUL
if "%ERRORLEVEL%"=="0" (
tasklist /fi "ImageName eq postgres.exe" /fo csv
echo Database Processes still running
exit /B 1


REM Backup local server archive with 7-zip
%7ZIP% u -t7z -r %OUTFILE% %SERVERARCHIVE%
if NOT "%ERRORLEVEL%"=="0" (
echo Could not zip server archive
exit /B %ERRORLEVEL%
)

if "%REMOTEARCHIVE%" == "" GOTO startms
REM Backup remote server archive with 7-zip
%7ZIP% u -t7z -r %OUTFILE% %REMOTEARCHIVE%
if NOT "%ERRORLEVEL%"=="0" (
echo Could not zip remote archive
exit /B %ERRORLEVEL%
)

:startms
echo Starting server
net start "VDog MasterService"
if NOT "%ERRORLEVEL%"=="0" (
echo Could not start server
exit /B %ERRORLEVEL%
)

echo Starting hub database
net start "octoplanthub-postgres"
if NOT "%ERRORLEVEL%"=="0" (
echo Could not start hub database
exit /B %ERRORLEVEL%
)

echo Starting hub 
net start "octoplanthubsvc"
if NOT "%ERRORLEVEL%"=="0" (
echo Could not start hub 
exit /B %ERRORLEVEL%
)
echo "success"
pause

相关主题