2

現在、Platform.sh でホストされている InfluxDB に接続しようとしていますが、うまくいきません。

https://docs.platform.sh/configuration/services/influxdb.htmlに記載されているセットアップ手順に従いました。これらの手順の後、Platform.sh でサービスを利用できるようになりました。

その後、Platform.sh のコミュニティ ガイド ( https://community.platform.sh/t/how-to-access-influxdb-credentials-on-platform-sh/148 ) を使用してデータベースに接続しました。

次に、次のコマンドを実行し、InfluxDB サービスに接続されているアプリケーション (Grafana) を選択しました。

platform tunnel:single && export PLATFORM_RELATIONSHIPS="$(platform tunnel:info --encode)"

Enter a number to choose an app:
[0] app
[1] grafana
> 1

Enter a number to choose a relationship:
[0] datadb
[1] confdb (main@confdb.internal)
> 0

SSH tunnel opened to datadb at: http://127.0.0.1:30000

次に、InfluxDB に接続し、データベースを作成しようとしました。

influx -host '127.0.0.1' -port '30000'

Connected to http://127.0.0.1:30000 version 1.7.10
InfluxDB shell version: v1.7.9

> CREATE DATABASE test

ERR: error authorizing query: create admin user first or disable authentication
Warning: It is possible this error is due to not setting a database.
Please set a database with the command "use <database>".

残念ながら、リレーションシップ JSON には、ユーザーまたはデフォルトのデータベース情報が含まれていません。

datadb:
    -
        service: timedb
        ip: 169.254.1.23
        hostname: abcd.timedb.service._.eu-4.platformsh.site
        cluster: abcdg-feature-platform-test-1234
        host: datadb.internal
        rel: influxdb
        scheme: http
        type: 'influxdb:1.7'
        port: 8086
        url: 'http://datadb.internal:8086'

データベースに接続するにはどうすればよいですか? デフォルトのユーザーまたはデフォルトのデータベースはありますか? または、services.yaml でいくつかの設定を定義することは可能ですか?

ありがとう!

4

1 に答える 1

3

Platform.sh フォーラムで学んだように、管理者ユーザーを作成する必要がありました。トンネルが開いた後、私は走らなければなりませんでした:

influx -host 127.0.0.1 -port 30000                                                                                                                                                              
Connected to http://127.0.0.1:30000 version 1.7.10
InfluxDB shell version: v1.7.9
> CREATE USER admin WITH PASSWORD 'admin' WITH ALL PRIVILEGES

その後、新しく作成したユーザーを使用してデータベースに再接続しました

influx -host 127.0.0.1 -port 30000 -username admin -password ''
于 2020-03-19T06:46:07.433 に答える