You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cleaned up CLI options (Astra-specific flags are prefixed with `--astra`). Updated the `README` to favor the use of Astra tokens over using the bundle because it's much easier for users.
Also,
* Logging wasn't working in `Session` and `Cluster` because it wasn't being set
* Added new flag for `--num-conns` to increase the number of connection per pool. It's possible that it could increase performance in some scenarios, but users should be wary of increasing this value too much.
* Added addition logging to the pool and cluster to aid in debugging outage testing
Co-authored-by: Lorina Poland <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+46-25Lines changed: 46 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,9 +19,6 @@
19
19
20
20
`cql-proxy` is designed to forward your application's CQL traffic to an appropriate database service. It listens on a local address and securely forwards that traffic.
21
21
22
-
**Warning**: `cql-proxy` in its current state works well, and you should give it a try. However, it is still under development, so things might break or change.
23
-
24
-
Please give it a try and let us know what you think!
25
22
## When to use `cql-proxy`
26
23
27
24
The `cql-proxy` sidecar enables unsupported CQL drivers to work with [DataStax Astra][astra]. These drivers include both legacy DataStax [drivers] and community-maintained CQL drivers, such as the [gocql] driver and the [rust-driver].
@@ -39,32 +36,43 @@ $ ./cql-proxy -h
39
36
Usage: cql-proxy
40
37
41
38
Flags:
42
-
-h, --help Show context-sensitive help.
43
-
-b, --bundle=STRING Path to secure connect bundle ($BUNDLE)
44
-
-u, --username=STRING Username to use for authentication ($USERNAME)
45
-
-p, --password=STRING Password to use for authentication ($PASSWORD)
46
-
-c, --contact-points=CONTACT-POINTS,...
47
-
Contact points for cluster. Ignored if using the bundle path
48
-
option ($CONTACT_POINTS).
49
-
-a, --bind=STRING Address to use to bind serve ($BIND)
50
-
--debug Show debug logging ($DEBUG)
51
-
--profiling Enable profiling ($PROFILING)
39
+
-h, --help Show context-sensitive help.
40
+
-b, --astra-bundle=STRING Path to secure connect bundle for an Astra database. Requires '--username' and '--password'. Ignored if using the token or contact points option
41
+
($ASTRA_BUNDLE).
42
+
-t, --astra-token=STRING Token used to authenticate to an Astra database. Requires '--astra-database-id'. Ignored if using the bundle path or contact points option
43
+
($ASTRA_TOKEN).
44
+
-i, --astra-database-id=STRING Database ID of the Astra database. Requires '--astra-token' ($ASTRA_DATABASE_ID)
45
+
-c, --contact-points=CONTACT-POINTS,... Contact points for cluster. Ignored if using the bundle path or token option ($CONTACT_POINTS).
46
+
-u, --username=STRING Username to use for authentication ($USERNAME)
47
+
-p, --password=STRING Password to use for authentication ($PASSWORD)
48
+
-r, --port=9042 Default port to use when connecting to cluster ($PORT)
49
+
-n, --protocol-version="v4" Initial protocol version to use when connecting to the backend cluster (default: v4, options: v3, v4, v5, DSEv1, DSEv2) ($PROTOCOL_VERSION)
50
+
-m, --max-protocol-version="v4" Max protocol version supported by the backend cluster (default: v4, options: v3, v4, v5, DSEv1, DSEv2) ($MAX_PROTOCOL_VERSION)
51
+
-a, --bind=":9042" Address to use to bind server ($BIND)
52
+
--debug Show debug logging ($DEBUG)
53
+
--health-check Enable liveness and readiness checks ($HEALTH_CHECK)
54
+
--http-bind=":8000" Address to use to bind HTTP server used for health checks ($HTTP_BIND)
55
+
--heartbeat-interval=30s Interval between performing heartbeats to the cluster ($HEARTBEAT_INTERVAL)
56
+
--idle-timeout=60s Duration between successful heartbeats before a connection to the cluster is considered unresponsive and closed ($IDLE_TIMEOUT)
57
+
--readiness-timeout=30s Duration the proxy is unable to connect to the backend cluster before it is considered not ready ($READINESS_TIMEOUT)
58
+
--num-conns=1 Number of connection to create to each node of the backend cluster ($NUM_CONNS)
52
59
```
53
60
54
-
To pass configuration to `cql-proxy`, either command-line flags or environment variables can be used. Using the `docker` method as an example, the follwing samples show how username, password and bundle are defined with each method.
61
+
To pass configuration to `cql-proxy`, either command-line flags or environment variables can be used. Using the `docker` method as an example, the following samples show how the token and database ID are defined with each method.
55
62
### Using flags
56
63
57
64
```sh
58
-
docker run -v <your-secure-connect-bundle.zip>:/tmp/scb.zip -p 9042:9042 \
The `<astra-token>` can be generated using these [instructions]. The proxy also supports using the [Astra Secure Connect Bundle][bundle] along with a client ID and secret generated using these [instructions]:
The `<astra-client-id>` and `<astra-client-secret>` can be generated using these [instructions].
109
123
124
+
The `<astra-token>` can be generated using these [instructions]. The proxy also supports using the [Astra Secure Connect Bundle][bundle], but it requires mounting the bundle to a volume in the container:
125
+
126
+
```sh
127
+
docker run -v <your-secure-connect-bundle.zip>:/tmp/scb.zip -p 9042:9042 \
Bundlestring`help:"Path to secure connect bundle" short:"b" env:"BUNDLE"`
38
+
AstraBundlestring`help:"Path to secure connect bundle for an Astra database. Requires '--username' and '--password'. Ignored if using the token or contact points option." short:"b" env:"ASTRA_BUNDLE"`
39
+
AstraTokenstring`help:"Token used to authenticate to an Astra database. Requires '--astra-database-id'. Ignored if using the bundle path or contact points option." short:"t" env:"ASTRA_TOKEN"`
40
+
AstraDatabaseIDstring`help:"Database ID of the Astra database. Requires '--astra-token'" short:"i" env:"ASTRA_DATABASE_ID"`
41
+
AstraApiURLstring`help:"URL for the Astra API" default:"https://api.astra.datastax.com" env:"ASTRA_API_URL"`
42
+
ContactPoints []string`help:"Contact points for cluster. Ignored if using the bundle path or token option." short:"c" env:"CONTACT_POINTS"`
39
43
Usernamestring`help:"Username to use for authentication" short:"u" env:"USERNAME"`
40
44
Passwordstring`help:"Password to use for authentication" short:"p" env:"PASSWORD"`
ContactPoints []string`help:"Contact points for cluster. Ignored if using the bundle path option." short:"c" env:"CONTACT_POINTS"`
44
-
Portint`help:"Default port to use when connecting to cluster" default:"9042" short:"t" env:"PORT"`
45
+
Portint`help:"Default port to use when connecting to cluster" default:"9042" short:"r" env:"PORT"`
45
46
ProtocolVersionstring`help:"Initial protocol version to use when connecting to the backend cluster (default: v4, options: v3, v4, v5, DSEv1, DSEv2)" default:"v4" short:"n" env:"PROTOCOL_VERSION"`
46
47
MaxProtocolVersionstring`help:"Max protocol version supported by the backend cluster (default: v4, options: v3, v4, v5, DSEv1, DSEv2)" default:"v4" short:"m" env:"MAX_PROTOCOL_VERSION"`
47
48
Bindstring`help:"Address to use to bind server" short:"a" default:":9042" env:"BIND"`
@@ -51,6 +52,7 @@ var cli struct {
51
52
HeartbeatInterval time.Duration`help:"Interval between performing heartbeats to the cluster" default:"30s" env:"HEARTBEAT_INTERVAL"`
52
53
IdleTimeout time.Duration`help:"Duration between successful heartbeats before a connection to the cluster is considered unresponsive and closed" default:"60s" env:"IDLE_TIMEOUT"`
53
54
ReadinessTimeout time.Duration`help:"Duration the proxy is unable to connect to the backend cluster before it is considered not ready" default:"30s" env:"READINESS_TIMEOUT"`
55
+
NumConnsint`help:"Number of connection to create to each node of the backend cluster" default:"1" env:"NUM_CONNS"`
54
56
}
55
57
56
58
// Run starts the proxy command. 'args' shouldn't include the executable (i.e. os.Args[1:]). It returns the exit code
0 commit comments