diff --git a/.github/workflows/docs-pages.yaml b/.github/workflows/docs-pages.yaml deleted file mode 100644 index cac98410755..00000000000 --- a/.github/workflows/docs-pages.yaml +++ /dev/null @@ -1,46 +0,0 @@ -name: "Docs / Publish" -# For more information, -# see https://sphinx-theme.scylladb.com/stable/deployment/production.html#available-workflows - -on: - push: - branches: - - scylla-3.x - - 'scylla-**' - paths: - - 'docs/**' - - 'faq/**' - - 'manual/**' - - 'changelog/**' - - 'upgrade_guide/**' - workflow_dispatch: - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.repository.default_branch }} - persist-credentials: false - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Set up JDK 8.0 - uses: actions/setup-java@v4 - with: - java-version: '8' - distribution: 'temurin' - - name: Set up env - run: make -C docs setupenv - - name: Build redirects - run: make -C docs redirects - - name: Build docs - run: make -C docs multiversion - - name: Deploy docs to GitHub Pages - run: ./docs/_utils/deploy.sh - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/docs-pages.yml b/.github/workflows/docs-pages.yml new file mode 100644 index 00000000000..f379caeeb73 --- /dev/null +++ b/.github/workflows/docs-pages.yml @@ -0,0 +1,83 @@ +name: "Docs / Publish" +# For more information, +# see https://sphinx-theme.scylladb.com/stable/deployment/production.html#available-workflows + +on: + push: + branches: + - scylla-4.x + - 'scylla-**' + paths: + - 'docs/**' + - 'faq/**' + - 'manual/**' + - 'changelog/**' + - 'upgrade_guide/**' + workflow_dispatch: + +jobs: + release: + permissions: + contents: write + runs-on: ubuntu-latest + concurrency: + group: single + cancel-in-progress: true + + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ github.event.repository.default_branch }} + persist-credentials: false + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + with: + python-version: '3.13' + + - name: Set up JDK 8 and 11 + uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 + with: + java-version: | + 8 + 11 + distribution: 'temurin' + + - name: Install uv + uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 + + - name: Set up env + run: make -C docs setupenv + + - name: Build redirects + run: make -C docs redirects + + - name: Build docs + run: make -C docs multiversion + + # deploy.sh rebuilds gh-pages from this run's output and force-pushes, so a + # version that built no api/ has its live one deleted rather than left stale. + # Record that before deploying and fail the job after, so the versions that did + # build still publish while the loss is still loud. A total loss stops here + # instead: there would be nothing left to publish. + - name: Check javadoc output + id: javadoc-check + run: ./docs/_utils/check-javadoc-output.sh + + - name: Deploy docs to GitHub Pages + run: ./docs/_utils/deploy.sh + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Fail if any version lost content + if: steps.javadoc-check.outputs.not-built != '' || steps.javadoc-check.outputs.missing-api != '' + env: + NOT_BUILT: ${{ steps.javadoc-check.outputs.not-built }} + MISSING_API: ${{ steps.javadoc-check.outputs.missing-api }} + run: | + # A version that never built is gone from the site entirely, which is a + # different loss from one that published without its javadoc. + [ -z "$NOT_BUILT" ] || echo "::error::Not built, now removed from the site entirely: $NOT_BUILT" + [ -z "$MISSING_API" ] || echo "::error::Published without javadoc, their /api/ is now gone from the site: $MISSING_API" + exit 1 diff --git a/manual/core/README.md b/manual/core/README.md index f7e26b4d165..5b9f067d494 100644 --- a/manual/core/README.md +++ b/manual/core/README.md @@ -361,6 +361,7 @@ for (ColumnDefinitions.Definition definition : row.getColumnDefinitions()) { authentication/* bom/* compression/* + connectivity/* configuration/* control_connection/* custom_codecs/* diff --git a/manual/core/connectivity/README.md b/manual/core/connectivity/README.md new file mode 100644 index 00000000000..5b759827de1 --- /dev/null +++ b/manual/core/connectivity/README.md @@ -0,0 +1,66 @@ + + +## Connectivity + +### Quick overview + +How the driver reaches the nodes of a cluster, and what each kind of network needs configured. + +* contact points and a local datacenter, and nothing else, when every node is reachable at the + address it broadcasts -- VPC peering, AWS Transit Gateway, or a direct connection over the + public internet. +* a cloud private endpoint that publishes per-node routes needs client routes, which this version + does not have: they are first available in driver 4.19.0.7, see [client routes](client_routes/). +* `advanced.address-translator` for anything else, see + [address resolution](../address_resolution/#driver-side-address-translation). + +----- + +A `CqlSession` starts from the contact points you give it, discovers the rest of the cluster from +`system.peers`, and then opens connections to each node at the address that node broadcasts. Whether +that last step works is a property of your network, not of the driver, and it is what the pages in +this section are about. + +| How your application reaches the cluster | What the driver needs | +|---|---| +| [VPC peering, Transit Gateway or a direct connection](vpc_peering/) -- every node is reachable at the address it broadcasts | contact points and a local datacenter, nothing else | +| [A cloud private endpoint that publishes a per-node entry in `system.client_routes`](client_routes/) -- AWS PrivateLink, Azure Private Link, GCP Private Service Connect | client routes, which need driver 4.19.0.7 or later | +| A proxy in front of the cluster -- one hostname for every node (a single-endpoint PrivateLink included), or EC2 multi-region | an [address translator](../address_resolution/#driver-side-address-translation) | + +A cloud private endpoint appears in two of those rows, and the difference is what the cluster +publishes: a per-node endpoint mapping the driver can read means client routes, while one hostname +standing in front of every node means an address translator. The translator has to give each node +its own address and port: nodes translated to the same one share a single endpoint, so the proxy +rather than the driver picks the node, and token-aware and shard-aware routing stop working. +`FixedHostNameAddressTranslator` keeps each node's port, which on ScyllaDB is the same for every +node, so it does not meet this on its own. + +Two things are the same in every case and are covered elsewhere: +[SSL](../ssl/) for encrypting the traffic, and [authentication](../authentication/) for proving who +you are. Contact points themselves are covered in the [core manual](../#contact-points). + +```eval_rst +.. toctree:: + :hidden: + :glob: + + vpc_peering/* + client_routes/* +``` diff --git a/manual/core/connectivity/client_routes/README.md b/manual/core/connectivity/client_routes/README.md new file mode 100644 index 00000000000..feb24a84f5a --- /dev/null +++ b/manual/core/connectivity/client_routes/README.md @@ -0,0 +1,48 @@ + + +## Client routes (private networking) + +### Quick overview + +Client routes are **not available in driver 4.18.x**. They were first released in 4.19.0.7. + +* upgrade to 4.19.0.7 or later to connect through a cloud private endpoint that publishes per-node + routes; the feature also needs ScyllaDB Enterprise 2026.1 or later. +* see the + [client routes documentation](https://java-driver.docs.scylladb.com/stable/manual/core/connectivity/client_routes/) + of the latest driver. + +----- + +Client routes are how driver 4.19.0.7 and later connects through a **private service connection**: +AWS **PrivateLink** (**PL**), Azure **Private Link**, or GCP **Private Service Connect** (**PSC**). +Those are the provider services in front of the cluster, not names of a driver feature. After the +table it reads, the feature itself is also written as `client_routes` or `clientroutes`. + +With client routes, the cluster publishes a per-node endpoint mapping in `system.client_routes`, +and the driver connects to each node through the hostname it finds there instead of through the +address the node broadcasts. 4.18.x neither reads that table nor handles the `CLIENT_ROUTES_CHANGE` +events that keep the mapping current. + +A custom [address translator](../../address_resolution/#driver-side-address-translation) is not a +substitute: it maps one address to another, while client routes key each node on its `host_id` and +follow the cluster as the mapping changes. An address translator remains the right tool for a proxy +in front of the cluster -- one hostname for every node, or EC2 multi-region -- provided each node +translates to its own address and port. diff --git a/manual/core/connectivity/vpc_peering/README.md b/manual/core/connectivity/vpc_peering/README.md new file mode 100644 index 00000000000..50ed1f2332e --- /dev/null +++ b/manual/core/connectivity/vpc_peering/README.md @@ -0,0 +1,169 @@ + + +## VPC peering, Transit Gateway and direct connections + +### Quick overview + +The common case: every node is reachable at the address it broadcasts, so the driver needs no +address translation at all. + +* contact points and `withLocalDatacenter` are the whole of the connectivity configuration. +* covers VPC peering, AWS Transit Gateway and direct connections over the public internet. +* leave `advanced.address-translator` unset -- see + [when the broadcast addresses are not reachable](#when-the-broadcast-addresses-are-not-reachable) + if the nodes are *not* reachable at their broadcast addresses. + +----- + +ScyllaDB Cloud offers three ways to put your application on a network that can route to the cluster. +They differ in how the packets travel, not in what the driver does: in all three the node addresses +in `system.peers` are addresses your application can open a socket to, which is what the driver +assumes by default. + +Setting any of them up is a cluster-side operation, documented under +[Network Access Options](https://cloud.docs.scylladb.com/stable/cluster-connections/connectivity-options.html) +in the ScyllaDB Cloud manual. This page covers only what it means for the driver. + +### VPC peering + +A private link between your VPC and the cluster's VPC, within one cloud provider. Traffic never +leaves the provider's network. Available on +[AWS](https://cloud.docs.scylladb.com/stable/cluster-connections/vpc-peering/aws-vpc-peering.html) +and +[GCP](https://cloud.docs.scylladb.com/stable/cluster-connections/vpc-peering/gcp-vpc-peering.html). + +Two constraints are worth knowing before you plan an application around it: peering has to be +enabled when the cluster is created and cannot be added afterwards, and your VPC's CIDR must not +overlap the cluster's. + +### AWS Transit Gateway + +A [TGW VPC attachment](https://cloud.docs.scylladb.com/stable/cluster-connections/aws-tgw-vpc-attachment.html) +connects a cluster datacenter to a Transit Gateway in your AWS account, so several VPCs or accounts +reach one cluster through a single hub. Choose it over peering when more than one VPC needs the +cluster, or when your topology already has a Transit Gateway. + +### Direct connection over the public internet + +Clusters are reachable on the public internet by default, with access limited to the addresses on +the cluster's allowlist. It needs no network setup, which makes it the right choice for local +development and for evaluating a trial cluster, and the wrong one for production traffic. + +Two things matter more here than on a private network: configure [SSL](../../ssl/), and remember +that ScyllaDB Cloud hands you node *hostnames* rather than addresses. A contact point added with +`createUnresolved` is looked up again every time the driver connects to it, and only the first +address the lookup returns is tried, so give the session every hostname from the connect page +rather than just one. + +### Connecting + +There is nothing connectivity-specific to configure. The example below connects to 9142, the TLS +port, so it also configures TLS; on VPC peering or Transit Gateway, 9042 accepts unencrypted +connections unless the cluster enforces encryption. The cluster certificate is signed by a +per-cluster CA, not a public one, so first download it from the cluster's details page ("Download CA +public key") and import it into a truststore: + +``` +keytool -import -v -trustcacerts -alias CARoot -file scylladb_cluster_ca.pem \ + -keystore client.truststore -storepass 'password123' +``` + +Choose your own store password; the driver needs the same one to open the truststore. Keep it in +single quotes on the command line, and in double quotes in `application.conf`, where an unquoted `#` +starts a comment. Then give the session the contact points from your cluster's connect page, the +truststore, the local datacenter and your credentials: + +```java +CqlSession session = CqlSession.builder() + .addContactPoint(InetSocketAddress.createUnresolved( + "node-0.aws-eu-west-1.example.clusters.scylla.cloud", 9142)) + .addContactPoint(InetSocketAddress.createUnresolved( + "node-1.aws-eu-west-1.example.clusters.scylla.cloud", 9142)) + .addContactPoint(InetSocketAddress.createUnresolved( + "node-2.aws-eu-west-1.example.clusters.scylla.cloud", 9142)) + .withConfigLoader(DriverConfigLoader.programmaticBuilder() + .withString(DefaultDriverOption.SSL_ENGINE_FACTORY_CLASS, "DefaultSslEngineFactory") + .withString(DefaultDriverOption.SSL_TRUSTSTORE_PATH, "/path/to/client.truststore") + .withString(DefaultDriverOption.SSL_TRUSTSTORE_PASSWORD, "password123") + .build()) + .withLocalDatacenter("AWS_EU_WEST_1") + .withAuthCredentials("scylla", "...") + .build(); +``` + +`createUnresolved` is what keeps the contact point a name: the driver looks it up again every time +it connects to that node, so a hostname that later points somewhere else is followed. +`new InetSocketAddress(host, port)` resolves on construction, so the contact point is fixed to +whatever that one lookup returned. Contact points given in the configuration are resolved once, +when the session is built, and every address a name returns becomes a contact point, unless +`advanced.resolve-contact-points` is `false`, which keeps them names -- see the +[reference configuration](../../configuration/reference/). + +The same TLS settings can live in `application.conf` instead of code: + +``` +datastax-java-driver.advanced.ssl-engine-factory { + class = DefaultSslEngineFactory + truststore-path = /path/to/client.truststore + truststore-password = "password123" +} +``` + +In 4.18.1, a session with a truststore but no keystore logs an `Error while closing` warning for +its `JdkSslHandlerFactory`, with a `NullPointerException`, when it closes. The warning is harmless, +and driver 4.19.0 no longer logs it. + +[SSL](../../ssl/) covers truststores, hostname validation and client certificates. + +The datacenter name has to match the cluster's exactly; it is shown on the cluster page. Getting it +wrong does *not* fail the build: the driver logs `You specified ... as the local DC, but some contact +points are from a different DC`, carries on, and then has no node it is willing to route to, so +every request fails with `NoNodeAvailableException`. See [load balancing](../../load_balancing/) for +what the local datacenter controls. + +### When the broadcast addresses are not reachable + +If connections to the contact points succeed but every other node is unreachable, the cluster is +broadcasting addresses your network cannot route to. That is a different deployment shape: + +* the cluster is behind a cloud private endpoint and publishes a per-node endpoint mapping -- AWS + PrivateLink, Azure Private Link or GCP Private Service Connect: that needs + [client routes](../client_routes/), which this version does not have; +* everything else -- one proxy hostname for the whole cluster, or EC2 multi-region: use an + [address translator](../../address_resolution/#driver-side-address-translation) that gives each + node its own address and port. + +Two queries separate the two. The first shows the addresses the driver is being handed, and needs +both halves because `system.peers` never lists the node you are connected to: + +``` +cqlsh> select peer, rpc_address from system.peers; +cqlsh> select rpc_address from system.local; +``` + +`rpc_address` is the one clients connect to; `peer` is the address the nodes use among +themselves. + +The second decides which answer applies -- a row per node means the cluster publishes the mapping +client routes reads, and a missing table means it does not: + +``` +cqlsh> select * from system.client_routes; +```