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

Cassandra host could not be resolved #195

Closed
montanaflynn opened this issue May 1, 2015 · 17 comments
Closed

Cassandra host could not be resolved #195

montanaflynn opened this issue May 1, 2015 · 17 comments
Assignees
Labels
Milestone

Comments

@montanaflynn
Copy link

Someone in gitter reported that Kong could not connect to a kongdb.org Cassandra node, to make sure it wasn't kongdb we set them up with a new Cassandra node on AWS and they got the same error.

They were running Ubuntu 15.04 with Kong 0.2.0-2 but I verified it works on a brand new AWS machine so there's something else at play here, possibly related to #127 .

The initial migrations worked and connection with the host was verified with:

telnet kongdb.org 48134
Trying 52.5.149.55...
Connected to kongdb.org.

Starting up Kong:

kong start
[INFO] Using configuration: /etc/kong/kong.yml
[INFO] Proxy port.........8000
Admin API port.....8001
Database...........cassandra keepalive=60000 port=48134 timeout=1000 hosts=kongdb.org keyspace=kong
[WARN] ulimit is currently set to "1024". For better performance set it to at least "4096" using "ulimit -n"
[OK] Started

Trying to use Kong's admin API:

curl 127.0.0.1:8001/
{"message":"Cassandra error: kongdb.org could not be resolved (110: Operation timed out)"}
@pgeseraphin
Copy link

In kong.yml replace "kongdb.org" by "52.5.149.55" in hosts section of Cassandra properties. It should work.

@montanaflynn
Copy link
Author

Thanks @pgeseraphin, I can't believe we didn't think of that! I'll send the person who initially reported the issue the solution and follow up with an update here if it works.

@williamn
Copy link

williamn commented May 4, 2015

@montanaflynn @pgeseraphin I just try to us IP instead of hostname. It didn't work

$ sudo kong start            
[INFO] Using configuration: /etc/kong/kong.yml
[INFO] Proxy port.........8000
       Admin API port.....8001
       Database...........cassandra keepalive=60000 port=34474 timeout=1000 hosts=52.5.149.55 keyspace=kong
[ERR] Cassandra error: connection refused

@pgeseraphin
Copy link

Don't forget to change Cassandra port in 'kong.yml'. You'll get it with:
curl -X POST http://kongdb.org/provision

@williamn
Copy link

williamn commented May 4, 2015

@pgeseraphin ah you right. I forgot that.

@williamn
Copy link

williamn commented May 4, 2015

@montanaflynn @pgeseraphin it works when I change to IP instead of host name. Thanks.

@pgeseraphin
Copy link

You're welcome.

@williamn
Copy link

williamn commented May 4, 2015

I still got error when I forward my request through Kong

$ curl -i -X GET \
 --url http://localhost:8000/ \
 --header 'Host: mockbin.com'
HTTP/1.1 502 Bad Gateway
Server: openresty/1.7.10.1
Date: Mon, 04 May 2015 08:58:34 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 179
Connection: keep-alive
Via: kong/0.2.0-2

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>openresty/1.7.10.1</center>
</body>
</html>

@pgeseraphin
Copy link

It's another issue (see #182). To solve this, when adding an API, you have to use '127.0.0.1' instead of 'localhost':

Example:

$ curl -i -X POST
--url http://127.0.0.1:8001/apis/
--data 'name=mockbin'
--data 'target_url=http://mockbin.com/'
--data 'public_dns=mockbin.com'

@williamn
Copy link

williamn commented May 4, 2015

@pgeseraphin still not working

curl -i -X POST \
>  --url http://127.0.0.1:8001/apis/ \
>  --data 'name=mockbin' \
>  --data 'target_url=http://mockbin.com/' \
>  --data 'public_dns=mockbin.com'
HTTP/1.1 201 Created
Date: Mon, 04 May 2015 09:21:56 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Server: kong/0.2.0-2

{"public_dns":"mockbin.com","target_url":"http:\/\/mockbin.com\/","id":"0b395813-d65b-4cbf-cca5-4a711202ff08","created_at":1430731313000,"name":"mockbin"}

When I request

curl -i -X GET \                                                                       
 --url http://localhost:8000/ \
 --header 'Host: mockbin.com'
HTTP/1.1 502 Bad Gateway
Server: openresty/1.7.10.1
Date: Mon, 04 May 2015 09:22:42 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 179
Connection: keep-alive
Via: kong/0.2.0-2

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>openresty/1.7.10.1</center>
</body>
</html>

@pgeseraphin
Copy link

Try to replace http://mockbin.com/ by its IP: http://74.208.32.158/ or use your own API.

$ curl -i -X POST
--url http://127.0.0.1:8001/apis/
--data 'name=mockbin'
--data 'target_url=http://74.208.32.158/'
--data 'public_dns=mockbin.com'

@subnetmarco
Copy link
Member

This issue should have been fixed with #194 - in order to work it needs dnsmasq on the system:

apt-get install dnsmasq

or

yum install dnsmasq

I will create new packages that include dnsmasq by default. This fix will be available in the next release of Kong (0.2.1).

I will close this issue once we try this out with the new version and we confirm it has been fixed.

@subnetmarco subnetmarco added this to the 0.2.1 milestone May 10, 2015
@subnetmarco subnetmarco self-assigned this May 10, 2015
@subnetmarco
Copy link
Member

@williamn were you the initial user who was affected by this bug?

@williamn
Copy link

@thefosk yes

@williamn
Copy link

It works after I install dnsmasq

@subnetmarco
Copy link
Member

@williamn that's great. We just released v0.2.1, which includes dnsmasq by default.

I will close this for now, please feel free to re-open it if you experience again the same problem.

@williamn
Copy link

🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants