ubuntu 14.04 - Postgres PG::ConnectionBad error coming while starting rails server -


i tried starting rails server , giving following issue:

neha@scs-i82:~/work/code/$ rails s => booting puma => rails 3.2.22 application starting in development on http://0.0.0.0:3000 => call -d detach => ctrl-c shutdown server exiting /home/neha/.rvm/gems/ruby-2.2.2@canvas/gems/activerecord-3.2.22/lib/active_record/connection_adapters/postgresql_adapter.rb:1222:in `initialize': fatal:  no pg_hba.conf entry host "[local]", user "postgres", database "dev2", ssl off (pg::connectionbad) 

when try start postgresql service giving following error:

neha@scs-i82:~/work/code/$ sudo service postgresql start   * starting postgresql 9.3 database server                                                                                                      * error: port conflict: instance running on /var/run/postgresql port 5432                                                                                                                                         [fail] 

my /etc/postgresql/9.3/main/pg_hba.conf file as:

# database administrative login unix domain socket local               postgres                                md5  # type  database        user            address                 method  # "local" unix domain socket connections local                                                   peer # ipv4 local connections: host                            127.0.0.1/32            md5 # ipv6 local connections: host                            ::1/128                 md5 # allow replication connections localhost, user # replication privilege. #local   replication     postgres                                peer #host    replication     postgres        127.0.0.1/32            md5 #host    replication     postgres        ::1/128                 md5 

also checked killing running process on port 5432 as:

neha@scs-i82:~/work/code/lms(ac-99)$ sudo lsof -t -i:3000 neha@scs-i82:~/work/code/lms(ac-99)$ sudo lsof -t -i:5432 9981 neha@scs-i82:~/work/code/lms(ac-99)$ sudo kill -9 9981 neha@scs-i82:~/work/code/lms(ac-99)$ sudo service postgresql start   * starting postgresql 9.3 database server                                                                                                      * error: port conflict: instance running on /var/run/postgresql port 5432 

can please suggest solution.

it may port 3000 allocated server.
fix issue ,you may try below command

$ lsof -i:3000

when press enter below output   command   pid user   fd   type device size/off node name ruby    12036  tps   12u  ipv4 331030      0t0  tcp *:3000 (listen) 

$ kill -9 12036

above command kill pid after run rails s


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -