@@ -118,6 +118,52 @@ datastax-java-driver.advanced.address-translator.class = com.mycompany.MyAddress
118
118
Note: the contact points provided while creating the ` CqlSession ` are not translated, only addresses
119
119
retrieved from or sent by Cassandra nodes are.
120
120
121
+ ### Fixed proxy hostname
122
+
123
+ If your client applications access Cassandra through some kind of proxy (eg. with AWS PrivateLink when all Cassandra
124
+ nodes are exposed via one hostname pointing to AWS Endpoint), you can configure driver with
125
+ ` FixedHostNameAddressTranslator ` to always translate all node addresses to that same proxy hostname, no matter what IP
126
+ address a node has but still using its native transport port.
127
+
128
+ To use it, specify the following in the [ configuration] ( ../configuration ) :
129
+
130
+ ```
131
+ datastax-java-driver.advanced.address-translator.class = FixedHostNameAddressTranslator
132
+ advertised-hostname = proxyhostname
133
+ ```
134
+
135
+ ### Fixed proxy hostname per subnet
136
+
137
+ When running Cassandra in a private network and accessing it from outside of that private network via some kind of
138
+ proxy, we have an option to use ` FixedHostNameAddressTranslator ` . But for multi-datacenter Cassandra deployments, we
139
+ want to have more control over routing queries to a specific datacenter (eg. for optimizing latencies), which requires
140
+ setting up a separate proxy per datacenter.
141
+
142
+ Normally, each Cassandra datacenter nodes are deployed to a separate subnet to support internode communications in the
143
+ cluster and avoid IP addresses collisions. So when Cassandra broadcasts its nodes IP addresses, we can determine which
144
+ datacenter that node belongs to by checking its IP address against the given datacenter subnet.
145
+
146
+ For such scenarios you can use ` SubnetAddressTranslator ` to translate node IPs to the datacenter proxy address
147
+ associated with it.
148
+
149
+ To use it, specify the following in the [ configuration] ( ../configuration ) :
150
+ ```
151
+ datastax-java-driver.advanced.address-translator {
152
+ class = SubnetAddressTranslator
153
+ subnet-addresses {
154
+ "100.64.0.0/15" = "cassandra.datacenter1.com:9042"
155
+ "100.66.0.0/15" = "cassandra.datacenter2.com" # port defaults to 9042 if not specified
156
+ # IPv6 example:
157
+ # "::ffff:6440:0/111" = "cassandra.datacenter1.com:9042"
158
+ # "::ffff:6442:0/111" = "cassandra.datacenter2.com" # port defaults to 9042 if not specified
159
+ }
160
+ # Optional. When configured, addresses not matching the configured subnets are translated to it. Port defaults to 9042 if not specified.
161
+ default-address = "cassandra.datacenter1.com:9042"
162
+ }
163
+ ```
164
+
165
+ Such setup is common for running Cassandra on Kubernetes with [ k8ssandra] ( https://docs.k8ssandra.io/ ) .
166
+
121
167
### EC2 multi-region
122
168
123
169
If you deploy both Cassandra and client applications on Amazon EC2, and your cluster spans multiple regions, you'll have
0 commit comments