-
Notifications
You must be signed in to change notification settings - Fork 7
PCSM-345 Make HTTP server bind host configurable #68
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
base: main
Are you sure you want to change the base?
Changes from all commits
8b35d53
fd44005
145c1e7
5f75bb2
5a22a28
bb4ba6f
1117edf
c614494
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |||||
| - `--clone-num-insert-workers`: Number of insert workers that write batches to the target. Shared for all collections. | ||||||
| - `--clone-segment-size`: Segment size for clone operations. Accepts plain bytes or a unit suffix (e.g. `500MB`, `1GiB`). When omitted, the tool automatically calculates segment size based on collection size and available read workers. | ||||||
| - `--use-collection-bulk-write`: Forces collection-level bulk write instead of the newer client-level bulk write (MongoDB 8.0+). | ||||||
|
|
||||||
| - `--listen-host`: Host the HTTP server binds to. See [Configure the http listen address](../install/start-pcsm.md#configure-the-http-listen-address). | ||||||
|
Check warning on line 17 in docs/install/parameters.md
|
||||||
|
|
||||||
| ??? example "Examples" | ||||||
|
|
||||||
|
|
@@ -46,4 +46,5 @@ | |||||
| | `PCSM_REPL_EVENT_QUEUE_SIZE` | Controls the size of the internal event queue used by the replication subsystem. | `5000` | | ||||||
| | `PCSM_REPL_WORKER_QUEUE_SIZE` | Defines the maximum number of replication events that each replication worker thread can queue before processing. | `5000` | | ||||||
| | `PCSM_REPL_BULK_OPS_SIZE` | Defines the maximum number of operations that can be grouped together into a single bulk apply batch during replication. | `5000` | | ||||||
| | `PCSM_LISTEN_HOST` | Host the HTTP server binds to. See [Configure the http listen address](../install/start-pcsm.md#configure-the-http-listen-address) | Localhost | | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,74 @@ | |
|
|
||
| See [Percona ClusterSync for MongoDB startup configuration](parameters.md) for all available options. | ||
|
|
||
| ## Configure the HTTP listen address | ||
|
|
||
| By default, the PCSM HTTP server listens on `localhost`, which keeps the control API and the profiling endpoints reachable only from the local host. Most deployments don't need to change this. | ||
|
Check notice on line 41 in docs/install/start-pcsm.md
|
||
|
|
||
| Containerized deployments are the exception. Kubernetes runs HTTP liveness and readiness probes against the pod IP, and Docker forwards published ports to the container IP rather than the container loopback address. A loopback-only listener refuses these connections; failed readiness probes mark the pod unready, while repeated failed liveness probes can restart it. | ||
|
Check notice on line 43 in docs/install/start-pcsm.md
|
||
|
|
||
| To make the server reachable through the pod IP, set the listen host to `0.0.0.0` for an IPv4 pod or `::` for an IPv6 pod: | ||
|
|
||
| ```{.bash data-prompt="$"} | ||
| $ PCSM_LISTEN_HOST=0.0.0.0 pcsm | ||
| ``` | ||
|
|
||
| For an IPv6 pod, use `::` instead: | ||
|
|
||
| ```{.bash data-prompt="$"} | ||
| $ PCSM_LISTEN_HOST=:: pcsm | ||
| ``` | ||
|
|
||
| Alternatively, use the `--listen-host` option: | ||
|
|
||
| ```{.bash data-prompt="$"} | ||
| $ pcsm --listen-host 0.0.0.0 | ||
| ``` | ||
|
|
||
| For an IPv6 pod: | ||
|
|
||
| ```{.bash data-prompt="$"} | ||
| $ pcsm --listen-host :: | ||
| ``` | ||
|
|
||
| You can also give an IP address or a DNS name. To listen on the IPv6 loopback address: | ||
|
Check notice on line 69 in docs/install/start-pcsm.md
|
||
|
|
||
| ```{.bash data-prompt="$"} | ||
| $ pcsm --listen-host ::1 | ||
| ``` | ||
|
|
||
| PCSM adds the brackets itself, so this binds to `[::1]:2242`. | ||
|
Check notice on line 75 in docs/install/start-pcsm.md
|
||
|
|
||
| ### What to pass | ||
|
|
||
| Give `--listen-host` a host and nothing else. The `--port` option sets the port, and defaults to `2242`. | ||
|
|
||
| A value that already contains a port is rejected, so `localhost:2242`, `127.0.0.1:2242`, and `[::1]:2242` all fail at startup. A DNS name is accepted without being resolved first, which means a name that can't be resolved isn't caught by validation. | ||
|
Check notice on line 81 in docs/install/start-pcsm.md
|
||
|
|
||
| Changing the bind host doesn't affect the CLI. Subcommands such as `pcsm status` always connect to `localhost`. | ||
|
|
||
| ### Check that it worked | ||
|
|
||
| From inside the container, confirm the server answers on the pod IP rather than only on loopback. For an IPv4 pod: | ||
|
|
||
| ```{.bash data-prompt="$"} | ||
| $ curl -s "http://$(hostname -i | awk '{for (i=1;i<=NF;i++) if ($i !~ /:/) {print $i; exit}}'):2242/status" | ||
| ``` | ||
|
|
||
| For an IPv6 pod, enclose the address in brackets: | ||
|
|
||
| ```{.bash data-prompt="$"} | ||
| $ curl -g -s "http://[$(hostname -i | awk '{for (i=1;i<=NF;i++) if ($i ~ /:/) {print $i; exit}}')]:2242/status" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ``` | ||
|
|
||
| A response means the bind address took effect. Connection refused means the server is still on loopback, so check that the environment variable or option reached the process. | ||
|
|
||
| !!! warning | ||
| Binding to `0.0.0.0` (IPv4) or `::` (IPv6) exposes the control endpoints `/start`, `/pause`, `/resume`, and `/finalize`, along with the `pprof` profiling endpoints, on every network interface of the host or pod. None of them require authentication, so anything that can route to the pod can start, pause, or finalize replication. | ||
|
Check notice on line 102 in docs/install/start-pcsm.md
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| In Kubernetes, restrict access with a `NetworkPolicy` or an equivalent network control. If all you need is a health check, an exec probe against `localhost` gives you the same result with no network exposure. | ||
|
|
||
| See [Percona ClusterSync for MongoDB startup configuration](parameters.md) for all available options, and [PCSM HTTP API](../api.md) for the endpoints themselves. | ||
|
Check notice on line 106 in docs/install/start-pcsm.md
|
||
|
|
||
| ## How to see {{pcsm.full_name}} logs | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.