# Backup

{% hint style="warning" %}
**This is the manual for older MicroStream versions (Version < 5.0).**

**The new documentation (Version >= 5.0) is located at:**

[https://docs.microstream.one/](https://docs.microstream.one/manual)
{% endhint %}

## Continuous Backup

By default, the continuous backup is disabled. If enabled the MicroStream instance will clone all changes to another directory. The backup is identical to the primary MicroStream storage.

To enable the continuous backup just set the backup directory:

With  `storage.embedded.configuration` API:

{% tabs %}
{% tab title="Java" %}

```java
EmbeddedStorageManager storageManager = Configuration.Default()
	.setBackupDirectory("A safe place")
	.createEmbeddedStorageFoundation()
	.createEmbeddedStorageManager();
```

{% endtab %}

{% tab title="Xml" %}

```
<properties>
	<property name="backupDirectory" value ="/save/backup" />
	...
</properties>
```

{% endtab %}

{% tab title="ini" %}

```
backupDirectory = backupDir
```

{% endtab %}
{% endtabs %}

With MicroStream foundation classes:

{% code title="Java" %}

```java
StorageBackupSetup backupSetup = StorageBackupSetup.New(
    Storage.FileProviderBuilder()
		.setBaseDirectory(BACKUPDIR.getPath())						
		.setTruncationDirectory(TRUNKATIONDIR.getPath())
		.setDeletionDirectory(DELETIONDIR.getPath())
		.createFileProvider()
	);	
				
StorageConfiguration configuration = StorageConfiguration.Builder()
	.setBackupSetup(backupSetup)
	.setStorageFileProvider(StorageFileProvider.New(WORKINGDIR))
	.createConfiguration();
```

{% endcode %}

{% content-ref url="" %}
[](https://manual.docs.microstream.one/2.0/data-store/configuration)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.docs.microstream.one/2.0/data-store/configuration/backup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
