mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-25 14:15:50 +00:00
Online deletion: simpler tutorial
This commit is contained in:
@@ -0,0 +1,96 @@
|
|||||||
|
# Configure Advisory Deletion
|
||||||
|
|
||||||
|
In its default configuration, the `rippled` server automatically deletes outdated history of XRP Ledger state and transactions as new ledger versions become available. If your server uses most of its hardware resources during peak hours, you can configure the server to delete ledgers only when prompted by a command scheduled to run during off-peak hours to reduce the chances of online deletion
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
This tutorial assumes your server meets the following prerequisites:
|
||||||
|
|
||||||
|
- You are on a supported operating system: Ubuntu Linux, Red Hat Enterprise Linux (RHEL), or CentOS.
|
||||||
|
|
||||||
|
- The `rippled` server is already [installed](install-rippled.html) and [online deletion](online-deletion.html) is enabled.
|
||||||
|
|
||||||
|
The default configuration file enables online deletion after 2000 ledger versions.
|
||||||
|
|
||||||
|
- A `cron` daemon is installed and running.
|
||||||
|
|
||||||
|
Ubuntu Linux runs a `cron` daemon by default.
|
||||||
|
|
||||||
|
On RHEL or CentOS, you can install the `cronie` package:
|
||||||
|
|
||||||
|
$ sudo yum install cronie
|
||||||
|
|
||||||
|
- Your server has enough disk space to store your chosen amount of history in its ledger store.
|
||||||
|
|
||||||
|
See [Capacity Planning](capacity-planning.html) for details of how much storage is required for different configuration. With advisory deletion enabled, the maximum history a server may accumulate before deletion is equal to the number of ledger versions configured in the `online_delete` setting **plus** the amount of time between online deletion prompts.
|
||||||
|
|
||||||
|
- You know which hours are least busy for your server.
|
||||||
|
|
||||||
|
## Configuration Steps
|
||||||
|
|
||||||
|
To configure advisory deletion with a daily schedule, perform the following steps:
|
||||||
|
|
||||||
|
1. Enable `advisory_delete` in the `[node_db]` stanza of your `rippled`'s config file.
|
||||||
|
|
||||||
|
[node_db]
|
||||||
|
# Other settings unchanged ...
|
||||||
|
online_delete=2000
|
||||||
|
advisory_delete=1
|
||||||
|
|
||||||
|
- Set `advisory_delete` to `1` to require approval before running online deletion. (Set it to `0` to run online deletion automatically as new ledger versions become available.)
|
||||||
|
- Set `online_delete` to the minimum number of ledger versions to keep after running online deletion. The server accumulates more history than this until online deletion runs.
|
||||||
|
|
||||||
|
{% include '_snippets/conf-file-location.md' %}<!--_ -->
|
||||||
|
|
||||||
|
2. Test running the [can_delete method][] to prompt the server to run online deletion.
|
||||||
|
|
||||||
|
You can use the [`rippled` commandline interface](get-started-with-the-rippled-api.html#commandline) to run this command. For example:
|
||||||
|
|
||||||
|
$ rippled --conf=/etc/opt/ripple/rippled.cfg can_delete now
|
||||||
|
|
||||||
|
The response indicates the maximum ledger index that may the server may delete from its ledger store. For example, the following message indicates that ledger versions up to and including ledger index 43633667 are to be deleted:
|
||||||
|
|
||||||
|
{
|
||||||
|
"result": {
|
||||||
|
"can_delete": 43633667,
|
||||||
|
"status": "success"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
3. Configure your `cron` daemon to run the `can_delete` method you tested in the previous step at a scheduled time.
|
||||||
|
|
||||||
|
Edit your `cron` configuration:
|
||||||
|
|
||||||
|
$ crontab -e
|
||||||
|
|
||||||
|
The following example sets the server to run deletion at 1:05 AM server time daily:
|
||||||
|
|
||||||
|
5 1 * * * rippled --conf /etc/opt/ripple/rippled.cfg can_delete now
|
||||||
|
|
||||||
|
Be sure that you schedule the command to run based on the time zone your server's clock is configured to use. Ripple recommends running all production servers with the UTC time zone.
|
||||||
|
|
||||||
|
**Tip:** You do not need to schedule a `cron` job to run online deletion if you have `advisory_delete` disabled. In that case, `rippled` runs online deletion automatically when the server's oldest available ledger is twice as old as the number of ledgers to keep after deletion.
|
||||||
|
|
||||||
|
4. Start (or restart) the `rippled` service.
|
||||||
|
|
||||||
|
$ sudo systemctl restart rippled
|
||||||
|
|
||||||
|
5. Periodically check your server's `complete_ledgers` range using the [server_info method][] to confirm that ledgers are being deleted as scheduled.
|
||||||
|
|
||||||
|
The lowest ledger index in `complete_ledgers` should increase after online deletion.
|
||||||
|
|
||||||
|
Deletion may take several minutes to complete when it runs, depending on how busy your server is and how much history you delete at a time.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
If online deletion does not seem to be running after configuring it, try the following:
|
||||||
|
|
||||||
|
- Check that the user who configured the `cron` job has permissions to run the `rippled` server as a commandline client.
|
||||||
|
- Check the syntax of your cron job and the time when it is supposed to run.
|
||||||
|
- Check that the `rippled` executable is available at the path specified in your `cron` configuration. If necessary, specify the absolute path to the executable, such as `/opt/ripple/bin/rippled`.
|
||||||
|
- Check your `rippled` logs for messages that begin with `SHAMapStore::WRN`. This can indicate that [online deletion is being interrupted](online-deletion.html#interrupting-online-deletion) because your server fell out of sync with the network.
|
||||||
|
|
||||||
|
<!--{# common link defs #}-->
|
||||||
|
{% include '_snippets/rippled-api-links.md' %}
|
||||||
|
{% include '_snippets/tx-type-links.md' %}
|
||||||
|
{% include '_snippets/rippled_versions.md' %}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Configure Online Deletion with Advisory Delete
|
# Configure Online Deletion
|
||||||
|
|
||||||
In its default configuration, the `rippled` server automatically deletes outdated history of XRP Ledger state and transactions as new ledger versions become available. If your server uses most of its hardware resources during peak hours, you can configure the server to delete ledgers only when prompted by a command scheduled to run during off-peak hours to reduce the chances of online deletion
|
In its default configuration, the `rippled` server [deletes history](online-deletion.html) older than the most recent 2000 ledger versions, keeping approximately 15 minutes of ledger history (based on the current rate between ledgers). This page describes how to configure the amount of history your `rippled` server stores before deleting.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
@@ -10,85 +10,64 @@ This tutorial assumes your server meets the following prerequisites:
|
|||||||
|
|
||||||
- The `rippled` server is already [installed](install-rippled.html) and [online deletion](online-deletion.html) is enabled.
|
- The `rippled` server is already [installed](install-rippled.html) and [online deletion](online-deletion.html) is enabled.
|
||||||
|
|
||||||
The default configuration file enables online deletion after
|
If you followed the installation instructions for a recommended platform, online deletion is enabled by default.
|
||||||
|
|
||||||
- A `cron` daemon is installed and running.
|
- Your server has [enough disk space](capacity-planning.html) to store your chosen amount of history in its ledger store.
|
||||||
|
|
||||||
Ubuntu Linux runs a `cron` daemon by default.
|
|
||||||
|
|
||||||
On RHEL or CentOS, you can install the `cronie` package:
|
|
||||||
|
|
||||||
$ sudo yum install cronie
|
|
||||||
|
|
||||||
- Your server has enough disk space to store your chosen amount of history in its ledger store.
|
|
||||||
|
|
||||||
See [Capacity Planning](capacity-planning.html) for details of how much storage is required for different configuration. With advisory deletion enabled, the maximum history a server may accumulate before deletion is equal to the number of ledger versions configured in the `online_delete` setting **plus** the amount of time between online deletion prompts.
|
|
||||||
|
|
||||||
- You know which hours are least busy for your server.
|
|
||||||
|
|
||||||
## Configuration Steps
|
## Configuration Steps
|
||||||
|
|
||||||
To configure advisory deletion with a daily schedule, perform the following steps:
|
To change the amount of history your server stores, perform the following steps:
|
||||||
|
|
||||||
1. Enable `advisory_delete` in the `[node_db]` stanza of your `rippled`'s config file.
|
1. Decide how many ledger versions' worth of history to store.
|
||||||
|
|
||||||
|
New ledger versions are usually validated 3 to 4 seconds apart, so the number of ledger versions corresponds roughly to the amount of time you want to store. See [Capacity Planning](capacity-planning.html) for details of how much storage is required for different configuration.
|
||||||
|
|
||||||
|
Online deletion is based on how many ledger versions to keep _after_ deleting history, so you should have enough disk space to store twice as many ledgers as you set it to keep.
|
||||||
|
|
||||||
|
0. In your `rippled`'s config file, edit the `online_delete` field of the `[node_db]` stanza.
|
||||||
|
|
||||||
[node_db]
|
[node_db]
|
||||||
# Other settings unchanged ...
|
# Other settings unchanged ...
|
||||||
online_delete=2000
|
online_delete=2000
|
||||||
advisory_delete=1
|
advisory_delete=0
|
||||||
|
|
||||||
- Set `advisory_delete` to `1` to require approval before running online deletion. (Set it to `0` to run online deletion automatically as new ledger versions become available.)
|
Set `online_delete` to the minimum number of ledger versions to keep after running online deletion. With automatic deletion (the default), the server typically runs deletion when it has accumulated about twice this many ledger versions.
|
||||||
- Set `online_delete` to the minimum number of ledger versions to keep after running online deletion. The server accumulates more history than this until online deletion runs.
|
|
||||||
|
|
||||||
{% include '_snippets/conf-file-location.md' %}<!--_ -->
|
{% include '_snippets/conf-file-location.md' %}<!--_ -->
|
||||||
|
|
||||||
2. Test running the [can_delete method][] to prompt the server to run online deletion.
|
0. Start (or restart) the `rippled` service.
|
||||||
|
|
||||||
You can use the [`rippled` commandline interface](get-started-with-the-rippled-api.html#commandline) to run this command. For example:
|
|
||||||
|
|
||||||
$ rippled --conf=/etc/opt/ripple/rippled.cfg can_delete now
|
|
||||||
|
|
||||||
The response indicates the maximum ledger index that may the server may delete from its ledger store. For example, the following message indicates that ledger versions up to and including ledger index 43633667 are to be deleted:
|
|
||||||
|
|
||||||
{
|
|
||||||
"result": {
|
|
||||||
"can_delete": 43633667,
|
|
||||||
"status": "success"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
3. Configure your `cron` daemon to run the `can_delete` method you tested in the previous step at a scheduled time.
|
|
||||||
|
|
||||||
Edit your `cron` configuration:
|
|
||||||
|
|
||||||
$ crontab -e
|
|
||||||
|
|
||||||
The following example sets the server to run deletion at 1:05 AM server time daily:
|
|
||||||
|
|
||||||
5 1 * * * rippled --conf /etc/opt/ripple/rippled.cfg can_delete now
|
|
||||||
|
|
||||||
Be sure that you schedule the command to run based on the time zone your server's clock is configured to use. Ripple recommends running all production servers with the UTC time zone.
|
|
||||||
|
|
||||||
**Tip:** You do not need to schedule a `cron` job to run online deletion if you have `advisory_delete` disabled. In that case, `rippled` runs online deletion automatically when the server's oldest available ledger is twice as old as the number of ledgers to keep after deletion.
|
|
||||||
|
|
||||||
4. Start (or restart) the `rippled` service.
|
|
||||||
|
|
||||||
$ sudo systemctl restart rippled
|
$ sudo systemctl restart rippled
|
||||||
|
|
||||||
5. Periodically check your server's `complete_ledgers` range using the [server_info method][] to confirm that ledgers are being deleted as scheduled.
|
0. Wait for your server to sync to the network.
|
||||||
|
|
||||||
The lowest ledger index in `complete_ledgers` should increase after online deletion.
|
Depending on your network and system capabilities and how long your server was offline, it may take between 5 and 15 minutes to fully sync.
|
||||||
|
|
||||||
Deletion may take several minutes to complete when it runs, depending on how busy your server is and how much history you delete at a time.
|
When your server is synced with the network, the [server_info method][] reports a `server_state` value of `"full"`, `"proposing"`, or `"validating"`.
|
||||||
|
|
||||||
## Troubleshooting
|
0. Periodically check your server's `complete_ledgers` range using the [server_info method][] to confirm that ledgers are being deleted.
|
||||||
|
|
||||||
If online deletion does not seem to be running after configuring it, try the following:
|
After online deletion runs, the `complete_ledgers` range reflects that older ledgers are no longer available. As your server accumulates history, the total number of ledgers available should slowly increase to twice the `online_delete` value you configured, then decrease when online deletion runs.
|
||||||
|
|
||||||
|
0. Monitor your `rippled` logs for messages that begin with `SHAMapStore::WRN`. This can indicate that [online deletion is being interrupted](online-deletion.html#interrupting-online-deletion) because your server fell out of sync with the network.
|
||||||
|
|
||||||
|
If this happens regularly, your server may not have sufficient specifications to keep up with the ledger while running online deletion. Check that other services on the same hardware (such as scheduled backups or security scans) aren't competing with the `rippled` server for resources. You may want to try any of the following:
|
||||||
|
|
||||||
|
- Increase your system specs. See [System Requirements](system-requirements.html) for recommendations.
|
||||||
|
- Change your configuration to store less history. (Step 2 of this tutorial)
|
||||||
|
- Change your server's [`node_size` parameter](capacity-planning.html).
|
||||||
|
- Use [NuDB instead of RocksDB](capacity-planning.html) for the ledger store.
|
||||||
|
- [Schedule online deletion using Advisory Deletion](configure-advisory-deletion.html).
|
||||||
|
|
||||||
|
|
||||||
|
## See Also
|
||||||
|
|
||||||
|
- [Online Deletion](online-deletion.html)
|
||||||
|
- [Configure Advisory Deletion](configure-advisory-deletion.html)
|
||||||
|
- [Configure History Sharding](configure-history-sharding.html)
|
||||||
|
- [Configure Full History](configure-full-history.html)
|
||||||
|
|
||||||
- Check that the user who configured the `cron` job has permissions to run the `rippled` server as a commandline client.
|
|
||||||
- Check the syntax of your cron job and the time when it is supposed to run.
|
|
||||||
- Check that the `rippled` executable is available at the path specified in your `cron` configuration. If necessary, specify the absolute path to the executable, such as `/opt/ripple/bin/rippled`.
|
|
||||||
- Check your `rippled` logs for messages that begin with `SHAMapStore::WRN`. This can indicate that [online deletion is being interrupted](online-deletion.html#interrupting-online-deletion) because your server fell out of sync with the network.
|
|
||||||
|
|
||||||
<!--{# common link defs #}-->
|
<!--{# common link defs #}-->
|
||||||
{% include '_snippets/rippled-api-links.md' %}
|
{% include '_snippets/rippled-api-links.md' %}
|
||||||
|
|||||||
@@ -1030,6 +1030,26 @@ pages:
|
|||||||
targets:
|
targets:
|
||||||
- local
|
- local
|
||||||
|
|
||||||
|
- md: tutorials/manage-the-rippled-server/configuration/configure-online-deletion.md
|
||||||
|
html: configure-online-deletion.html
|
||||||
|
funnel: Docs
|
||||||
|
doc_type: Tutorials
|
||||||
|
category: Manage the rippled Server
|
||||||
|
subcategory: Configuration
|
||||||
|
blurb: Configure how far back your server should store transaction history.
|
||||||
|
targets:
|
||||||
|
- local
|
||||||
|
|
||||||
|
- md: tutorials/manage-the-rippled-server/configuration/configure-advisory-deletion.md
|
||||||
|
html: configure-advisory-deletion.html
|
||||||
|
funnel: Docs
|
||||||
|
doc_type: Tutorials
|
||||||
|
category: Manage the rippled Server
|
||||||
|
subcategory: Configuration
|
||||||
|
blurb: Use advisory deletion to delete older ledger history on a schedule rather than as new history becomes available.
|
||||||
|
targets:
|
||||||
|
- local
|
||||||
|
|
||||||
- md: tutorials/manage-the-rippled-server/configuration/configure-history-sharding.md
|
- md: tutorials/manage-the-rippled-server/configuration/configure-history-sharding.md
|
||||||
html: configure-history-sharding.html
|
html: configure-history-sharding.html
|
||||||
funnel: Docs
|
funnel: Docs
|
||||||
@@ -1040,16 +1060,6 @@ pages:
|
|||||||
targets:
|
targets:
|
||||||
- local
|
- local
|
||||||
|
|
||||||
- md: tutorials/manage-the-rippled-server/configuration/configure-online-deletion.md
|
|
||||||
html: configure-online-deletion.html
|
|
||||||
funnel: Docs
|
|
||||||
doc_type: Tutorials
|
|
||||||
category: Manage the rippled Server
|
|
||||||
subcategory: Configuration
|
|
||||||
blurb: Use advisory deletion to delete older ledger history on a schedule rather than as new history becomes available.
|
|
||||||
targets:
|
|
||||||
- local
|
|
||||||
|
|
||||||
- md: tutorials/manage-the-rippled-server/configuration/configure-full-history.md
|
- md: tutorials/manage-the-rippled-server/configuration/configure-full-history.md
|
||||||
html: configure-full-history.html
|
html: configure-full-history.html
|
||||||
funnel: Docs
|
funnel: Docs
|
||||||
|
|||||||
Reference in New Issue
Block a user