Skip to content

Commit 16d80f5

Browse files
authored
Merge pull request #8845 from bitbandi/multiple-etcd-host
Allow multiple etcd host
2 parents 72a36da + 6043ced commit 16d80f5

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

docs/release-notes/release-notes-0.18.3.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ commitment when the channel was force closed.
8787
* Commitment fees are now taken into account when [calculating the fee
8888
exposure threshold](https://github.com/lightningnetwork/lnd/pull/8824).
8989

90+
* [Allow](https://github.com/lightningnetwork/lnd/pull/8845) multiple etcd hosts
91+
to be specified in db.etcd.host.
92+
9093
## RPC Updates
9194

9295
* [`xImportMissionControl`](https://github.com/lightningnetwork/lnd/pull/8779)

kvdb/etcd/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type Config struct {
1414

1515
EmbeddedLogFile string `long:"embedded_log_file" description:"Optional log file to use for embedded instance logs. note: use for testing only."`
1616

17-
Host string `long:"host" description:"Etcd database host."`
17+
Host string `long:"host" description:"Etcd database host. Supports multiple hosts separated by a comma."`
1818

1919
User string `long:"user" description:"Etcd database user."`
2020

kvdb/etcd/db.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"fmt"
99
"io"
1010
"runtime"
11+
"strings"
1112
"sync"
1213
"time"
1314

@@ -138,7 +139,7 @@ func NewEtcdClient(ctx context.Context, cfg Config) (*clientv3.Client,
138139
context.Context, func(), error) {
139140

140141
clientCfg := clientv3.Config{
141-
Endpoints: []string{cfg.Host},
142+
Endpoints: strings.Split(cfg.Host, ","),
142143
DialTimeout: etcdConnectionTimeout,
143144
Username: cfg.User,
144145
Password: cfg.Pass,

kvdb/etcd/fixture.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package etcd
55

66
import (
77
"context"
8+
"strings"
89
"testing"
910
"time"
1011

@@ -49,7 +50,7 @@ func NewEtcdTestFixture(t *testing.T) *EtcdTestFixture {
4950
t.Cleanup(etcdCleanup)
5051

5152
cli, err := clientv3.New(clientv3.Config{
52-
Endpoints: []string{config.Host},
53+
Endpoints: strings.Split(config.Host, ","),
5354
Username: config.User,
5455
Password: config.Pass,
5556
})

sample-lnd.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@
13741374

13751375
[etcd]
13761376

1377-
; Etcd database host.
1377+
; Etcd database host. Supports multiple hosts separated by a comma.
13781378
; Default:
13791379
; db.etcd.host=
13801380
; Example:

0 commit comments

Comments
 (0)