Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/install/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ Start the {{pcsm.short}} container. You can specify connection strings using env
$ docker run --name pcsm1 --network mymongo -d \
-e PCSM_SOURCE_URI="mongodb://source:password@psmdb-source:27017" \
-e PCSM_TARGET_URI="mongodb://target:password@psmdb-target:27017" \
-e PCSM_LISTEN_HOST=0.0.0.0 \
-p 2242:2242 \
percona/percona-clustersync-mongodb:latest \
--port 2242 \
Expand Down
3 changes: 2 additions & 1 deletion docs/install/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/parameters.md#L17

[Google.Colons] 'Host' should be in lowercase.
Raw output
{"message": "[Google.Colons] 'Host' should be in lowercase.", "location": {"path": "docs/install/parameters.md", "range": {"start": {"line": 17, "column": 20}}}, "severity": "WARNING"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `--listen-host`: Host the HTTP server binds to. See [Configure the http listen address](../install/start-pcsm.md#configure-the-http-listen-address).
- `--listen-host`: Host the HTTP server binds to. See [Configure the HTTP listen address](../install/start-pcsm.md#configure-the-http-listen-address).


??? example "Examples"

Expand Down Expand Up @@ -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 |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `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 |
| `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` |


68 changes: 68 additions & 0 deletions docs/install/start-pcsm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/start-pcsm.md#L41

[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.", "location": {"path": "docs/install/start-pcsm.md", "range": {"start": {"line": 41, "column": 17}}}, "severity": "INFO"}

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

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/start-pcsm.md#L43

[Google.Semicolons] Use semicolons judiciously.
Raw output
{"message": "[Google.Semicolons] Use semicolons judiciously.", "location": {"path": "docs/install/start-pcsm.md", "range": {"start": {"line": 43, "column": 267}}}, "severity": "INFO"}

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

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/start-pcsm.md#L69

[Google.Acronyms] Spell out 'DNS', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'DNS', if it's unfamiliar to the audience.", "location": {"path": "docs/install/start-pcsm.md", "range": {"start": {"line": 69, "column": 38}}}, "severity": "INFO"}

```{.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

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/start-pcsm.md#L75

[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.", "location": {"path": "docs/install/start-pcsm.md", "range": {"start": {"line": 75, "column": 1}}}, "severity": "INFO"}

### 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

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/start-pcsm.md#L81

[Google.Passive] In general, use active voice instead of passive voice ('is rejected').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is rejected').", "location": {"path": "docs/install/start-pcsm.md", "range": {"start": {"line": 81, "column": 38}}}, "severity": "INFO"}

Check notice on line 81 in docs/install/start-pcsm.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/start-pcsm.md#L81

[Google.Acronyms] Spell out 'DNS', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'DNS', if it's unfamiliar to the audience.", "location": {"path": "docs/install/start-pcsm.md", "range": {"start": {"line": 81, "column": 130}}}, "severity": "INFO"}

Check notice on line 81 in docs/install/start-pcsm.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/start-pcsm.md#L81

[Google.Passive] In general, use active voice instead of passive voice ('is accepted').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is accepted').", "location": {"path": "docs/install/start-pcsm.md", "range": {"start": {"line": 81, "column": 139}}}, "severity": "INFO"}

Check notice on line 81 in docs/install/start-pcsm.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/start-pcsm.md#L81

[Google.Passive] In general, use active voice instead of passive voice ('being resolved').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('being resolved').", "location": {"path": "docs/install/start-pcsm.md", "range": {"start": {"line": 81, "column": 159}}}, "severity": "INFO"}

Check notice on line 81 in docs/install/start-pcsm.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/start-pcsm.md#L81

[Google.Passive] In general, use active voice instead of passive voice ('be resolved').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('be resolved').", "location": {"path": "docs/install/start-pcsm.md", "range": {"start": {"line": 81, "column": 211}}}, "severity": "INFO"}

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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curl -s exits with no output when the connection is refused however the next paragraph tells the reader to look for that diagnostic. We should use the command with -sS flags in both examples so the error messages and status are actually visible.

```

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

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/start-pcsm.md#L102

[Google.Parens] Use parentheses judiciously.
Raw output
{"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/install/start-pcsm.md", "range": {"start": {"line": 102, "column": 26}}}, "severity": "INFO"}

Check notice on line 102 in docs/install/start-pcsm.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/start-pcsm.md#L102

[Google.Parens] Use parentheses judiciously.
Raw output
{"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/install/start-pcsm.md", "range": {"start": {"line": 102, "column": 41}}}, "severity": "INFO"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/status and /metrics are exposed also however the warning doesn't include those. Could we include all exposed endpoints please?


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

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/start-pcsm.md#L106

[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'PCSM', if it's unfamiliar to the audience.", "location": {"path": "docs/install/start-pcsm.md", "range": {"start": {"line": 106, "column": 108}}}, "severity": "INFO"}

## How to see {{pcsm.full_name}} logs

Expand Down
Loading