[RUBY] Erreur Postgres "PG :: ConnectionBad"

Je suis tombé dessus plusieurs fois, alors j'ai fait une petite note

PG::ConnectionBad

could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?

スクリーンショット 2020-09-10 22.17.38.png

% postgres -D /usr/local/var/postgres
2020-09-10 22:13:34.167 JST [8631] FATAL:  lock file "postmaster.pid" already exists
2020-09-10 22:13:34.167 JST [8631] HINT:  Is another postmaster (PID 494) running in data directory "/usr/local/var/postgres"?
% rm /usr/local/var/postgres/postmaster.pid

Supprimer postmaster.pid avec rm

% brew services restart postgresql

Je vais vous redémarrer.

% rails s

Commencer et vérifier

point

postmaster.pid reste Si postgresql n'est pas terminé normalement Le résultat de laisser un fichier appelé postmaster.pid Il semble qu'une erreur qui ne peut pas être démarrée se produit.

Je vais l'étudier un peu plus en détail et le mettre à jour à nouveau. Il semble nécessaire de disposer d'un mécanisme pour démarrer et arrêter postgresql Jusqu'au mémo cette fois.

Article de référence

https://qiita.com/great084/items/98c83364f246473249c4

Recommended Posts

Erreur Postgres "PG :: ConnectionBad"