Skip to content

Commit e27d33b

Browse files
larisaummatczuk
authored andcommitted
cql authentication added
1 parent 4fef4a9 commit e27d33b

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ Note that this option should be set for both write and read (counter_update and
167167

168168
* `-iterations` sets the Number of iterations to run the given workloads. This is only relevant for workloads that have a finite number of steps. Currently the only such workloads are [sequential](#sequential-workload--workload-sequential) and [scan](#scan-mode--mode-scan). Can be combined with `-duration` to limit a run by both number of iterations and time. Set to 0 for infinite iterations. Defaults to 1.
169169

170+
* `keyspace` defines keyspace name to use
171+
* `table` defines table name to work with
172+
* `username` - cql username for authentication
173+
* `password` - cql password for authentication
174+
170175
### Random value distributions
171176

172177
scylla-bench supports random values for certain command line arguments. The list of these arguments is:

main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ var (
5656
keyspaceName string
5757
tableName string
5858
counterTableName string
59+
username string
60+
password string
5961

6062
mode string
6163
concurrency int
@@ -255,8 +257,11 @@ func main() {
255257

256258
flag.StringVar(&keyspaceName, "keyspace", "scylla_bench", "keyspace to use")
257259
flag.StringVar(&tableName, "table", "test", "table to use")
260+
flag.StringVar(&username, "username", "", "cql username for authentication")
261+
flag.StringVar(&password, "password", "", "cql password for authentication")
258262

259263
flag.StringVar(&hostSelectionPolicy, "host-selection-policy", "token-aware", "set the driver host selection policy (round-robin,token-aware,dc-aware),default 'token-aware'")
264+
260265
flag.Parse()
261266
counterTableName = "test_counters"
262267

@@ -354,6 +359,13 @@ func main() {
354359
cluster.Compressor = &gocql.SnappyCompressor{}
355360
}
356361

362+
if username != "" && password != "" {
363+
cluster.Authenticator = gocql.PasswordAuthenticator{
364+
Username: username,
365+
Password: password,
366+
}
367+
}
368+
357369
session, err := cluster.CreateSession()
358370
if err != nil {
359371
log.Fatal(err)

0 commit comments

Comments
 (0)