Can´t connect to dedicated serach server


(mrblue) #1

Hi,

i decided to set up a dedicated server just for elasticsearch (debian
6.0 squeeze 64 lamp). ES works fine so far, but i can´t connect to it
from another server.

Here is a very simple example:

$ch = curl_init();
//curl_setopt($ch, CURLOPT_URL, "http://localhost:9200/alle_uhren/
_search?pretty=true");

curl_setopt($ch, CURLOPT_URL, "http://xxx.x.xxx.xxx:9200/xxxx/_search?
pretty=true");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);

$data = '{
"query" : {
"match_all" : { }
},"size" : "2000"
}';

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$jason_output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

print_r($jason_output);

It works fine with localhost, but not from a different server. I can
ping from one server to the other.
Here is what netstat says, there seems to be somthing on 9200, but i
know nothing about these kind of things :wink:

tcp 0 0 127.0.0.1:3306 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:10000 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:32000 0.0.0.0:*
LISTEN
tcp6 0 0 :::9200 :::*
LISTEN
tcp6 0 0 :::9300 :::*
LISTEN
tcp6 0 0 :::21 :::*
LISTEN
tcp6 0 0 :::22 :::*
LISTEN
tcp6 0 0 ::1:25 :::*
LISTEN

Any help is apreciated !


(avasilenko) #2

You should check iptables rules:

$ iptables -L

And print it here. Probably 9200 port is blocked. As an example in CentOS
all ports, except 22 are blocked for external access.

Alexandr Vasilenko

2012/2/4 mrblue john.agricola.27@googlemail.com

Hi,

i decided to set up a dedicated server just for elasticsearch (debian
6.0 squeeze 64 lamp). ES works fine so far, but i can´t connect to it
from another server.

Here is a very simple example:

$ch = curl_init();
//curl_setopt($ch, CURLOPT_URL, "http://localhost:9200/alle_uhren/
_search?pretty=true");

curl_setopt($ch, CURLOPT_URL, "http://xxx.x.xxx.xxx:9200/xxxx/_search?
pretty=true");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);

$data = '{
"query" : {
"match_all" : { }
},"size" : "2000"
}';

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$jason_output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

print_r($jason_output);

It works fine with localhost, but not from a different server. I can
ping from one server to the other.
Here is what netstat says, there seems to be somthing on 9200, but i
know nothing about these kind of things :wink:

tcp 0 0 127.0.0.1:3306 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:10000 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:32000 0.0.0.0:*
LISTEN
tcp6 0 0 :::9200 :::*
LISTEN
tcp6 0 0 :::9300 :::*
LISTEN
tcp6 0 0 :::21 :::*
LISTEN
tcp6 0 0 :::22 :::*
LISTEN
tcp6 0 0 ::1:25 :::*
LISTEN

Any help is apreciated !


(Aurélien-2) #3

Hello.

You may also check if localhost resolve to the local ipv6 address, or try -Djava.net.preferIPv4Stack=true on the java startup command line. Or disable ipv6 on your box if you don't use it.

Rgds.

----- Mail original -----

De: "Alex Vasilenko" aa.vasilenko@gmail.com
À: elasticsearch@googlegroups.com
Envoyé: Samedi 4 Février 2012 08:26:55
Objet: Re: Can´t connect to dedicated serach server

You should check iptables rules:

$ iptables -L

And print it here. Probably 9200 port is blocked. As an example in CentOS all ports, except 22 are blocked for external access.

Alexandr Vasilenko

2012/2/4 mrblue < john.agricola.27@googlemail.com >

Hi,

i decided to set up a dedicated server just for elasticsearch (debian
6.0 squeeze 64 lamp). ES works fine so far, but i can´t connect to it
from another server.

Here is a very simple example:

$ch = curl_init();
//curl_setopt($ch, CURLOPT_URL, " http://localhost:9200/alle_uhren/
_search?pretty=true ");

curl_setopt($ch, CURLOPT_URL, " http://xxx.x.xxx.xxx:9200/xxxx/_search?
pretty=true ");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);

$data = '{
"query" : {
"match_all" : { }
},"size" : "2000"
}';

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$jason_output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

print_r($jason_output);

It works fine with localhost, but not from a different server. I can
ping from one server to the other.
Here is what netstat says, there seems to be somthing on 9200, but i
know nothing about these kind of things :wink:

tcp 0 0 127.0.0.1:3306 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:10000 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:32000 0.0.0.0:*
LISTEN
tcp6 0 0 :::9200 :::*
LISTEN
tcp6 0 0 :::9300 :::*
LISTEN
tcp6 0 0 :::21 :::*
LISTEN
tcp6 0 0 :::22 :::*
LISTEN
tcp6 0 0 ::1:25 :::*
LISTEN

Any help is apreciated !


(Greg) #4

The problem is that it's only listening on port 9200 for IPv6, not
IPv4:

LISTEN tcp6 0 0 :::9200 :::*

This should help:
http://www.elasticsearch.org/guide/reference/modules/network.html

On Feb 4, 4:30 am, mrblue john.agricola...@googlemail.com wrote:

Hi,

i decided to set up a dedicated server just for elasticsearch (debian
6.0 squeeze 64 lamp). ES works fine so far, but i can´t connect to it
from another server.

Here is a very simple example:

$ch = curl_init();
//curl_setopt($ch, CURLOPT_URL, "http://localhost:9200/alle_uhren/
_search?pretty=true");

curl_setopt($ch, CURLOPT_URL, "http://xxx.x.xxx.xxx:9200/xxxx/_search?
pretty=true");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);

$data = '{
"query" : {
"match_all" : { }
},"size" : "2000"

}';

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$jason_output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

print_r($jason_output);

It works fine with localhost, but not from a different server. I can
ping from one server to the other.
Here is what netstat says, there seems to be somthing on 9200, but i
know nothing about these kind of things :wink:

tcp 0 0 127.0.0.1:3306 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:10000 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:*
LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:*
LISTEN
tcp 0 0 127.0.0.1:32000 0.0.0.0:*
LISTEN
tcp6 0 0 :::9200 :::*
LISTEN
tcp6 0 0 :::9300 :::*
LISTEN
tcp6 0 0 :::21 :::*
LISTEN
tcp6 0 0 :::22 :::*
LISTEN
tcp6 0 0 ::1:25 :::*
LISTEN

Any help is apreciated !


(system) #5