Ruby on rails 找不到Rails和远程Postgres数据库
在一台远程机器上,我有一个Ruby on rails 找不到Rails和远程Postgres数据库,ruby-on-rails,database,postgresql,remote-server,Ruby On Rails,Database,Postgresql,Remote Server,在一台远程机器上,我有一个cardano节点,该节点连接到一个创建名为“cexplorer”的postgress数据库的服务器 $psql-cexplorer psql(13.1(Ubuntu 13.1-1.pgdg20.04+1),服务器12.5(Ubuntu 12.5-1.pgdg20.04+1)) 键入“帮助”以获取帮助。 cexplorer=#\l 数据库清单 姓名|所有者|编码|校对| Ctype |访问权限 -----------+-----------------+--------
cardano节点
,该节点连接到一个创建名为“cexplorer”的postgress数据库的服务器
$psql-cexplorer
psql(13.1(Ubuntu 13.1-1.pgdg20.04+1),服务器12.5(Ubuntu 12.5-1.pgdg20.04+1))
键入“帮助”以获取帮助。
cexplorer=#\l
数据库清单
姓名|所有者|编码|校对| Ctype |访问权限
-----------+-----------------+----------+-------------+-------------+-----------------------
cexplorer | learnco|u项目| UTF8 | en|u GB.UTF-8 | en|u GB.UTF-8 |
博士后|博士后| UTF8 | en|U GB.UTF-8 | en|U GB.UTF-8 |
模板0 | postgres | UTF8 | en|u GB.UTF-8 | en|u GB.UTF-8 |=c/postgres+
|| | | | postgres=CTc/postgres
模板1 | postgres | UTF8 | en|u GB.UTF-8 | en|u GB.UTF-8 |=c/postgres+
|| | | | postgres=CTc/postgres
现在我想创建一个连接到该数据库的Rails项目
所以在rails新后端--api
之后,我修改了config/dadabase.yml
开发:
首先运行rake db:create
,应用程序将无错误加载,并连接到远程数据库。您能发布整个堆栈跟踪吗?主机是否正确?我添加了堆栈跟踪,是的,主机是否正确,事实上,当我尝试访问postgres
或template0
数据库时,没有出现错误,标准rails页面已正确加载。请尝试从运行rails的计算机连接到cexplorer,但是对于psql.5432门似乎是关着的,我不明白为什么,因为它是portforwarded的,防火墙允许它。。我对其他门也有相同的设置,它们是打开的$netstat-na | grep 5432
tcp 0 127.0.0.1:5432 0.0.0.0:*听
FATAL: database "cexplorer" does not exist
ActiveRecord::NoDatabaseError
FATAL: database "cexplorer" does not exist
Extracted source (around line #50):
48
49
50
51
52
53
rescue ::PG::Error => error
if error.message.include?(conn_params[:dbname])
raise ActiveRecord::NoDatabaseError
else
raise
end
Rails.root: /Users/sergio/Documents/github/learn/front-end/cardano-delegations-slowmo/backend
Application Trace | Framework Trace | Full Trace
activerecord (6.0.3.4) lib/active_record/connection_adapters/postgresql_adapter.rb:50:in `rescue in postgresql_connection'
activerecord (6.0.3.4) lib/active_record/connection_adapters/postgresql_adapter.rb:33:in `postgresql_connection'
activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection'
activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection'
activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection'
activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection'
activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:593:in `checkout'
activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:437:in `connection'
activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:1119:in `retrieve_connection'
activerecord (6.0.3.4) lib/active_record/connection_handling.rb:221:in `retrieve_connection'
activerecord (6.0.3.4) lib/active_record/connection_handling.rb:189:in `connection'
activerecord (6.0.3.4) lib/active_record/migration.rb:562:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.0.3.4) lib/active_support/callbacks.rb:101:in `run_callbacks'
actionpack (6.0.3.4) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.0.3.4) lib/rails/rack/logger.rb:37:in `call_app'
railties (6.0.3.4) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.0.3.4) lib/active_support/tagged_logging.rb:80:in `block in tagged'
activesupport (6.0.3.4) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (6.0.3.4) lib/active_support/tagged_logging.rb:80:in `tagged'
railties (6.0.3.4) lib/rails/rack/logger.rb:26:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.2.3) lib/rack/runtime.rb:22:in `call'
activesupport (6.0.3.4) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/static.rb:126:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/host_authorization.rb:82:in `call'
railties (6.0.3.4) lib/rails/engine.rb:527:in `call'
puma (4.3.6) lib/puma/configuration.rb:228:in `call'
puma (4.3.6) lib/puma/server.rb:713:in `handle_request'
puma (4.3.6) lib/puma/server.rb:472:in `process_client'
puma (4.3.6) lib/puma/server.rb:328:in `block in run'
puma (4.3.6) lib/puma/thread_pool.rb:134:in `block in spawn_thread'