Can't access 9300 port

I got two problems here.
My CentOS version: 3.10.0-957.12.1.el7.x86_64.
I can't use 6.x and 7.0.0 elasticsearch on my system, but 5.x is OK!


as you can see, here is something different between. ES02 will stop itself after few seconds. I created the containers using

docker run -d -e ES_JAVA_OPTS="-Xmx256m -Xms256m" -p 9300:9300 -p 9200:9200 --name ES01 5acf0e8da90b

5.x can work well, but 6.x doesn't.

Another question is, the 9200 port is accessable, but 9300 port can't work well, I can't figure it out.
image
image
I also got some other informations here. 6.0 version's elasticsearch is not working, here is only 5.x version's port working.

image

Please don't post pictures of text, they are difficult to read and some people may not be even able to see them :slight_smile:

OK! I see it!

root@localhost ~]# docker ps

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                            NAMES
47a1c095eb69        01e5bee1e059        "/usr/local/bin/dock…"   30 minutes ago      Up 6 seconds        0.0.0.0:9201->9200/tcp, 0.0.0.0:9301->9300/tcp   ES02
38eaa950bcea        5acf0e8da90b        "/docker-entrypoint.…"   About an hour ago   Up About an hour    0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp   ES01

ES02 will stop itself in few seconds.

[root@localhost ~]# curl 127.0.0.1:9200
{
  "name" : "4FupYds",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "p29u7QWgT1yuHnOfG6CHGw",
  "version" : {
    "number" : "5.6.12",
    "build_hash" : "cfe3d9f",
    "build_date" : "2018-09-10T20:12:43.732Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.1"
  },
  "tagline" : "You Know, for Search"
}
[root@localhost ~]# curl 127.0.0.1:9300
curl: (56) Recv failure: Connection reset by peer

And, I can't get to port 9300, but I can add data through prot 9200!

Why do you want to access port 9300? It's uses a binary protocol so you cannot curl it.

Thanks for your raply!
I want to add data through port 9300, just like:

        Book book = new Book();
        book.setId(1);
        book.setBookName("boook");
        book.setAuthor("Alice");
        bookRepository.index(book);

The setting of springdata is:

spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=192.168.154.129:9300

But, there is always error:

ERROR 7604 --- [           main] .d.e.r.s.AbstractElasticsearchRepository : failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{tDt8CjGjQOWscJeN44vXXA}{192.168.154.129}{192.168.154.129:9300}]

the firewall is already shut down, port 9200 is successfully mapped, but something is wrong with port 9300.
And, why can't I use 6.x version's elasticsearch on my system? It always stop in few seconds after started. Is it normal?

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

image

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

Why did you say that your cluster stopped ? How do you know? If so what are elasticsearch logs ?

BTW as you are using Docker, you need to define in the TransportClient the same cluster name that the Docker image is using or set cluster name to elasticsearch.

Sorry about my post.
My cluster is not stop when I use 5.x version, it only happens with 6.x version or 7.0.0.
I can index data using JestClient through port 9200:

    @Autowired
    JestClient jestClient;

But if I use ElasticsearchRepository, the error is appeared.

public interface BookRepository extends ElasticsearchRepository<Book,Integer>

I think maybe something was wrong with port 9300.

ERROR 6472 --- [           main] .d.e.r.s.AbstractElasticsearchRepository : failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{cJwWjxSQS9y8buLJebxoxg}{192.168.154.129}{192.168.154.129:9300}]

Thank you for your help!

I don't understand. If you are using JEST, then you are using the HTTP Rest port (9200).
Why do you want to use the binary Transport port (9300) with Jest then?

I use ElasticsearchRepository with port 9300. Here is the code.

public interface BookRepository extends ElasticsearchRepository<Book,Integer>

I want to put data into elasticsearch.

    @Autowired
    BookRepository bookRepository;

    bookRepository.index(book);

The setting of springboot:

spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=192.168.154.129:9300

Why?

Is ElasticsearchRepository no longer available or it should work with port 9200? I look up many pages, they all use it just like:

spring: 
    data:
       elasticsearch: 
            cluster-name: es 
            cluster-nodes: 192.168.120.103:9300,192.168.120.104:9300
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=127.0.0.1:9300
spring.data.elasticsearch.repositories.enabled=true

Did I get it wrong?

I have no idea. I was just confused by the Jest reference which is using 9200 REST port.
I'm not a spring data elasticsearch user as I prefer to build my own DAO. Like here:

Anyway if you are using the deprecated TransportClient, you must make sure that the cluster name is elasticsearch or change the client settings as explained in this documentation: https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html

Thanks a lot!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.