Skip to content

Commit

Permalink
Corrected the property value specification for the new property
Browse files Browse the repository at this point in the history
'topology-keys' in the docs and updated the version of the driver
in the docs.
  • Loading branch information
kneeraj committed Aug 27, 2021
1 parent 23d3f40 commit 5d48680
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions architecture/design/smart-driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ An in-built function called ‘yb_servers’ will be added in Yugabyte. The purp

_Connection property:_

A new property is being added: _load-balance-hosts_
A new property is being added: _load-balance_

It expects **true/false** as its possible values. It is _false_ by default in which case it will not attempt to distribute connection load to all available servers.

Expand All @@ -90,7 +90,7 @@ _How does it work:_
An additional property _topology-keys_ is added to indicate only servers belonging to the locations indicated by the topology keys would be considered for establishing connections
It expects a _comma_separated_geo_locations_ as it's value(s).

For example: topology-keys=cloud1.region1.zone1,cloud1.region1.zone2
For example: topology-keys=region1.zone1,region1.zone2

### Shard Awareness

Expand Down
12 changes: 6 additions & 6 deletions docs/content/latest/integrations/smart-driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ To get the driver from Maven, add the following lines to your Maven project:
<dependency>
<groupId>com.yugabyte</groupId>
<artifactId>jdbc-yugabytedb</artifactId>
<version>42.2.7-5-beta.1</version>
<version>42.2.7-5-beta.5</version>
</dependency>
```

Expand Down Expand Up @@ -68,15 +68,15 @@ To build the driver locally, follow this procedure:
<dependency>
<groupId>com.yugabyte</groupId>
<artifactId>jdbc-yugabytedb</artifactId>
<version>42.2.7-yb-5-beta.1</version>
<version>42.2.7-yb-5-beta.5</version>
</dependency>
```

## Using the Smart Driver

**Cluster-aware** load balancing is performed using the `load-balance` connection property, which is disabled by default. You can enable it by setting its value to `true`.

**Topology-aware** load balancing additionally requires the `topology-keys` connection property, which accepts a comma-separated list of geolocation values. You can specify a geolocation as cloud:region:zone.
**Topology-aware** load balancing additionally requires the `topology-keys` connection property, which accepts a comma-separated list of geolocation values. You can specify a geolocation as region:zone

To use the Smart Driver, do the following:

Expand All @@ -92,7 +92,7 @@ To use the Smart Driver, do the following:
To specify topology keys, you set the `topology-keys` property to comma separated values, as per the following example:

```java
String yburl = "jdbc:postgresql://127.0.0.1:5433/yugabyte?user=yugabyte&password=yugabyte&load-balance=true&topology-keys=cloud1:region1:zone1,cloud1:region1.zone2";
String yburl = "jdbc:postgresql://127.0.0.1:5433/yugabyte?user=yugabyte&password=yugabyte&load-balance=true&topology-keys=region1:zone1,region1.zone2";
DriverManager.getConnection(yburl);
```

Expand All @@ -104,7 +104,7 @@ To use the Smart Driver, do the following:
ds.setUrl(jdbcUrl);
ds.setLoadBalance("true");
// Set topology keys to enable topology-aware distribution
ds.setTopologyKeys("cloud1.region1.zone1,cloud1.region2.zone2");
ds.setTopologyKeys("region1.zone1,region2.zone2");
// Provide more end points to prevent first connection failure
// if an initial contact point is not available
ds.setAdditionalEndpoints("127.0.0.2:5433,127.0.0.3:5433");
Expand All @@ -128,7 +128,7 @@ To use the Smart Driver, do the following:
String additionalEndpoints = "127.0.0.2:5433,127.0.0.3:5433,127.0.0.4:5433,127.0.0.5:5433";
poolProperties.setProperty("dataSource.additionalEndpoints", additionalEndpoints);
// Load balance between specific geo-locations using topology keys
String geoLocations = "cloud1.region1.zone1,cloud1.region2.zone2";
String geoLocations = "region1.zone1,region2.zone2";
poolProperties.setProperty("dataSource.topologyKeys", geoLocations);

poolProperties.setProperty("poolName", name);
Expand Down

0 comments on commit 5d48680

Please sign in to comment.