Skip to content

Commit bfdcac3

Browse files
Leo Weesegitbook-bot
Leo Weese
authored andcommitted
GITBOOK-489: change request with no subject merged in GitBook
1 parent b382231 commit bfdcac3

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

lightning-network-tools/lnd/optimal-configuration-of-a-routing-node.md

+47
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,53 @@ Increasing the payments expiration grace period will allow for longer time to wa
8383

8484
`payments-expiration-grace-period=1h # (default: 0s)`
8585

86+
### Database configuration
87+
88+
LND requires a database to store information about transactions, invoices, channels, macaroons and all kinds of other information to operate safely. By default, LND runs with bbolt. In the future, SQLite will take over as the default. Both are embedded databases, meaning they do not need additional software or configuration, but work out of the box as part of LND and can be migrated easily.
89+
90+
LND Databases:
91+
92+
* bbolt\*
93+
* etcd\*
94+
* **SQLite**
95+
* **Postgres**
96+
97+
Backends marked with (\*) will be phased out with future versions. Migration scripts will be made available to help migrate data from legacy backends (bbolt/etcd) for the existing nodes.
98+
99+
Default:
100+
101+
`db.backend=bolt`
102+
103+
Alternative options:
104+
105+
`db.backend=etcd`
106+
107+
`db.backend=postgres`
108+
109+
`db.backend=sqlite`
110+
111+
LND users with SQLite or Postgres backends can enable a performance-enhancing "native SQL schema" via configuration. This option was available for new nodes since v0.18.0, and existing nodes can be configured to use it starting with v0.19.0.
112+
113+
`db.use-native-sql=true`
114+
115+
### Database migration
116+
117+
In the context of LND’s development path, database migrations have two components. First, the move backend from bbolt/etcd to SQLite/Postgres. Second, the move from kvdb to native SQL data structures.
118+
119+
#### Move backend
120+
121+
The switch to SQLite/Postgres is made possible with the lndinit [migration script](https://github.com/lightninglabs/lndinit/blob/migrate-db/docs/data-migration.md). This tool migrates LND bbolt databases to either SQLite or Postgres, preserving the key-value (kvdb) data structure. Use this tool if you are looking to migrate your LND backend from bbolt to SQLite.
122+
123+
**Caution**: Migrating to Postgres using this tool is currently not recommended. The key-value schema can lead to poor performance in Postgres, especially for older nodes with large amounts of Payment and Invoice data. Performance issues on Postgres will be addressed in future releases with additional data store migration to native SQL schema.
124+
125+
If you have migrated to Postgres and would like to optimize performance, have a look at [these config recommendations](https://gist.github.com/djkazic/526fa3e032aea9578997f88b45b91fb9).
126+
127+
#### Move to native SQL data structure
128+
129+
Starting with version 0.19, LND will perform automatic migrations from kvdb to native SQL for users on SQLite/Postgres backend. The migration process will create tables in the backend and move the data from the existing kv schema to the new tables at startup time.
130+
131+
To trigger this migration, simply set `db.use-native-sql=true` and restart your node. This migration can be abandoned by setting `db.skip-native-sql-migration=true` but this option should only be set if you are encountering errors during the migration process.
132+
86133
### Rebalancing
87134

88135
While rebalancing is not strictly necessary for a competitive routing node, it can be useful to push liquidity in or out of certain channels that way, especially when the potential earnings on that channel are higher than the cost to rebalance.

0 commit comments

Comments
 (0)