ruby-on-rails - 如何连接到数字海洋服务器中的远程数据库
问题描述
我在 Windows 本地机器上有一个 rails 应用程序,我在数字海洋服务器 [ubuntu 服务器] 中有一个 postgresql 远程数据库。如何连接它,我试过这样:
数据库.yml
default: &default
adapter: postgresql
encoding: unicode
host: xxx.xxx.xxx.xx
username: username
password: password
schema_search_path: "public,shared_extensions"
# For details on connection pooling, see Rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: database_name
当我重新启动服务器时出现错误
could not connect to server: Connection timed out (0x0000274C/10060) Is the server running on host "xxx.xxx.xxx.xx" and accepting TCP/IP connections on port 5432?
我在做正确的程序吗?谁能帮我解决这个问题?
解决方案
推荐阅读
- google-apps-script - 抱歉,无法提交表单回复。当表单正在收集电子邮件地址时,formResponse.submit() 不起作用
- python-3.x - 在 Pandas DataFrame 中使用来自同一列且在另一列中具有匹配值的值填充空值
- sas - 带有日期桶的 SAS 平均值
- javascript - 调整窗口大小时画布元素没有响应
- linux - DD 脚本和操作数预期错误
- react-native - 谷歌字体不会导入到 React 本机应用程序中
- javascript - 如何在饼图js中显示来自数据库的百分比数据?
- multithreading - printfs 在 kubernetes 环境中挂起
- javascript - 从随机端点返回相同信息的 GET 请求
- rust - 在 Rust 中解绑引用最惯用的方法是什么?