Cannot assign requested address - bind(2) (Errno::EADDRNOTAVAIL)
Asked Answered
C

5

11

I am using rail for teambox at centos 6.3 server, actually this is just a trial and error before applying it live.

  • I'm using 2 virtual box that running on same centos version and exact copy, VM2 is only run mysql that will be remote from VM1
  • I have tried mysql connection #nc and it's connected
  • VM1 (192.168.7.201) & VM2 (192.168.7.202 running MYSQL)
  • I have bind-address on remote machine (VM2) in my.cnf with bind-address=192.168.7.202
  • here's my database.yml

development:
adapter: mysql
host: 192.168.7.202
port: 3306
username: teambox
password: pass
database: teambox

and I am trying to run with #rails server -e development -b 192.168.7.202 and giving this error

Exiting
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/tcphack.rb:12:in `initialize_without_backlog': Cannot assign requested address - bind(2) (Errno::EADDRNOTAVAIL)

please help me out

Cardialgia answered 13/12, 2012 at 6:4 Comment(0)
T
13

try this

rails server -e development -b 0.0.0.0 -p 3000

0.0.0.0 means it listens on all IPv4 addresses on the local machine

Timbal answered 20/10, 2016 at 21:54 Comment(1)
Just rails s -b 0.0.0.0 did it for me.Tera
S
2

Rails 5.0.0.1 server not working without IPv6.

You need to enable IPv6 from /etc/sysctl.conf file(IPv6 is enabled by default).

Remove or comment these lines if you have any.

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

net.ipv6.conf.lo.disable_ipv6 = 1

Reboot the server to enable IPv6. Try:

rails server
Strut answered 16/10, 2016 at 7:37 Comment(0)
B
0

This means the server is already running on that port

try

rails server -e development -p 3001 -b 192.168.7.202
Blocky answered 13/12, 2012 at 6:7 Comment(2)
i leave default port with 3000, forgot to tel, im installing this two machine with ruby and gems, does it makes the problem too?Cardialgia
As in a few other comments, the error is EADDRNOTAVAILABLE. If something were running on that port, the error would be EADDRINUSE.Choir
K
0

Try as following:

development:
 adapter: mysql
 host: 127.0.0.1
 port: 3306
 username: teambox
 password: pass
 database: teambox


(or)

development:
 adapter: mysql
 host: localhost
 port: 3306
 username: teambox
 password: pass
 database: teambox


I think any of the above will work.

Kayne answered 13/12, 2012 at 6:8 Comment(2)
it will work just on localhost and that work, but i want mysql run on separate machine thats VM2 (192.168.7.202)Cardialgia
rails s -E development -b 192.168.7.202Kayne
I
-1

The error is coming becuase 3000 port is already in use. And the command is trying to run in the same port. so change the port and run. add this also -p 3002

Inerrable answered 13/12, 2012 at 6:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.