PostgreSQL 서버가 중지되지 않음
Postgre와 약간의 문제가 있습니다.Mac OS X 10.8.4에서 SQL을 사용할 수 있습니다.실수로.brew rm postgresql --forcepostgres 서버가 실행되는 동안.를 사용하여 설치한 경우brew install postgresql그리고 뛰었습니다.pg_ctl -D /usr/local/var/postgres start이해합니다.
pg_ctl: another server might be running; trying to start server anyway
server starting
FATAL: lock file "postmaster.pid" already exists
HINT: Is another postmaster (PID 752) running in data directory "/usr/local/var/postgres"?
"ps -ef | grep postgres"를 실행하면 다음과 같이 표시됩니다.
501 752 235 0 12:42PM ?? 0:00.01 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log
501 754 752 0 12:42PM ?? 0:00.00 postgres: checkpointer process
501 755 752 0 12:42PM ?? 0:00.34 postgres: writer process
501 756 752 0 12:42PM ?? 0:00.02 postgres: wal writer process
501 757 752 0 12:42PM ?? 0:00.01 postgres: autovacuum launcher process
501 758 752 0 12:42PM ?? 0:00.01 postgres: stats collector process
501 945 452 0 12:58PM ttys000 0:00.00 grep postgres
서버를 중지하려고 할 때pg_ctl stop -D /usr/local/var/postgres -m fast또는pg_ctl -D /usr/local/var/postgres stop -mi이해합니다.
waiting for server to shut down........................................... Failed
pg_ctl: server does not shut down
편집
which pg_ctl
/usr/local/bin/pg_ctl
pg_ctl --version
pg_ctl (PostgreSQL) 9.2.4
의 요지server.log: https://gist.github.com/anonymous/6106182
같은 문제가 있었습니다.pg_ctl: server does not shut down.더 나아가,ps auxwww | grep postgres실행 중인 포스트그레스를 보여주지 않았습니다.pg_ctl -D /usr/local/var/postgres status포스트그레스가 실행 중임을 보여주었습니다.Mac을 다시 시작하는 것은 도움이 되지 않았습니다. SMC를 재설정하는 데까지 갔지만, 이 SOQ/A를 통해 다음에 찾아야 할 사항, 즉 양조 문제에 대한 아이디어를 얻을 수 있었습니다.
이러한 생각을 한 후, 저는 이 문제를 해결해 주는 다음 명령으로 이어지는 유용한 블로그 게시물을 발견했습니다.
$ brew services list
$ brew services restart postgresql
이것이 누군가에게 도움이 되기를 바랍니다.
업데이트 - 알 수 없는 명령: 서비스
댓글 중 하나('Unknown command: services')에 이어 약간의 조사 끝에 Homebrew의 작성자들이 제거하기로 결정했다는 것을 알게 되었습니다.services아무도 이 코드를 유지하고 싶어하지 않는 것으로 보아 레포에서.
자세한 내용은 여기와 여기에서 확인하실 수 있습니다(관련 깃허브 티켓).
좀 더 파본 후에, 저는 이 보고서를 발견했습니다.services맥에서
이것이 제가 돌아온 방법입니다.services:
~ » brew tap gapple/services
~ » brew services
usage: [sudo] brew services [--help] <command> [<formula>]
Small wrapper around `launchctl` for supported formulae, commands available:
cleanup Get rid of stale services and unused plists
list List all services managed by `brew services`
restart Gracefully restart selected service
start Start selected service
stop Stop selected service
Options, sudo and paths:
sudo When run as root, operates on /Library/LaunchDaemons (run at boot!)
Run at boot: /Library/LaunchDaemons
Run at login: /Users/user/Library/LaunchAgents
여기 또 다른 제안 솔루션이 있습니다: https://apple.stackexchange.com/questions/150300/need-help-using-homebrew-services-command .제가 직접 확인하지 않아서, 어떻게 작동하는지 모르겠습니다.
$ brew services list
$ brew services stop postgresql
정지중postgresql하지만 시간이 좀 걸릴 수 있습니다 → 성공적으로 중지됨postgresql(라벨: homebrew.sblucl.postgresql)
저도 같은 문제를 겪고 있었어요발사 에이전트를 제거하는 것이 문제를 해결했습니다.
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
저도 비슷한 문제가 있었습니다.나는 며칠 전에 '점심'을 통합하고 plist를 시작하기 위해 launchctl 래퍼로 사용하고 있다는 것을 잊고 있었습니다.~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist시작할 때. pg_ctl은 다음 코드 행 때문에 효과적이지 않았습니다.<key>KeepAlive<key>:
<?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 <plist version="1.0">
4 <dict>
5 <key>KeepAlive</key>
6 <true/>
7 <key>Label</key>
8 <string>homebrew.mxcl.postgresql</string>
9 <key>ProgramArguments</key>
10 <array>
11 <string>/usr/local/opt/postgresql/bin/postgres</string>
12 <string>-D</string>
13 <string>/usr/local/var/postgres</string>
14 <string>-r</string>
15 <string>/usr/local/var/postgres/server.log</string>
16 </array>
17 <key>RunAtLoad</key>
18 <true/>
19 <key>WorkingDirectory</key>
20 <string>/usr/local</string>
21 <key>StandardErrorPath</key>
22 <string>/usr/local/var/postgres/server.log</string>
23 </dict>
24 </plist>
플리스트를 내려야 하기 때문에 공정을 직접 죽이려 해도 소용이 없었습니다.
launchctl unload homebrew.mxcl.postgresql.plist
명령을 사용하여 이 오류를 해결했습니다.
pg_ctl stop -m immediate
pg_ctl start
저는 이런 식으로 리스트를 내릴 필요가 없었습니다.
알고 보니 내 양조주였어요postgres의 plist는 ~/Library/LaunchAgents/에서 언로드하고 제거해야 합니다. 다시 시작한 후에는 모두 정상입니다...마지막 문제
Brew-installed Postgre에 의존하는 경우SQL을 종료하기 위해 다음 명령이 작동했습니다.
> brew services stop postgresql
stopping `postgresql`... (might take a while)
==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
다른 답변에서 언급했듯이 프로세스 목록을 훑어본 다음 포스트그레스와 관련된 모든 것을 죽이는 것은 효과가 없습니다.
ps aux | grep postgres
kill $PID
나는 없었습니다.postgres됨을 통해 brew services그래서 그런 식으로 멈출 수 없었습니다.
효과가 있었어요.
$ ps -ef | grep postgres
501 547 1 0 2:07pm ?? 0:00.29 /Applications/Postgres.app/Contents/Versions/9.6/bin/postgres -D /Users/username/Library/Application Support/Postgres/var-9.6 -p 5432
사용하다-D위에서 파라미터를 지정합니다.
$ pg_ctl stop -D "/Users/username/Library/Application Support/Postgres/var-9.6"
언급URL : https://stackoverflow.com/questions/17930167/postgresql-server-wont-stop
'codememo' 카테고리의 다른 글
| MongoDB 쿼리 도움말 - 하위 개체에 있는 키 값에 대한 쿼리 (0) | 2023.05.08 |
|---|---|
| 튜플 목록에서 요소 찾기 (0) | 2023.05.08 |
| PHP의 Excel로 MySQL 데이터 내보내기 (0) | 2023.05.08 |
| Swift: print() vs println() vs NSLog() (0) | 2023.05.03 |
| 각 ng 모듈의 엔트리 구성 요소란 무엇입니까? (0) | 2023.05.03 |