cockroachdb / loadgen

CockroachDB load generators
Apache License 2.0
30 stars 25 forks source link

tpcc: How to specify connection parameters (url, port, user, pass) #172

Open arruw opened 6 years ago

arruw commented 6 years ago

I couldn't find example how to set this <db URL>. I'm guessing that this should be JDBC connection string? Also how can I specify user and password?

$ docker run --rm cockroachdb/loadgen-tpcc -h
Usage of tpcc:
  tpcc <db URL>

  -check
        Run consistency checks.
  ...

I tried like that, but it doesn't work.

$ docker run --rm \
    --network roach_roach-net \
    cockroachdb/loadgen-tpcc \
    jdbc:postgresql://roach1:26257 \
    -drop \
    -load \
    -v \
    -ops-stats \
    -tolerate-errors
_time______opName__ops/s(inst)__ops/s(cum)__p50(ms)__p95(ms)__p99(ms)_pMax(ms)
   1s    newOrder          0.0         0.0      0.0      0.0      0.0      0.0
   2s    newOrder          0.0         0.0      0.0      0.0      0.0      0.0
   3s    newOrder          0.0         0.0      0.0      0.0      0.0      0.0
2018/03/20 21:04:41 error in payment: dial tcp 127.0.0.1:26257: getsockopt: connection refused

Thanks for any info :)

jordanlewis commented 6 years ago

The connection string should look like postgres://user@ip:port?sslmode=disable.

arruw commented 6 years ago

@jordanlewis thank you.

If anyone is searching for more details, read more here: https://www.cockroachlabs.com/docs/stable/use-the-built-in-sql-client.html

For insecure connections, the URL format is: postgresql://<user>@<host>:<port>/<database>?sslmode=disable

For secure connections, the URL format is: postgresql://<user>@<host>:<port>/<database> with the following parameters in the query string: sslcert=<path-to-client-crt> sslkey=<path-to-client-key> sslmode=verify-full sslrootcert=<path-to-ca-crt>