cockroachdb / cockroachdb/cockroach
clarify --advertise-http-addr and --advertise-sql-addr
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
CRDB has a family of advertise flags:
```
--advertise-addr [:]
The address/hostname and port to advertise to other CockroachDB nodes for
intra-cluster communication. It must resolve and be routable from other nodes
in the cluster.
If left unspecified, it defaults to the setting of --listen-addr. If the flag
is provided but either the address part or the port part is left unspecified,
that particular part defaults to the same part in --listen-addr.
An IPv6 address can also be specified with the notation [...], for example
[::1]:26257 or [fe80::f6f2:::]:26257.
The port number should be the same as in --listen-addr unless port forwarding
is set up on an intermediate firewall/router.
(default :)
--advertise-http-addr [:]
The HTTP address/hostname and port to advertise to nodes in the cluster for
reporting the DB Console address and proxying of HTTP connections. It must
resolve and be routable from other nodes in the cluster for proxying to work
in DB Console.
If left unspecified, it defaults to the host setting of --advertise-addr
and the port of --http-addr, which is 8080 by default. If advertise-addr is
left unspecified, it defaults to the setting of http-addr. If the flag is
unspecified as well as fallbacks, it defaults to the hostname as reported by
the OS.
An IPv6 address can also be specified with the notation [...], for example
[::1]:26257 or [fe80::f6f2:::]:26257.
The port number should be the same as in --http-addr unless port forwarding is
set up on an intermediate firewall/router.
(default :)
--advertise-sql-addr [:]
The SQL address/hostname and port to advertise to CLI admin utilities and via
SQL introspection for the purpose of SQL address discovery. It must resolve
and be routable from clients.
If left unspecified, it defaults to the setting of --sql-addr. If the flag
is provided but either the address part or the port part is left unspecified,
that particular part defaults to the same part in --sql-addr.
An IPv6 address can also be specified with the notation [...], for example
[::1]:26257 or [fe80::f6f2:::]:26257.
The port number should be the same as in --sql-addr unless port forwarding is
set up on an intermediate firewall/router.
(default :)
```
It is rare that --advertise-http-addr or --advertise-sql-addr should be set. Both flags are only useful if they route to a single node. The http-addr is used by dbconsole to serve requests like per-node pprof data. The advertise-sql-addr is used by PRC/LDR to dial specific nodes for replication.
If a cluster has a load balancer, that should not be used as the value for either of these advertise flags. External clients can connect through the load balancer without the nodes needing to be configured to know about them.
Some additional context is in: https://cockroachlabs.slack.com/archives/CHVV403F0/p1776938805802789.
Jira issue: CRDB-63206
Contributor guide
Assessment
This issue has not been assessed yet.