Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to service running on different ip address #13

Closed
wildart opened this issue Aug 18, 2014 · 5 comments
Closed

Cannot connect to service running on different ip address #13

wildart opened this issue Aug 18, 2014 · 5 comments

Comments

@wildart
Copy link

wildart commented Aug 18, 2014

When I specify in cocaine-runtime configuration explicitly IP address of the locator:

"locator": {
    "endpoint": "10.0.0.1"
}

cocaine-tool cannot connect to node service because it defaults to localhost address.

 > cocaine-tool info --host=10.0.0.1 --debug=all
[2014-08-18 14:16:22,154] cocaine.asio.service: DEBUG   : Connecting to the service "locator", candidates: [(2, 1, 6, '', ('10.0.0.1', 10053))]
[2014-08-18 14:16:22,155] cocaine.asio.service: DEBUG   :  - connecting to "6 ('10.0.0.1', 10053)"
[2014-08-18 14:16:22,155] cocaine.asio.service: DEBUG   :  - success
[2014-08-18 14:16:22,157] cocaine.asio.service: DEBUG   : Connecting to the service "node", candidates: [(2, 1, 6, '', ('127.0.1.1', 36045))]
[2014-08-18 14:16:22,157] cocaine.asio.service: DEBUG   :  - connecting to "6 ('127.0.1.1', 36045)"
[2014-08-18 14:16:22,157] cocaine.asio.service: DEBUG   :  - failed - 127.0.1.1:36045 - connection refused
[2014-08-18 14:16:22,157] cocaine.tools: ERROR   : Unknown error occurred - test:36045 - service resolving failed. Reason: [127.0.1.1:36045 - connection refused]
@noxiouz
Copy link
Member

noxiouz commented Aug 18, 2014

A resolvation response from Cocaine locator looks similar to:

[['hostname', 60085],
 1,
 {0: 'start_app', 1: 'pause_app', 2: 'list'}]

So the hostname from this responce goes through getaddrinfo to resolve into IP. Seems that your hostname can't be resolved into 10.0.0.1. Could you check it? For example, using that with a replaced hostname:

python -c "import socket; print socket.getaddrinfo('localhost', 10053, 0, socket.SOCK_STREAM); "

@wildart
Copy link
Author

wildart commented Aug 18, 2014

Here is a netstat dump:

tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -                
tcp        0      0 10.0.0.1:10053          0.0.0.0:*               LISTEN      27203/cocaine-runti
tcp        0      0 10.0.0.1:55238          0.0.0.0:*               LISTEN      27203/cocaine-runti
tcp        0      0 10.0.0.1:52778          0.0.0.0:*               LISTEN      27203/cocaine-runti
tcp        0      0 10.0.0.1:46262          0.0.0.0:*               LISTEN      27203/cocaine-runti
tcp6       0      0 ::1:631                 :::*                    LISTEN      -               
tcp6       0      0 :::5000                 :::*                    LISTEN      -    

As soon as I specify the locator address in cocaine-runtime configuration, all services start running on this address, i.e. node, storage and logger.

@wildart
Copy link
Author

wildart commented Aug 18, 2014

getaddrinfo returns 127.0.0.1, but network address of the machine is 10.0.0.1

@noxiouz
Copy link
Member

noxiouz commented Aug 18, 2014

As I expected.. So you could sort this out by adding 10.0.0.1 address for your hostname into /etc/hosts or configure DNS.
PS. We're thinking about getting rid of this inconvenience by replying with a list of suitable addresses in the next version of Cocaine

@wildart
Copy link
Author

wildart commented Aug 18, 2014

Solved, thanks.

@wildart wildart closed this as completed Aug 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants