在Yosemite上卸载Postgres并重新安装Postgres 9.3

时间:2015-02-06 09:42:46

标签: ruby-on-rails postgresql

我尝试设置项目https://github.com/harrystech/prelaunchr。它失败了,因为我似乎有多个Postgres问题。

我最近的问题是:

 The data directory was initialized by PostgreSQL version 9.3, which is not compatible with this version 9.4.0.

经过多种不同的方式,我想立即卸载Postgres并设置Postgres 9.3

我该怎么做?

谢谢你, 本杰明

更新

我设法切换回PG 9.3。但是当我尝试使用以下命令启动服务器时:

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start

我明白了:

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 2015-02-06 01:11:40 PST
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
LOG:  startup process (PID 13187) exited with exit code 1
LOG:  aborting startup due to startup process failure

2 个答案:

答案 0 :(得分:2)

我希望这会对你有所帮助:

mkdir -p /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp,pg_stat}/.keep

答案 1 :(得分:-2)

在您的开发环境中,我建议您执行EASY / STANDARD事务。

更改config / database.yml文件以使用SQLITE。

default: &default
  adapter: sqlite3
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

您可能还需要更改Gemfile以包含sqlite。 IMO,在本地运行postgres是一种不必要的痛苦,除非您正在为某些postgres特定功能开发。这个应用程序不是,所以省去你自己的麻烦。