简体   繁体   English

Spring 部署到 Heroku 的引导应用在升级插件后无法连接到 ClearDB

[英]Spring boot app deployed to Heroku can't connect to a ClearDB after upgrading addon

I have a Spring Boot application which is deployed to Heroku. I've been using ClearDB ignite for some time and everything worked perfectly, but today I upgraded ClearDB addon to punch(paid), because I needed more capacity and now when I open my app it seems that it's unable to connect to a db and logs prove this.我有一个部署到 Heroku 的 Spring Boot 应用程序。我使用 ClearDB ignite 有一段时间了,一切正常,但今天我将 ClearDB 插件升级为 punch(付费),因为我需要更多容量,现在当我打开我的应用程序似乎无法连接到数据库,日志证明了这一点。

So I imported my local mysql file into cleardb, and I can see all my tables in there when I connect to it through command line.所以我将我本地的 mysql 文件导入到 cleardb 中,当我通过命令行连接到它时,我可以在那里看到我所有的表。 Basically I did all the same steps as when I was using ignite.基本上,我执行了与使用 ignite 时相同的所有步骤。

But what's interesting, when I was using ignite, and executed heroku run env command, all variables such as SPRING_DATASOURCE_URL, SPRING_DATASOURCE_USERNAME, SPRING_DATASOURCE_PASSWORD were already set in env variables list, so I didn't have to specify them in my application.properties file.但有趣的是,当我使用 ignite 并执行 heroku run env 命令时,SPRING_DATASOURCE_URL、SPRING_DATASOURCE_USERNAME、SPRING_DATASOURCE_PASSWORD 等所有变量都已在环境变量列表中设置,因此我不必在我的 application.properties 文件中指定它们。

Now when I run this command, only CLEARDB_DATABASE_URL is there.现在,当我运行此命令时,只有 CLEARDB_DATABASE_URL 在那里。 I tried to set them inside properties file.我试图将它们设置在属性文件中。 在此处输入图像描述 (I modified username and password on purpose now for screenshot) (为了截图我特意修改了用户名和密码)

I also tried setting these using DataSourceBuilder but nothing seems to work.我也尝试使用 DataSourceBuilder 设置这些但似乎没有任何效果。

Anyone has any ideas what it might be?任何人都知道它可能是什么?

Thanks in advance提前致谢

Resolved by creating new heroku app and only adding ClearDB punch addon, imported local db and everything works.通过创建新的 heroku 应用程序并仅添加 ClearDB punch 插件、导入的本地数据库和一切正常来解决。 Looks like when I added a new cleardb addon while still using free one mixed up some config settings, I don't have any other explanation.看起来当我添加了一个新的 cleardb 插件,同时仍然使用免费的插件混淆了一些配置设置时,我没有任何其他解释。 Anyways, problem solved.总之,问题解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM