Postgres-치명적 : 데이터베이스 파일이 서버와 호환되지 않습니다.
MacBook Pro를 재시동 한 후 데이터베이스 서버를 시작할 수 없습니다.
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
로그를 확인한 결과 다음 줄이 계속해서 나타납니다.
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.2, which is not compatible with this version 9.0.4.
9.0.4는 Mac에 사전 설치된 버전이고 9.2 [.4]는 Homebrew를 통해 설치 한 버전입니다. 언급했듯이 이것은 다시 시작하기 전에 작동 했으므로 실제로 컴파일 문제가 될 수 없습니다. 나는 또한 다시 실행 initdb /usr/local/var/postgres -E utf8
했고 파일은 여전히 존재합니다.
불행히도 저는 Postgres를 처음 접했기 때문에 어떤 도움이라도 대단히 감사하겠습니다.
Mac을 사용 중이고 최근에 10.x에서 11로 업그레이드 한 경우 아래 명령을 실행하여 모든 데이터를 유지하는 postgres 데이터 디렉터리를 업그레이드 할 수 있습니다.
brew postgresql-upgrade-database
위의 명령은 brew info postgres
핵 옵션을 찾고 있다면 (모든 데이터를 삭제하고 새로운 데이터베이스를 얻으십시오) 다음을 수행 할 수 있습니다.
rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -E utf8
그런 다음 다시 설정하려면 Rails 앱을 rake db:setup
오고 rake db:migrate
가야합니다.
이것을보십시오 : https://gist.github.com/joho/3735740
그것은 나를 위해 완벽하게 작동했습니다. 결국 DB를 확인하고 이전 클러스터를 제거하는 2 개의 bash 스크립트도 생성합니다. 정말 대단합니다.
자세한 내용은 http://www.postgresql.org/docs/9.2/static/pgupgrade.html 을 참조하십시오 .
인터넷에서 찾은이 솔루션은 저에게 잘 작동합니다.
OS X 10.10 Yosemite로 업그레이드 한 후 postgresql 서버를 시작하려고 할 때 다음 문제가 발생했습니다.
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
좋습니다. 서버 로그를 살펴 보겠습니다.
cat /usr/local/var/postgres/server.log
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.2, which is not compatible with this version 9.3.5.
따라서 postgresql을 업그레이드 한 후 몇 가지 단계를 수행해야합니다.
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
mv /usr/local/var/postgres /usr/local/var/postgres92
brew update
brew upgrade postgresql
initdb /usr/local/var/postgres -E utf8
pg_upgrade -b /usr/local/Cellar/postgresql/9.2.3/bin -B /usr/local/Cellar/postgresql/9.3.5_1/bin -d /usr/local/var/postgres92 -D /usr/local/var/postgres
cp /usr/local/Cellar/postgresql/9.3.5_1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
rm -rf /usr/local/var/postgres92
그게 다야.
이전 버전의 postgres를 유지하려면 brew switch
다음을 사용하십시오 .
$ brew info postgresql
postgresql: stable 10.5 (bottled), HEAD
Object-relational database system
https://www.postgresql.org/
Conflicts with:
postgres-xc (because postgresql and postgres-xc install the same binaries.)
/usr/local/Cellar/postgresql/9.6.3 (3,259 files, 36.6MB)
Poured from bottle on 2017-07-09 at 22:15:41
/usr/local/Cellar/postgresql/10.5 (1,705 files, 20.8MB) *
Poured from bottle on 2018-11-04 at 15:13:13
$ brew switch postgresql 9.6.3
$ brew services stop postgresql
$ brew services start postgresql
Otherwise, consider this brew command to migrate existing data: brew postgresql-upgrade-database
. Check out the source code.
It happened for me when I was trying to start Postgres12 with postgres11 mounted volume. Just deleting the mounted volume for postgres11 and restart worked for me.
Previously I was using:
docker run -d --name my_database -v /Users/champ/postgres:/var/lib/postgresql/data -p 54320:5432 postgres:11
I deleted /Users/champ/postgres and restarted postgres 12, using
docker run -d --name my_database -v /Users/champ/postgres:/var/lib/postgresql/data -p 54320:5432 postgres:12
'developer tip' 카테고리의 다른 글
Laravel 빈 흰색 화면 (0) | 2020.08.08 |
---|---|
테이블보기 결과가 없으면 화면에 "결과 없음"표시 (0) | 2020.08.08 |
Swift에서 경과 시간 측정 (0) | 2020.08.08 |
솔루션을 열 때 Visual Studio 2013이 중단됨 (0) | 2020.08.08 |
모든 첫 글자를 대문자로 변환하고 각 단어에 대해 더 낮게 유지 (0) | 2020.08.08 |