# Back up the Data Watcher MongoDB

To back up the Data Watcher database follow these steps:

1. On each node where Data Watcher is installed, stop Data Watcher (`dataone.sh stop DW`).
2. On each node where Data Watcher is installed, start MongoDB (`bin/mongodb start`).
3. On just one node of your choice among the ones where Data Watcher is installed, launch the `dwbackup.sh` script to backup the Data Watcher database.
4. On each node where Data Watcher is installed, start Data Watcher (`dataone.sh start DW`).

Need details about start and stop commands? Have a look at the [dataone.sh reference](/data-one-installation-manager/cli-and-configuration-files/dataone.sh-reference.md) page.

The script to back up the Data Watcher database is stored at this path:\
`$DATAWATCHER_HOME/mongodb/backup`

The `dwbackup.sh` script logs backup info into $MONGODB\_LOG\_DIR/dw-backup.log.

Usage:\
`./dwbackup.sh destination-path`\
`destination-path` is the folder where the backup will be generated and it must exist.

Under `destination-path`, the `dw-<datetime>/dw` folder will be created.\
In case the backup fails, the folder will not be created.


---

# 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://docs.primeur.com/data-watcher-1.21/troubleshooting/data-watcher-mongodb-scripts/back-up-the-data-watcher-mongodb.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.
