目前,我正在尝试连接到 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-service 的应用程序 (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 中定义一些设置?
谢谢!