标签: heroku-postgres

Heroku数据库连接属性

我正在尝试执行一项相对简单的任务:我想连接到Heroku数据库.我已经创建了数据库并且已经从Heroku站点获得了凭据.但是,当我尝试使用除终端'heroku'命令行客户端之外的任何东西连接到此数据库时,我会收到致命错误或无法连接错误.

我试图在Heroku终端应用程序之外连接的两个工具是:Navicat和IntelliJ.

尝试连接数据库时我在Navicat中收到的错误是:

could not connect to server: Host is down
    Is the server running on host "ec2-107-21-112-215.compute-1.amazonaws.com" and accepting
    TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)

我的连接设置如下:

连接名称 Heroku开发测试

主机名/ IP地址 ec2-107-21-112-215.compute-1.amazonaws.com

港口 5432

Navicat似乎甚至没有尝试连接到该主机名.

当我尝试使用完整凭据连接IntelliJ时,我收到以下错误:

java.sql.SQLException: FATAL: no pg_hba.conf entry for host "75.168.4.146", user "rphbqggxeokuxl", database "dc008iqk0rq4j5", SSL off
Run Code Online (Sandbox Code Playgroud)

同样,我正在使用Heroku应用程序在访问其网站上的数据库时提供的凭据.

有没有人遇到过这个Heroku连接问题?

heroku heroku-postgres

42
推荐指数
6
解决办法
4万
查看次数

错误:扩展“btree_gist”必须安装在架构“heroku_ext”中

Heroku 更改了 postgressql扩展的安装方式

这会搞砸 Heroku 中的新 Rails 审查应用程序,并出现以下错误。

错误:扩展“btree_gist”必须安装在架构“heroku_ext”中

这把事情搞砸了,因为我需要删除现有的扩展并使用 heroku_ext 模式重新启用。我在运行迁移之前使用 bin/rails db:struct:load 。

此外,随着 Heroku 在审核应用程序中添加架构,Structure.sql 也会出现分歧,我们需要在本地开发计算机中手动运行创建。

有人遇到过这个问题吗?

postgresql ruby-on-rails heroku heroku-postgres

33
推荐指数
3
解决办法
4417
查看次数

Heroku评论应用程序:复制数据库以查看应用程序

尝试为应用程序完全自动化Heroku的评论应用程序(测试版).Heroku希望我们用它db/seeds.rb来播种最近运行的实例的数据库.

我们没有db/seeds.rb这个应用程序.我们想要设置一个脚本来从当前父级(临时)复制现有数据库,并将其用作正在审核的新应用程序的数据库.

我可以手动完成:

heroku pg:copy myapp::DATABASE_URL DATABASE_URL --app myapp-pr-1384 --confirm myapp-pr-1384

但我无法弄清楚如何将Heroku创建的应用程序名称添加到postdeploy脚本中.

有人试过这个,知道它是如何实现自动化的吗?

postgresql heroku heroku-toolbelt heroku-postgres

32
推荐指数
2
解决办法
6022
查看次数

Pgadmin 未加载

我最近在我的笔记本电脑上安装了 pgadmin4,当我启动应用程序时,它只是卡在加载中。我查看了日志,这就是我所看到的:

载入画面截图

日志

2020-11-14 00:22:46: Checking for system tray...
2020-11-14 00:22:46: Starting pgAdmin4 server...
2020-11-14 00:22:46: Creating server object, port:64222, key:2a079549-63da-44d2-8931-efa9de3a847f, logfile:C:/Users/yonis/AppData/Local/pgadmin4.d41d8cd98f00b204e9800998ecf8427e.log
2020-11-14 00:22:46: Python Path: C:/Program Files/PostgreSQL/13/pgAdmin 4/venv/Lib/site-packages;C:/Program Files/PostgreSQL/13/pgAdmin 4/venv/DLLs;C:/Program Files/PostgreSQL/13/pgAdmin 4/venv/Lib
2020-11-14 00:22:46: Python Home: C:/Program Files/PostgreSQL/13/pgAdmin 4/venv
2020-11-14 00:22:46: Initializing Python...
2020-11-14 00:22:46: Python initialized.
2020-11-14 00:22:46: Adding new additional path elements
2020-11-14 00:22:46: Redirecting stderr...
2020-11-14 00:22:46: stderr redirected successfully.
2020-11-14 00:22:46: Initializing server...
2020-11-14 00:22:46: Webapp Path: C:/Program Files/PostgreSQL/13/pgAdmin 4/web/pgAdmin4.py
2020-11-14 00:22:46: Server initialized, starting …
Run Code Online (Sandbox Code Playgroud)

python postgresql pgadmin heroku-postgres pgadmin-4

31
推荐指数
3
解决办法
2万
查看次数

Heroku postgres postgis - django 发布失败并显示:关系“spatial_ref_sys”不存在

Heroku 于 2022 年 8 月 1 日更改了 PostgreSQL 扩展架构管理。( https://devcenter.heroku.com/changelog-items/2446 )

从那时起,我们现有的 django 4.0 应用程序在 Heroku 上的每次部署在发布阶段都会失败,但构建会成功。

有人遇到过同样的问题吗?除了重新安装 postgis 扩展之外,是否有解决方法可以将新版本推送到 Heroku?

如果我理解这些更改正确的话,Heroku 为新创建的扩展添加了一个名为“heroku_ext”的模式。由于该扩展在我们的案例中已存在,因此不应受到影响。

所有当前安装的扩展将继续按预期工作。

通过 git Push 查看发布的完整日志:

git push staging develop:master
Gesamt 0 (Delta 0), Wiederverwendet 0 (Delta 0), Pack wiederverwendet 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote:        1. https://github.com/heroku/heroku-geo-buildpack.git
remote:        2. heroku/python
remote: -----> Geo Packages (GDAL/GEOS/PROJ) app detected
remote: -----> Installing …
Run Code Online (Sandbox Code Playgroud)

python django heroku heroku-postgres

31
推荐指数
1
解决办法
2859
查看次数

当ID存在时,获取"表的未知主键"

我一直在调试这个Rails的奇怪问题,给我"桌面的未知主键......",即使桌子的ID在那里.

我已经将数据库从一个heroku应用程序复制到另一个,在原始数据库上没有问题,新的一个给了我一个db错误.

这是错误:

ProductsController# (ActionView::Template::Error) "Unknown primary key for table collections in model Collection."

/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/reflection.rb:366:in `primary_key'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/reflection.rb:480:in `association_primary_key'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:58:in `block in add_constraints'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:39:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:39:in `each_with_index'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:39:in `add_constraints'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:31:in `scope'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association.rb:98:in `association_scope'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association.rb:87:in `scoped'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/collection_association.rb:573:in `first_or_last'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/collection_association.rb:105:in `last'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/collection_proxy.rb:46:in `last'
/app/app/helpers/likes_helper.rb:62:in `significant_liker'
Run Code Online (Sandbox Code Playgroud)

引起它的那条线:

product.collections.last.try :user
Run Code Online (Sandbox Code Playgroud)

和表:

d8apjspa441pad=> \d collections
                                     Table "public.collections"
     Column     |          Type          |                        Modifiers                         
----------------+------------------------+----------------------------------------------------------
 id             | integer                | not null default nextval('collections_id_seq'::regclass)
 name           | character varying(255) | 
 user_id        | integer                | 
 permalink      | character varying(255) | 
 category_id …
Run Code Online (Sandbox Code Playgroud)

postgresql ruby-on-rails heroku rails-activerecord heroku-postgres

30
推荐指数
3
解决办法
2万
查看次数

如何从heroku下载db?

我正在使用heroku,我想从我的应用程序(heroku)下载数据库,所以我可以对其进行一些更改,我已经安装了pgbackups,但是使用了heroku pgbackups:url下载的.dump文件

如何下载postgresql文件或将.dump转换为postgresql文件?

postgresql mysqldump heroku heroku-postgres

27
推荐指数
3
解决办法
2万
查看次数

添加新字段后 Prisma 架构无法正确更新

正如标题所述,我在 Next JS 应用程序中使用 Prisma 2。我有一个非常简单的架构:

  model User {
  id             Int       @id @default(autoincrement())
  firstName      String
  middleName     String?
  firstLastname  String
  secondLastname String?
  email          String
  role           String
  group          Group?    @relation(fields: [groupId], references: [id])
  groupId        Int?
  activity       Activity? @relation(fields: [activityId], references: [id])
  activityId     Int?
  createdOn      DateTime  @default(now())
  updatedOn      DateTime  @default(now())
}

model JobTitle {
  id        Int      @id @default(autoincrement())
  name      String
  createdOn DateTime @default(now())
  updatedOn DateTime @default(now())
}

model Group {
  id        Int      @id @default(autoincrement())
  name      String
  users     User[]
  createdOn DateTime @default(now())
  updatedOn DateTime …
Run Code Online (Sandbox Code Playgroud)

heroku-postgres reactjs next.js prisma prisma2

23
推荐指数
2
解决办法
3万
查看次数

如何为heroku应用程序更改DATABASE_URL

我准备好了一个外部数据库,现在想用我的heroku应用程序使用该数据库.但是我无法编辑配置变量.我尝试使用GUI,其中说,无法覆盖附件值DATABASE_URL.虽然我也尝试使用CLI.我使用了命令:heroku config:addDATABASE_URL ="postgresql:// username:password @ IP:PORT".但是,这会引发错误........不是heroku命令.

postgresql ruby-on-rails heroku heroku-postgres

22
推荐指数
4
解决办法
1万
查看次数

Heroku代码= H10 desc ="App崩溃" - 无法弄清楚它崩溃的原因

我一直在寻找这个问题一段时间,但在我的情况下找不到任何似乎适用的东西.我一直盯着这些日志,我看不出是什么问题.

这在以前的部署过程中发生过,但似乎总是自行解决.现在这只是自己发生的(没有部署),我无法摆脱它.尝试恢复到以前版本的应用程序,但似乎我被卡住了.我重置了dyno并且还完成了rake db:migrate.

日志中有一些重复的东西,但我只是不知道从中读出什么.任何人都知道问题出在哪里?任何指导将不胜感激.请参阅下面的日志.

Jun 18 15:51:54 snapclass-production app/heroku-postgres:  source=HEROKU_POSTGRESQL_WHITE measure.current_transaction=1077 measure.db_size=6153016bytes measure.tables=0 measure.active-connections=3 measure.waiting-connections=0 measure.index-cache-hit-rate=0.99981 measure.table-cache-hit-rate=0.99349
Jun 18 15:52:06 snapclass-production heroku/router:  at=error code=H10 desc="App crashed" method=GET path=/ host=www.snapclass.com fwd="46.165.195.139" dyno= connect= service= status=503 bytes= 
Jun 18 15:52:07 snapclass-production heroku/router:  at=error code=H10 desc="App crashed" method=GET path=/ host=www.snapclass.com fwd="178.255.152.2" dyno= connect= service= status=503 bytes= 
Jun 18 15:52:12 snapclass-production app/postgres:  [47-1]  [] LOG:  checkpoint starting: time 
Jun 18 15:52:13 snapclass-production app/postgres:  [48-1]  [] LOG:  checkpoint complete: wrote 0 buffers (0.0%); 0 transaction …
Run Code Online (Sandbox Code Playgroud)

heroku heroku-postgres

19
推荐指数
3
解决办法
4万
查看次数