Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

k8s minikube 安装报错org.postgresql.util.PSQLException: The connection attempt failed #5072

Closed
xpbyte opened this issue Aug 12, 2021 · 1 comment
Assignees
Labels
question generic question

Comments

@xpbyte
Copy link

xpbyte commented Aug 12, 2021

k8s minikube方式安装tb,完全安装官方文档操作,在 ./k8s-install-tb.sh --loadDemo时,报错如下,多次尝试扔相同问题,
Starting ThingsBoard Installation...
Installing DataBase schema for entities...
Installing SQL DataBase schema part: schema-entities.sql
Unexpected error during ThingsBoard installation!
org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:315)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51)
at org.postgresql.jdbc.PgConnection.(PgConnection.java:225)
at org.postgresql.Driver.makeConnection(Driver.java:465)
at org.postgresql.Driver.connect(Driver.java:264)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
at org.thingsboard.server.service.install.SqlAbstractDatabaseSchemaService.createDatabaseSchema(SqlAbstractDatabaseSchemaService.java:66)
at org.thingsboard.server.service.install.SqlAbstractDatabaseSchemaService.createDatabaseSchema(SqlAbstractDatabaseSchemaService.java:57)
at org.thingsboard.server.install.ThingsboardInstallService.performInstall(ThingsboardInstallService.java:210)
at org.thingsboard.server.ThingsboardInstallApplication.main(ThingsboardInstallApplication.java:44)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:107)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467)
Caused by: java.io.EOFException: null
at org.postgresql.core.PGStream.receiveChar(PGStream.java:443)
at org.postgresql.core.v3.ConnectionFactoryImpl.enableGSSEncrypted(ConnectionFactoryImpl.java:436)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:144)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213)
... 18 common frames omitted
Unexpected error during ThingsBoard installation!
另外刚开始安装时,有提示
NOTES:
** Please be patient while the chart is being deployed **
PostgreSQL can be accessed through Pgpool via port 5432 on the following DNS name from within your cluster:

my-release-postgresql-ha-pgpool.thingsboard.svc.cluster.local

Pgpool acts as a load balancer for PostgreSQL and forward read/write connections to the primary node while read-only connections are forwarded to standby nodes.

To get the password for "postgres" run:

export POSTGRES_PASSWORD=$(kubectl get secret --namespace thingsboard my-release-postgresql-ha-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To get the password for "repmgr" run:

export REPMGR_PASSWORD=$(kubectl get secret --namespace thingsboard my-release-postgresql-ha-postgresql -o jsonpath="{.data.repmgr-password}" | base64 --decode)

To connect to your database run the following command:

kubectl run my-release-postgresql-ha-client --rm --tty -i --restart='Never' --namespace thingsboard --image docker.io/bitnami/postgresql-repmgr:11.7.0-debian-10-r87 --env="PGPASSWORD=$POSTGRES_PASSWORD"  \
    --command -- psql -h my-release-postgresql-ha-pgpool -p 5432 -U postgres -d thingsboard

To connect to your database from outside the cluster execute the following commands:

kubectl port-forward --namespace thingsboard svc/my-release-postgresql-ha-pgpool 5432:5432 &  psql -h 127.0.0.1 -p 5432 -U postgres -d thingsboard

请问如上几条命令是必须执行的还是只是用来测试数据库连接的

@xpbyte xpbyte added the question generic question label Aug 12, 2021
@lc2a
Copy link

lc2a commented Sep 1, 2021

problem resolved in new version 3.3.0.
changed all thingsboard image version from 3.2.2 to 3.3.0

user@k8s-master:~/github/thingsboard-ce-k8s$ ./k8s-install-tb.sh --loadDemo
namespace/thingsboard unchanged
Context "kubernetes-admin@kubernetes" modified.
Starting PostgreSQL as 1001 user.
configmap/pgpool unchanged
"bitnami" already exists with the same configuration, skipping
Error: INSTALLATION FAILED: cannot re-use a name that is still in use
statefulset rolling update complete 2 pods at revision my-release-postgresql-ha-postgresql-544848c96f...
deployment "my-release-postgresql-ha-pgpool" successfully rolled out
configmap/cassandra-config unchanged
statefulset.apps/cassandra configured
service/cassandra unchanged
partitioned roll out complete: 3 new pods have been updated...
configmap/tb-node-db-config unchanged
configmap/tb-node-config unchanged
pod/tb-db-setup configured
pod/tb-db-setup condition met
Starting ThingsBoard installation ...
14:44:59,534 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
14:44:59,535 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
14:44:59,536 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/config/logback.xml]
14:44:59,538 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
14:44:59,538 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/usr/share/thingsboard/conf/logback.xml]
14:44:59,538 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/config/logback.xml]
14:44:59,884 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
14:44:59,936 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Will scan for changes in [file:/config/logback.xml]
14:44:59,936 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeTask scanning period to 10 seconds
14:44:59,942 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
14:44:59,956 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [fileLogAppender]
14:44:59,981 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1757293506 - setting totalSizeCap to 3 GB
14:44:59,987 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1757293506 - Archive files will be limited to [100 MB] each.
14:45:00,034 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1757293506 - No compression will be used
14:45:00,037 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@1757293506 - Will use the pattern /var/log/thingsboard/tb-db-setup/thingsboard.%d{yyyy-MM-dd}.%i.log for the active file
14:45:00,040 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@28feb3fa - The date pattern is 'yyyy-MM-dd' from file name pattern '/var/log/thingsboard/tb-db-setup/thingsboard.%d{yyyy-MM-dd}.%i.log'.
14:45:00,040 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@28feb3fa - Roll-over at midnight.
14:45:00,047 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@28feb3fa - Setting initial period to Wed Sep 01 14:45:00 UTC 2021
14:45:00,049 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
14:45:00,093 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[fileLogAppender] - Active log file name: /var/log/thingsboard/tb-db-setup/thingsboard.log
14:45:00,093 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[fileLogAppender] - File property is set to [/var/log/thingsboard/tb-db-setup/thingsboard.log]
14:45:00,094 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
14:45:00,097 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
14:45:00,097 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
14:45:00,099 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.thingsboard.server] to INFO
14:45:00,099 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.google.common.util.concurrent.AggregateFuture] to OFF
14:45:00,099 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
14:45:00,099 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [fileLogAppender] to Logger[ROOT]
14:45:00,100 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
14:45:00,100 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
14:45:00,101 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@675d3402 - Registering current configuration as safe fallback point

  ______    __      _                              ____                               __
 /_  __/   / /_    (_)   ____    ____ _   _____   / __ )  ____   ____ _   _____  ____/ /
  / /     / __ \  / /   / __ \  / __ `/  / ___/  / __  | / __ \ / __ `/  / ___/ / __  /
 / /     / / / / / /   / / / / / /_/ /  (__  )  / /_/ / / /_/ // /_/ /  / /    / /_/ /
/_/     /_/ /_/ /_/   /_/ /_/  \__, /  /____/  /_____/  \____/ \__,_/  /_/     \__,_/
                              /____/

 ===================================================
 :: ThingsBoard ::       (v3.3.0)
 ===================================================

Starting ThingsBoard Installation...
Installing DataBase schema for entities...
Installing SQL DataBase schema part: schema-entities.sql
Installing SQL DataBase schema indexes part: schema-entities-idx.sql
Installing SQL DataBase schema PostgreSQL specific indexes part: schema-entities-idx-psql-addon.sql
Installing DataBase schema for timeseries...
Installing Cassandra DataBase schema part: schema-ts.cql
Loading system data...
Loading demo data...
Installation finished successfully!
pod "tb-db-setup" deleted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question generic question
Projects
None yet
Development

No branches or pull requests

4 participants