# バックアップ

### DBのバックアップ

スロットリーダ割り当てを考慮して問題のない時間帯、構成であることを確認の上実行します。

Cardano Nodeを停止します。

```
sudo systemctl stop cardano-node
sudo systemctl status cardano-node
```

`backup_db` などバックアップを配置するためのディレクトリを予め用意しておきます。\
(ここではhome配下に作成済みの想定)\
下記コマンドでバックアップを取ります。スペックによりますが、2021年4月の時点のDBで、40〜50分かかりました。

```
cd $NODE_HOME
tar Jcf ~/backup_db/db_<バックアップ取得の日付>.tar.xz db/
```

Cardano Nodeを起動します。

```
sudo systemctl start cardano-node
sudo systemctl status cardano-node
```

### DBリストア

問題があった際、取得しておいたDBのバックアップからリストアします。

Cardano Nodeを停止します。

```
sudo systemctl stop cardano-node
sudo systemctl status cardano-node
```

dbフォルダをリネームします。

```
cd $NODE_HOME
mv db/ db_<日付>
```

dbのバックアップファイルをCardano Node実行ディレクトリへコピーします。

```
cp ~/backup_db/db_<リストア対象の日付>.tar.xz .
```

解凍します。dbフォルダ内にファイルが存在していることを確認します。

```
tar -xf db_<リストア対象の日付>.tar.xz
ls db
```

Cardano Nodeを起動します。

```
sudo systemctl start cardano-node
sudo systemctl status cardano-node
```


---

# 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://sugar-stake-pool.gitbook.io/cardano-kb/cardano-node-operation/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.
