Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ZFS.md #1694

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
5 changes: 5 additions & 0 deletions nodes/bridge-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,8 @@ Follow the
[tutorial on setting up the bridge node as a background process with SystemD](./systemd.md).

You have successfully set up a bridge node that is syncing with the network.

### Optional: enable on-fly compression with ZFS

Follow the
[tutorial on how to set up your DA node to use on-fly compression with ZFS](./zfs.md).
97 changes: 97 additions & 0 deletions nodes/zfs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
description: Learn how to setup your DA node to use on-fly compression with ZFS.
---

# Setting up your DA node to use ZFS

Enabling ZFS compression on a DA Node server can significantly optimize storage efficiency by compressing data on the fly. Follow this step-by-step guide to implement ZFS compression without requiring any additional tuning on the DA node.

:::tip NOTE
ZFS, compression `zstd-3`:
```
$ zfs get compressratio celestia && du -h /celestia/bridge/.celestia-bridge
NAME PROPERTY VALUE SOURCE
celestia compressratio 2.05x -
2.6T /celestia/bridge/.celestia-bridge
```
EXT4, no compression:
```
$ du -h ~/.celestia-bridge/
5.0T /home/ubuntu/.celestia-bridge/
```
:::

## Requirements:
1. Bare Metal server with decent amount of RAM (64GB+)
2. At least one empty disk (with no filesystem)

## Guide:

Get your disk name:
```sh
lsblk --nodeps -o name
```

Set variables:
```sh
ZFS_POOL_NAME="celestia" && ZFS_DATASET_NAME="bridge"
```

Install ZFS utils:
```sh
sudo apt update && sudo apt install zfsutils-linux
```

Create ZFS pool:
```sh
zpool create $ZFS_POOL_NAME /dev/nvme0n1
```

:::tip NOTE
If you have more than one disk available - you can add them also:
```sh
zpool create $ZFS_POOL_NAME /dev/nvme0n1 /dev/nvme1n1
```
:::

Create dataset:
```sh
zfs create $ZFS_POOL_NAME/$ZFS_DATASET_NAME
```

Enable compression:
```sh
zfs set compression=zstd-3 $ZFS_POOL_NAME/$ZFS_DATASET_NAME
```

Set the custom path to the bridge data folder:

::: code-group

```sh [Mainnet Beta]
# Add flag --node.store /celestia/bridge/.celestia-bridge to your command, example:
celestia bridge start --metrics.tls=true --metrics --metrics.endpoint otel.celestia.observer --p2p.metrics --node.store /celestia/bridge/.celestia-bridge
```

```sh [Mocha]
# Add flag --node.store /celestia/bridge/.celestia-bridge-mocha-4 to your command, example:
celestia bridge start --metrics.tls=true --metrics --metrics.endpoint otel.celestia-mocha.com --p2p.metrics --node.store /celestia/bridge/.celestia-bridge-mocha-4 --p2p.network mocha
```

```sh [Arabica]
# Add flag --node.store /celestia/bridge/.celestia-bridge-arabica-11 to your command, example:
celestia bridge start --node.store /celestia/bridge/.celestia-bridge-arabica-11 --p2p.network arabica
```

:::

:::tip NOTE
It is recommended to sync from scratch. In case of using a snapshot it is important to have your local route to `--data.store` identical to one in a snapshot.
:::

After completing the steps above, you can begin syncing your DA node.

You can check your compression rate with the following command:
```sh
zfs get compressratio $ZFS_POOL_NAME
```
Loading