ruby on rails - Postgres server not starting after unexpected Yosemite shutdown -
i'm trying start rails server i'm getting error...
/users/kweihe/.rvm/gems/ruby-2.1.6/gems/activerecord-3.2.22/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `initialize': not connect server: connection refused (pg::connectionbad) server running on host "localhost" (::1) , accepting tcp/ip connections on port 5432? not connect server: connection refused server running on host "localhost" (127.0.0.1) , accepting tcp/ip connections on port 5432?
if check postgres server processes ...
kweihe-mac:pmpaware-webapp kweihe$ ps auxw | grep postgres kweihe 11687 0.0 0.0 2432772 636 s000 s+ 10:56am 0:00.00 grep postgres
so i've tried following ...
kweihe-mac:pmpaware-webapp kweihe$ rm -rf /usr/local/var/postgres kweihe-mac:pmpaware-webapp kweihe$ initdb /usr/local/var/postgres files belonging database system owned user "kweihe". user must own server process. database cluster initialized locale "en_us.utf-8". default database encoding has accordingly been set "utf8". default text search configuration set "english". data page checksums disabled. fixing permissions on existing directory /usr/local/var/postgres ... initdb: not change permissions of directory "/usr/local/var/postgres": operation not permitted kweihe-mac:pmpaware-webapp kweihe$ chmod 0700 /usr/local/var/postgres chmod: unable change file mode on /usr/local/var/postgres: operation not permitted
so checked permissions ...
kweihe-mac:pmpaware-webapp kweihe$ cd /usr/local/var/ kweihe-mac:var kweihe$ ls -l total 0 drwxr--r-- 2 root admin 68 jul 22 10:59 postgres kweihe-mac:var kweihe$
and tried enable permissions ...
kweihe-mac:var kweihe$ chmod 777 postgres chmod: unable change file mode on postgres: operation not permitted
so got there ...
kweihe-mac:pmpaware-webapp kweihe$ rm -rf /usr/local/var/postgres kweihe-mac:pmpaware-webapp kweihe$ initdb /usr/local/var/postgres -e utf8 files belonging database system owned user "kweihe". user must own server process. database cluster initialized locale "en_us.utf-8". default text search configuration set "english". data page checksums disabled. creating directory /usr/local/var/postgres ... ok creating subdirectories ... ok selecting default max_connections ... 100 selecting default shared_buffers ... 128mb selecting dynamic shared memory implementation ... posix creating configuration files ... ok creating template1 database in /usr/local/var/postgres/base/1 ... ok initializing pg_authid ... ok initializing dependencies ... ok creating system views ... ok loading system objects' descriptions ... ok creating collations ... ok creating conversions ... ok creating dictionaries ... ok setting privileges on built-in objects ... ok creating information schema ... fatal: lock file "postmaster.pid" exists hint: postmaster (pid 11413) running in data directory "/usr/local/var/postgres"? child process exited exit code 1 initdb: removing data directory "/usr/local/var/postgres" not remove file or directory "/usr/local/var/postgres": directory not empty initdb: failed remove data directory
looks problem running launchctl
process depends on /usr/local/var/postgres
. in case, thesolution stop
launchctl unload ~/library/launchagents/homebrew.mxcl.postgresql.plist
finish off (removing directory in case partially created before)
rm -rf /usr/local/var/postgres initdb /usr/local/var/postgres
Comments
Post a Comment