简体   繁体   中英

Elasticsearch port 9300 django

I'm facing a strange issue, using Django Haystack and ElasticSearch so I can't rebuild_index.

ElasticSearch is properly running on the machine :

$ curl -X GET 'http://localhost:9200'
{
  "status" : 200,
  "name" : "Ziggy Pig",
  "cluster_name" : "elasticsearch",
  "version" : {
  "number" : "1.7.2",
  "build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",
  "build_timestamp" : "2015-09-14T09:49:53Z",
  "build_snapshot" : false,
  "lucene_version" : "4.10.4"
  },
  "tagline" : "You Know, for Search"
}

But this is the log of ElasticSearch :

[2017-11-29 18:25:22,723][INFO ][node] [Ziggy Pig] initialized
[2017-11-29 18:25:22,724][INFO ][node] [Ziggy Pig] starting ...
[2017-11-29 18:25:22,913][INFO ][transport] [Ziggy Pig] bound_address 
     {inet[/127.0.0.1:9300]}, publish_address {inet[/10.142.0.2:9300]}
[2017-11-29 18:25:22,937][INFO ][discovery] [Ziggy Pig] . 
     elasticsearch/HWEvbIkAR3mFwcGeHIa7Cg
[2017-11-29 18:25:26,710][INFO ][cluster.service] [Ziggy Pig] 
    new_master [Ziggy Pig][HWEvbIkAR3mFwcGeHIa7Cg][stagelighted]
    [inet[/10.142.0.2:9300]], reason: zen-disco-join(elected_as_master)
[2017-11-29 18:25:26,734][INFO ][http] [Ziggy Pig] bound_address 
     {inet[/127.0.0.1:9200]}, publish_address {inet[/10.142.0.2:9200]}
[2017-11-29 18:25:26,734][INFO ][node] [Ziggy Pig] started
[2017-11-29 18:25:26,762][INFO ][gateway] [Ziggy Pig] recovered [1] 
     indices into cluster_state
[2017-11-29 18:26:22,946][WARN ][cluster.service] [Ziggy Pig] failed to 
     reconnect to node [Ziggy Pig][HWEvbIkAR3mFwcGeHIa7Cg]
     [stagelighted][inet[/10.142.0.2:9300]]
org.elasticsearch.transport.ConnectTransportException: [Ziggy Pig][inet[/10.142.0.2:9300]] connect_timeout[30s]
at org.elasticsearch.transport.netty.NettyTransport.connectToChannels(NettyTransport.java:825)
at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:758)
at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:731)
at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:216)
at org.elasticsearch.cluster.service.InternalClusterService$ReconnectToNodes.run(InternalClusterService.java:584)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.ConnectException: Connection refused: /10.142.0.2:9300
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.connect(NioClientBoss.java:152)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.processSelectedKeys(NioClientBoss.java:105)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:79)
at org.elasticsearch.common.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
at org.elasticsearch.common.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

I installed JAVA and Elastisearch with this tutorial

My app running in Google Compute Engine

If someone can help me.


My settings:

ELASTICSEARCH_INDEX_SETTINGS = {
'settings': {
    "analysis": {
        "analyzer": {
            "synonym_analyzer" : {
                "type": "custom",
                "tokenizer" : "standard",
                "filter" : ["synonym"]
            },
            "ngram_analyzer": {
                "type": "custom",
                "tokenizer": "lowercase",
                "filter": ["haystack_ngram", "synonym"]
            },
            "edgengram_analyzer": {
                "type": "custom",
                "tokenizer": "lowercase",
                "filter": ["haystack_edgengram"]
            }
        },
        "tokenizer": {
            "haystack_ngram_tokenizer": {
                "type": "nGram",
                "min_gram": 3,
                "max_gram": 15,
            },
            "haystack_edgengram_tokenizer": {
                "type": "edgeNGram",
                "min_gram": 2,
                "max_gram": 15,
                "side": "front"
            }
        },
        "filter": {
            "haystack_ngram": {
                "type": "nGram",
                "min_gram": 3,
                "max_gram": 15
            },
            "haystack_edgengram": {
                "type": "edgeNGram",
                "min_gram": 2,
                "max_gram": 15
            },
            "synonym" : {
                "type" : "synonym",
                "ignore_case": "true",
                "synonyms_path" : "synonyms.txt"
            }
        }
    }
  }
}

HAYSTACK_CONNECTIONS = {
  'default': {
    'ENGINE': 'elasticstack.backends.ConfigurableElasticSearchEngine',
    'URL': 'http://127.0.0.1:9200/',
    'INDEX_NAME': 'haystack',
  },
}
HAYSTACK_SEARCH_RESULTS_PER_PAGE = 100

I think you have a typo in your settings.py file: You're trying to connect to port 9300 while elasticsearch is running on port 9200:

Caused by: java.net.ConnectException: Connection refused: /10.142.0.2:9300

Can you post the relevant parts of your settings.py file if that doesn't solve the issue?

EDIT Looking through a few relevant posts, it seems as though nodes communicate with each other via port 9300 as well as port 9200. Does your ping work on port 9300 as well? If not, that may also need to be opened up.

Possibly related: https://discuss.elastic.co/t/elasticsearch-port-9200-or-9300/72080

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM