ไม่สามารถปิด postmaster เก่าเมื่ออัปเกรดเป็น Postgres 9.2


13

ฉันกำลังอัปเกรดเป็น Postgres 9.2.2 (จาก 9.1.4) เมื่อฉันพยายามอัพเกรด DBs โดยใช้:

pg_upgrade -b /usr/local/Cellar/postgresql/9.1.4/bin -B /usr/local/Cellar/postgresql/9.2.2/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres

ฉันได้รับข้อความแสดงข้อผิดพลาดต่อไปนี้:

Performing Consistency Checks
-----------------------------
Checking current, bin, and data directories                 ok

There seems to be a postmaster servicing the old cluster.
Please shutdown that postmaster and try again.
Failure, exiting

ฉันพยายามหยุดเซิร์ฟเวอร์ แต่ไม่สามารถให้คำสั่งอัปเกรดทำงานได้ ฉันจะปิดนายไปรษณีย์เก่าได้อย่างไร

คำตอบ:


11

postmaster.pidควรจะอยู่ในรุ่นก่อนหน้าของusr/local/varโฟลเดอร์ เพียงแค่เปลี่ยนชื่อไฟล์นี้ควรแก้ปัญหา


ฉันเจอปัญหานี้สองสามครั้งเช่นกันและนี่คือคำตอบที่ดี การหยุดอินสแตนซ์ทั้งหมดของ postgres ก่อนที่จะอัปเกรดควรเป็นประเด็นที่เกี่ยวข้องด้วย
Jerome

4

ใน OS X Yosemite หลังจากติดตั้ง PostgreSQL ผ่าน Homebrew:

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

1
วิธีนี้ไม่ได้แก้ไขปัญหา หากpg_ctl -D /usr/local/var/postgres/ stopผลตอบแทนแล้วคุณควรNo such process rm /usr/local/var/postgres/postmaster.pid
Andrew

1

ในระบบยูนิกซ์ส่วนใหญ่คุณจะพบสคริปต์/etc/init.dเริ่มต้นที่คุณสามารถใช้เพื่อเริ่ม, เริ่มต้นใหม่, โหลดซ้ำหรือหยุดบริการยูนิกซ์

เช่น

sudo /etc/init.d/postgresql stop

หากนี่ไม่พร้อมใช้งานคุณสามารถใช้ pg_ctl stop

เช่น

su - postgres
bash-3.1$ pg_ctl stop  # normal stop
bash-3.1$ pg_ctl stop -m s # smart stop
bash-3.1$ pg_ctl stop -m f # fast stop
bash-3.1$ pg_ctl stop -m i # immediate stop

เพิ่มเติมเกี่ยวกับ pg_ctl

http://www.postgresql.org/docs/9.1/static/app-pg-ctl.html

แก้ไข ถ้าคุณยังได้รับข้อผิดพลาดและคุณแน่ใจว่า postmaster ไม่ทำงานอีกต่อไป (ตรวจสอบด้วยsudo ps aux | grep "postmaster"- ควรส่งคืนหนึ่งบรรทัดเท่านั้น) คุณยังคงมีไฟล์ pid หลังจากปิดระบบไม่สะอาด

ลบ pidfile เช่น

> sudo -u postgres mv /var/lib/postgres/data-9.1/postmaster.pid /tmp

1
เมื่อฉันลองpg_ctl stopฉันจะได้รับ: pg_ctl: no database directory specified and environment variable PGDATA unset. BTW luciano$ ps auxwww | grep postgresluciano 995 0.0 0.0 2434892 548 s000 R+ 10:42PM 0:00.00 grep postgresเซิร์ฟเวอร์ไม่มีดูเหมือนว่าจะทำงาน:
Luciano

grep สำหรับ postmaster

อัปเดตคำตอบพร้อมข้อมูลเพิ่มเติม

ไม่มีโชค:sudo ps aux | grep "postmaster" luciano 3101 0.0 0.0 2434892 548 s002 S+ 9:12PM 0:00.00 grep postmaster
Luciano

แก้ไขปัญหาแล้ว ดูคำตอบของฉัน
Luciano

0

บน Ubuntu ให้หยุดบริการ PostgreSQL ก่อนทำการอัปเกรด สิ่งนี้จะหยุดอินสแตนซ์ทั้งหมดของ postgres โดยไม่คำนึงถึงรุ่นที่ติดตั้ง

service postgresql stop

โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.