Difference between revisions of "Hot Backup and Restore"

From Lianjapedia
Jump to: navigation, search
(Backup and Restore during development)
(Restore App)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
''Under construction''
+
{{DISPLAYTITLE:Backup and Restore}}
 
+
 
==Backup and Restore during development==
 
==Backup and Restore during development==
 
 
You can perform a Hot Backup and Restore of Apps and Databases while developing in the App Builder.  
 
You can perform a Hot Backup and Restore of Apps and Databases while developing in the App Builder.  
  
 
There is no need to close the App or Database to perform these operations.
 
There is no need to close the App or Database to perform these operations.
 
Use "Apps | Backup App", "Apps | Restore App", "Database | Backup Database", "Database | Restore Database" in the MenuBar.
 
  
 
<div style="height:80px;margin-bottom:5px;padding:5px;border:0px solid orange;border-left:5px solid orange;background:#fff8dc;vertical-align:middle;position:relative;">
 
<div style="height:80px;margin-bottom:5px;padding:5px;border:0px solid orange;border-left:5px solid orange;background:#fff8dc;vertical-align:middle;position:relative;">
 
[[File:bm-noteicon.png|top|40px|link=]]<div style="position:absolute;top:3px;margin-bottom;bottom:5px;margin-left:50px;"><b> Pro Tip</b>
 
[[File:bm-noteicon.png|top|40px|link=]]<div style="position:absolute;top:3px;margin-bottom;bottom:5px;margin-left:50px;"><b> Pro Tip</b>
The [[:Category:Versions_Workspace|Versions workspace]] keeps track of all of your modifications to your Apps and scripts and can be used to restore previous versions..
+
The [[:Category:Versions_Workspace|Versions workspace]] keeps track of all of your modifications to your Apps and scripts and can be used to restore previous versions if you mess something up during development.  
 
</div>
 
</div>
 
<span style="height:6px;"> </span>
 
<span style="height:6px;"> </span>
 
</div>
 
</div>
 +
 +
===Backup App===
 +
Select '''Apps''' then '''Backup App...''' from the App Builder MenuBar:
 
[[{{ns:file}}:backup_app.png|800px|thumb|left|link={{filepath:backup_app.png}}|Backup App]]
 
[[{{ns:file}}:backup_app.png|800px|thumb|left|link={{filepath:backup_app.png}}|Backup App]]
 
<br clear=all>
 
<br clear=all>
  
 +
Click '''Yes''' to continue when prompted, or '''No''' to cancel.
 
[[{{ns:file}}:backup_app2.png|left|link={{filepath:backup_app2.png}}|Backup App]]
 
[[{{ns:file}}:backup_app2.png|left|link={{filepath:backup_app2.png}}|Backup App]]
 
<br clear=all>
 
<br clear=all>
  
 +
Progress information messages will be displayed in the top right corner.
 
[[{{ns:file}}:backup_app3.png|800px|thumb|left|link={{filepath:backup_app3.png}}|Backup App]]
 
[[{{ns:file}}:backup_app3.png|800px|thumb|left|link={{filepath:backup_app3.png}}|Backup App]]
 
<br clear=all>
 
<br clear=all>
  
 +
Backups are stored in the '''backups''' sub-directory of '''apps''' in directories named by year -> month -> day -> time -> app name.
 
[[{{ns:file}}:backup_app4.png|800px|thumb|left|link={{filepath:backup_app4.png}}|Backup App]]
 
[[{{ns:file}}:backup_app4.png|800px|thumb|left|link={{filepath:backup_app4.png}}|Backup App]]
 
<br clear=all>
 
<br clear=all>
  
[[{{ns:file}}:backup_database.png|800px|thumb|left|link={{filepath:backup_database.png}}|Backup Database]]
+
Use [[#Restore App|Restore App]] to restore an App from a selected backup.
 +
 
 +
===Restore App===
 +
<div style="height:120px;margin-bottom:5px;padding:5px;border:0px solid orange;border-left:5px solid orange;background:#fff8dc;vertical-align:middle;position:relative;">
 +
[[File:bm-noteicon.png|top|40px|link=]]<div style="position:absolute;top:3px;margin-bottom;bottom:5px;margin-left:50px;"><b> Pro Tip</b>
 +
If you have not yet saved changes and want to undo them, you can '''Revert to last saved version of this App'''.<br>
 +
Just click the button in the Headerbar:  [[{{ns:file}}:revert.png|link=|Revert to last saved]]<br>
 +
Note that the App is saved when activating [[Understanding Live Preview|'Desktop App View' or 'Preview live in browser']].
 +
</div>
 +
<span style="height:6px;"> </span>
 +
</div>
 +
 
 +
To restore from an App backup, select '''Apps''' then '''Restore App...''' from the App Builder MenuBar:
 +
[[{{ns:file}}:restore_app.png|800px|thumb|left|link={{filepath:restore_app.png}}|Restore App]]
 
<br clear=all>
 
<br clear=all>
  
[[{{ns:file}}:backup_database2.png|left|link={{filepath:backup_database2.png}}|Backup Database]]
+
A dialog will be displayed allowing you to select the backup for the current App to be restored.  The backups are listed by date and time.
 +
 
 +
Click on the backup to restore, then click '''OK''' to continue, or '''Cancel''' to cancel.
 +
[[{{ns:file}}:restore_app2.png|800px|thumb|left|link={{filepath:restore_app2.png}}|Restore App]]
 
<br clear=all>
 
<br clear=all>
  
[[{{ns:file}}:backup_database3.png|800px|thumb|left|link={{filepath:backup_database3.png}}|Backup Database]]
+
Click '''Yes''' to continue when prompted, or '''No''' to cancel.
 +
[[{{ns:file}}:restore_app3.png|left|link={{filepath:restore_app3.png}}|Restore App]]
 
<br clear=all>
 
<br clear=all>
 +
Progress information messages will be displayed in the top right corner.
  
[[{{ns:file}}:backup_database4.png|800px|thumb|left|link={{filepath:backup_database4.png}}|Backup Database]]
+
===Backup Database===
 +
Select '''Database''' then '''Backup Database...''' from the App Builder MenuBar:
 +
[[{{ns:file}}:backup_database.png|800px|thumb|left|link={{filepath:backup_database.png}}|Backup Database]]
 
<br clear=all>
 
<br clear=all>
  
[[{{ns:file}}:restore_app.png|800px|thumb|left|link={{filepath:restore_app.png}}|Restore App]]
+
Click '''Yes''' to continue when prompted, or '''No''' to cancel.
 +
[[{{ns:file}}:backup_database2.png|left|link={{filepath:backup_database2.png}}|Backup Database]]
 
<br clear=all>
 
<br clear=all>
  
[[{{ns:file}}:restore_app2.png|800px|thumb|left|link={{filepath:restore_app2.png}}|Restore App]]
+
Progress information messages will be displayed in the top right corner.
 +
[[{{ns:file}}:backup_database3.png|800px|thumb|left|link={{filepath:backup_database3.png}}|Backup Database]]
 
<br clear=all>
 
<br clear=all>
  
[[{{ns:file}}:restore_app3.png|left|link={{filepath:restore_app3.png}}|Restore App]]
+
Backups are stored in the '''backups''' sub-directory of '''data''' in directories named by year -> month -> day -> time -> database name.
 +
[[{{ns:file}}:backup_database4.png|800px|thumb|left|link={{filepath:backup_database4.png}}|Backup Database]]
 
<br clear=all>
 
<br clear=all>
  
 +
Use [[#Restore Database|Restore Database]] to restore a database from a selected backup.
 +
 +
===Restore Database===
 +
Select '''Database''' then '''Restore Database...''' from the App Builder MenuBar:
 
[[{{ns:file}}:restore_database.png|800px|thumb|left|link={{filepath:restore_database.png}}|Restore Database]]
 
[[{{ns:file}}:restore_database.png|800px|thumb|left|link={{filepath:restore_database.png}}|Restore Database]]
 
<br clear=all>
 
<br clear=all>
  
 +
A dialog will be displayed allowing you to select the backup for the current database to be restored.  The backups are listed by date and time.
 +
 +
Click on the backup to restore, then click '''OK''' to continue, or '''Cancel''' to cancel.
 
[[{{ns:file}}:restore_database2.png|800px|thumb|left|link={{filepath:restore_database2.png}}|Restore Database]]
 
[[{{ns:file}}:restore_database2.png|800px|thumb|left|link={{filepath:restore_database2.png}}|Restore Database]]
 
<br clear=all>
 
<br clear=all>
  
 +
Click '''Yes''' to continue when prompted, or '''No''' to cancel.
 
[[{{ns:file}}:restore_database3.png|left|link={{filepath:restore_database3.png}}|Restore Database]]
 
[[{{ns:file}}:restore_database3.png|left|link={{filepath:restore_database3.png}}|Restore Database]]
 
<br clear=all>
 
<br clear=all>
 +
Progress information messages will be displayed in the top right corner.
  
 
==Backup and Restore in the Cloud==
 
==Backup and Restore in the Cloud==
Line 64: Line 98:
  
 
The backup operations can be run at scheduled intervals using cron on linux or task scheduler on Windows.
 
The backup operations can be run at scheduled intervals using cron on linux or task scheduler on Windows.
 +
 +
When the Cloud Server receives a request it uses the lockResource() function internally to get a shared lock on the named resource "LianjaCloudServerRequestLoop".
 +
 +
After it services the request it unlocks the "LianjaCloudServerRequestLoop" resource then continues in the request loop waiting for another request to arrive.
 +
 +
So, all you need to do in your cron job (or windows task scheduler job) is have a small Lianja runtime script or in this example an .rsp file (that can be run using wget) that locks the "LianjaCloudServerRequestLoop" exclusively.
 +
 +
<div style="height:80px;margin-bottom:5px;padding:5px;border:0px solid orange;border-left:5px solid orange;background:#fff8dc;vertical-align:middle;position:relative;">
 +
[[File:bm-noteicon.png|top|40px|link=]]<div style="position:absolute;top:3px;margin-bottom;bottom:5px;margin-left:50px;"><b> Pro Tip</b>
 +
The locking of resources is cluster aware so if you are sharing storage across many load balanced compute instances in the Cloud the resource locking can be used.
 +
</div>
 +
<span style="height:6px;"> </span>
 +
</div>
 +
 +
==Example==
 +
<code lang="recital">
 +
<%@ Language=VFP %>
 +
<html>
 +
<head>
 +
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 +
</head>
 +
<body>
 +
<%
 +
unlockResource("LianjaCloudServerRequestLoop")
 +
lockResource("LianjaCloudServerRequestLoop", "exclusive")
 +
 +
// Once the exclusive lock has been granted carry out required operations
 +
// ...
 +
 +
// Then release the lock to unblock other requests
 +
unlockResource("LianjaCloudServerRequestLoop")
 +
%>
 +
</body>
 +
</html>
 +
</code>
 +
 +
[[Category:Versions Workspace]]
 +
[[Category:Databases]]

Latest revision as of 10:04, 16 December 2020

Backup and Restore during development

You can perform a Hot Backup and Restore of Apps and Databases while developing in the App Builder.

There is no need to close the App or Database to perform these operations.

Bm-noteicon.png
Pro Tip

The Versions workspace keeps track of all of your modifications to your Apps and scripts and can be used to restore previous versions if you mess something up during development.

Backup App

Select Apps then Backup App... from the App Builder MenuBar:

Backup App


Click Yes to continue when prompted, or No to cancel.

Backup App


Progress information messages will be displayed in the top right corner.

Backup App


Backups are stored in the backups sub-directory of apps in directories named by year -> month -> day -> time -> app name.

Backup App


Use Restore App to restore an App from a selected backup.

Restore App

Bm-noteicon.png
Pro Tip

If you have not yet saved changes and want to undo them, you can Revert to last saved version of this App.
Just click the button in the Headerbar: Revert to last saved
Note that the App is saved when activating 'Desktop App View' or 'Preview live in browser'.

To restore from an App backup, select Apps then Restore App... from the App Builder MenuBar:

Restore App


A dialog will be displayed allowing you to select the backup for the current App to be restored. The backups are listed by date and time.

Click on the backup to restore, then click OK to continue, or Cancel to cancel.

Restore App


Click Yes to continue when prompted, or No to cancel.

Restore App


Progress information messages will be displayed in the top right corner.

Backup Database

Select Database then Backup Database... from the App Builder MenuBar:

Backup Database


Click Yes to continue when prompted, or No to cancel.

Backup Database


Progress information messages will be displayed in the top right corner.

Backup Database


Backups are stored in the backups sub-directory of data in directories named by year -> month -> day -> time -> database name.

Backup Database


Use Restore Database to restore a database from a selected backup.

Restore Database

Select Database then Restore Database... from the App Builder MenuBar:

Restore Database


A dialog will be displayed allowing you to select the backup for the current database to be restored. The backups are listed by date and time.

Click on the backup to restore, then click OK to continue, or Cancel to cancel.

Restore Database


Click Yes to continue when prompted, or No to cancel.

Restore Database


Progress information messages will be displayed in the top right corner.

Backup and Restore in the Cloud

Downtime of SaaS applications in the Cloud is not something your users are going to be happy about. So, with Lianja Cloud Server you can perform a Hot Backup and Restore of your databases while users are running Lianja Apps.

There is no need to shutdown IIS or Apache to perform these operations.

The backup operations can be run at scheduled intervals using cron on linux or task scheduler on Windows.

When the Cloud Server receives a request it uses the lockResource() function internally to get a shared lock on the named resource "LianjaCloudServerRequestLoop".

After it services the request it unlocks the "LianjaCloudServerRequestLoop" resource then continues in the request loop waiting for another request to arrive.

So, all you need to do in your cron job (or windows task scheduler job) is have a small Lianja runtime script or in this example an .rsp file (that can be run using wget) that locks the "LianjaCloudServerRequestLoop" exclusively.

Bm-noteicon.png
Pro Tip

The locking of resources is cluster aware so if you are sharing storage across many load balanced compute instances in the Cloud the resource locking can be used.

Example

<%@ Language=VFP %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<%
unlockResource("LianjaCloudServerRequestLoop")
lockResource("LianjaCloudServerRequestLoop", "exclusive")
 
// Once the exclusive lock has been granted carry out required operations
// ...
 
// Then release the lock to unblock other requests
unlockResource("LianjaCloudServerRequestLoop")
%>
</body>
</html>