Search code examples
databasecnosdb

How does cnosdb-cli configure SSL access?


I followed the documentation cnosdb to configure server side tls, but I don't know how to configure the command line client.

cnosdb on  admin is 📦 v2.3.0 via 🦀 v1.70.0-nightly 
❯ git rev-parse --short HEAD
252f0277

cnosdb on  admin is 📦 v2.3.0 via 🦀 v1.70.0-nightly 
❯ .\target\debug\cnosdb-cli.exe --help
Command Line Client for Cnosdb.

Usage: cnosdb-cli.exe [OPTIONS]

Options:
  -H, --host <HOST>
          CnosDB server http api host [default: localhost]
  -P, --port <PORT>
          CnosDB server http api port [default: 8902]
  -u, --user <USER>
          The user name used to connect to the CnosDB [default: root]
  -p, --password <PASSWORD>
          Password used to connect to the CnosDB
      --private-key-path <PRIVATE_KEY_PATH>
          Rsa private key path for key pair authentication used to connect to the CnosDB
  -d, --database <DATABASE>
          Default database to connect to the CnosDB [default: public]
  -t, --tenant <TENANT>
          Default tenant to connect to the CnosDB [default: cnosdb]
      --target-partitions <TARGET_PARTITIONS>
          Number of partitions for query execution. Increasing partitions can increase concurrency.
  -s, --stream-trigger-interval <STREAM_TRIGGER_INTERVAL>
          Optionally, specify the micro batch stream trigger interval. e.g. once, 1m, 10s
      --data-path <DATA_PATH>
          Path to your data, default to current directory
  -f, --file [<FILE>...]
          Execute commands from file(s), then exit
      --rc [<RC>...]
          Run the provided files on startup instead of ~/.cnosdbrc
      --format <FORMAT>
          [default: table] [possible values: csv, tsv, table, json, nd-json]
  -q, --quiet
          Reduce printing other than the results and work quietly
  -W, --write-line-protocol <WRITE_LINE_PROTOCOL>
          write linie protocol from path
      --precision <PRECISION>
          The precision for the unix timestamps within the body protocol
  -h, --help
          Print help
  -V, --version
          Print version

I can't find the relevant configuration items in the help, what should I do to access the database?


Solution

  • I have read the code for it and I'm sure it‘s not supported in the current version (since f4b52408171467c5ea2b2f75480deecc6f6ad733).

    But you can use other tools to make it, such as curl:

    curl -k -X POST --basic -u user:pass 'https://host:port/api/v1/sql?db=public' -d 'show databases'