Skip to content

Commit

Permalink
cql authentication added
Browse files Browse the repository at this point in the history
  • Loading branch information
larisau authored and mmatczuk committed Oct 8, 2018
1 parent 4fef4a9 commit e27d33b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ Note that this option should be set for both write and read (counter_update and

* `-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.

* `keyspace` defines keyspace name to use
* `table` defines table name to work with
* `username` - cql username for authentication
* `password` - cql password for authentication

### Random value distributions

scylla-bench supports random values for certain command line arguments. The list of these arguments is:
Expand Down
12 changes: 12 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ var (
keyspaceName string
tableName string
counterTableName string
username string
password string

mode string
concurrency int
Expand Down Expand Up @@ -255,8 +257,11 @@ func main() {

flag.StringVar(&keyspaceName, "keyspace", "scylla_bench", "keyspace to use")
flag.StringVar(&tableName, "table", "test", "table to use")
flag.StringVar(&username, "username", "", "cql username for authentication")
flag.StringVar(&password, "password", "", "cql password for authentication")

flag.StringVar(&hostSelectionPolicy, "host-selection-policy", "token-aware", "set the driver host selection policy (round-robin,token-aware,dc-aware),default 'token-aware'")

flag.Parse()
counterTableName = "test_counters"

Expand Down Expand Up @@ -354,6 +359,13 @@ func main() {
cluster.Compressor = &gocql.SnappyCompressor{}
}

if username != "" && password != "" {
cluster.Authenticator = gocql.PasswordAuthenticator{
Username: username,
Password: password,
}
}

session, err := cluster.CreateSession()
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit e27d33b

Please sign in to comment.