KONEČNÁ AKTUALIZÁCIA:
Zabudol som spustiť príkaz initdb
.
< /FINAL UPDATE>
spustením tohto príkazu
ps auxwww | grep postgres
Vidím, že postgres nie je spustený
> ps auxwww | grep postgres
remcat 1789 0.0 0.0 2434892 480 s000 R+ 11:28PM 0:00.00 grep postgres
To vyvoláva otázku: Ako môžem spustiť server postgresql?
aktualizovať:
>pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
server starting
sh: /usr/local/var/postgres/server.log: No such file or directory
aktualizácia 2:
Dotyk nebol úspešný, tak som namiesto toho urobil toto:
> mkdir /usr/local/var/postgres
> vi /usr/local/var/postgres/server.log
> ls /usr/local/var/postgres/
server.log
Ale keď sa pokúsim spustiť rails server, stále vidím toto:
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432?
update 3:
> pg_ctl -D /usr/local/var/postgres status
pg_ctl: no server running
aktualizácia 4:
Zistil som, že tam NIE JE pg_hba.conf (iba pg_hba.conf.sample), tak som upravil vzorku a premenoval ju (aby som odstránil .sample). Tu je obsah:
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
ale nerozumiem tomu:
> pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
server starting
> pg_ctl -D /usr/local/var/postgres status
pg_ctl: no server running
tiež:
sudo find / -name postgresql.conf
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
aktualizácia 5:
sudo pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Password:
pg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process.
aktualizácia 6:
To sa zdá byť zvláštne:
> egrep 'listen|port' /usr/local/var/postgres/postgresql.conf
egrep: /usr/local/var/postgres/postgresql.conf: No such file or directory
hoci som to urobil:
>sudo find / -name "*postgresql.conf*"
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/usr/local/Cellar/postgresql/9.0.4/share/postgresql/postgresql.conf.sample
/usr/share/postgresql/postgresql.conf.sample
tak som urobil toto:
egrep 'listen|port' /usr/local/Cellar/postgresql/9.0.4/share/postgresql/postgresql.conf.sample
#listen_addresses = 'localhost' # what IP address(es) to listen on;
#port = 5432 # (change requires restart)
# supported by the operating system:
# %r = remote host and port
tak som skúsil toto:
> cp /usr/local/Cellar/postgresql/9.0.4/share/postgresql/postgresql.conf.sample /usr/local/Cellar/postgresql/9.0.4/share/postgresql/postgresql.conf
> cp /usr/share/postgresql/postgresql.conf.sample /usr/share/postgresql/postgresql.conf
stále dostávam tú istú "Is the server running?" správu.
Správca balíkov Homebrew obsahuje súbory launchctl plists na automatické spustenie. Pre viac informácií spustite brew info postgres
.
Ručné spustenie:
pg_ctl -D /usr/local/var/postgres start
Ručné zastavenie:
pg_ctl -D /usr/local/var/postgres stop
Spustenie automaticky:
"Ak chcete, aby launchd spustil postgresql teraz a reštartoval ho pri prihlásení:"
brew services start postgresql
Aký je výsledok príkazu pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
?
Aký je výsledok príkazu pg_ctl -D /usr/local/var/postgres status
?
Sú v server.log nejaké chybové hlásenia?
Uistite sa, že v súbore pg_hba.conf je povolené pripojenie tcp localhost:
# IPv4 local connections:
host all all 127.0.0.1/32 trust
Skontrolujte listen_addresses a port v postgresql.conf:
egrep 'listen|port' /usr/local/var/postgres/postgresql.conf
#listen_addresses = 'localhost' # what IP address(es) to listen on;
#port = 5432 # (change requires restart)
Upratovanie
Postgres bol s najväčšou pravdepodobnosťou nainštalovaný prostredníctvom inštalátora Homebrew, Fink, MacPorts alebo EnterpriseDB.
Skontrolujte výstup nasledujúcich príkazov, aby ste zistili, pomocou ktorého správcu balíkov bol nainštalovaný:
brew && brew list|grep postgres
fink && fink list|grep postgres
port && port installed|grep postgres
Myslím, že na testovacie účely je aplikácia PostgreSQL najlepšou možnosťou!
Spustite aplikáciu a server je v prevádzke. Ak aplikáciu zatvoríte, server sa vypne.