【问题标题】:PostgreSQL still not working after Yosemite install安装优胜美地后 PostgreSQL 仍然无法工作
【发布时间】:2014-12-08 23:33:50
【问题描述】:

因此,自从优胜美地升级以来,我在尝试让我的 postgresql 数据库在我的 Rails 应用程序上运行时仍然遇到问题。我希望我现在永远不会升级。我在网上搜索过,stackoverflow 上有一个关于这个问题的相关问题。

`pg_tblspc` missing after installation of latest version of OS X (Yosemite or El Capitan)

我在命令行上遇到同样的错误。

No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

在我的网络浏览器中,它给了我 PG::ConnectionBad 错误。 我通过添加三个丢失的目录pg_tblspc,pg_twophase,pg_stat_tmp 解决了@Donovan 为解决问题而提出的解决方案,出于某种原因优胜美地摆脱了这些目录。我运行了所有正确的命令行操作,但仍然收到相同的错误并且没有运气。这也是我的 database.yml 文件的样子。

# PostgreSQL. Versions 8.2 and up are supported.
#
# Install the pg driver:
#   gem install pg
# On Mac OS X with macports:
#   gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
#   gem install pg
#       Choose the win32 build.
#       Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'pg'
#
development:
  adapter: postgresql
  encoding: unicode
  database: task_manager_development
  pool: 5


# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
# host: localhost
# port: 5432

# Schema search path. The server defaults to $user,public
#schema_search_path: myapp,sharedapp,public

# Minimum log levels, in increasing order:
#   debug5, debug4, debug3, debug2, debug1,
#   log, notice, warning, error, fatal, and panic
# The server defaults to notice.
#min_messages: warning

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
 adapter: postgresql
 encoding: unicode
 database: task_manager_test
 pool: 5


production:
 adapter: postgresql
 encoding: unicode
 database: task_manager_production
 pool: 5

我也尝试取消注释掉本地主机和端口 5432,但仍然没有运气。我在这里真的需要帮助。基本上我在网上阅读的所有其他内容也都说添加这些多个目录并重新启动你的 postgresql 应该可以解决问题,但它对我没有用。我一定没有正确地做某事或遗漏了什么。我正在考虑重新安装自制软件和 ROR,但我担心我可能会丢失我的 ROR 应用程序中的所有数据。任何帮助都会很棒!

【问题讨论】:

  • 你考虑过从源代码安装吗? (如果你安装在你的主目录下,那也会更简单:./configure --prefix=/Users/your_user/opt;make;make install。)我一直在推迟升级......
  • 你的意思是从我的rails应用程序的源或目录重新启动postgresql?
  • 您可能还想检查提到的各种文件和目录的权限/所有权。
  • 我该怎么做? @DmitriGoldring?
  • 使用 'ls -l' 列出 db 目录(您在其中创建这些目录)中的文件,您应该会看到一个用户名和一个组(该组可能是人员)。确保用户名与目录中的其他文件匹配。如果没有,您可以使用 chown 命令来修复所有权。权限位于“ls”输出的开头,并且还应与其余目录匹配。

标签: ruby-on-rails postgresql osx-yosemite


【解决方案1】:

编辑您的 postgresql.conf 文件并添加以下内容:

unix_socket_directory = '/tmp/'

然后重启postgres

【讨论】:

  • 如何从命令行执行此操作?我是否真的尝试在我的文本编辑器中打开文件?还是您在我的 database.yml 文件中谈论?
  • 好的,我相信我在连接和身份验证区域找到了它。这目前已被注释掉,#unix_socket_directories = '/tmp' # comma-separated list of directories 我应该取消注释,保存,然后重新启动,看看它是否有效?对不起,我是这个 postgresql 调试的新手。
  • 是的。它可能会将文件保存到另一个目录,而您的客户端正在该目录中查找。
  • @Joe_Love 我认为它纠正了一些问题,但现在它在重新启动服务器后告诉我......
  • LOG: could not open temporary-files directory "pg_tblspc/.keep/PG_9.3_201306121/pgsql_tmp": Not a directory LOG: could not open tablespace directory "pg_tblspc/.keep/PG_9.3_201306121": Not a directory LOG: database system was interrupted while in recovery at 2014-12-12 13:42:00 CST HINT: This probably means that some data is corrupted and you will have to use the last backup for recovery. LOG: database system was not properly shut down; automatic recovery in progress FATAL: could not open directory "pg_stat": No such file or directory
猜你喜欢
  • 2023-03-09
  • 1970-01-01
  • 1970-01-01
  • 2014-12-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多