Elasticsearch의 일반적인 오류 및 해결 방법

Elasticsearch의 일반적인 오류 및 해결 방법:
1. 시작할 때 오류 보고: Caused by:java.net.BindException: Cannot assign requested address 해결 방법: 프로필elasticsearch를 엽니다.yml은 네트워크를.host: 192.168.0.1 네이티브 IP 0.0.0.0으로 수정
[2020-04-03T19:41:11,382][INFO ][o.e.n.Node               ] [txvm2019] starting ...
[2020-04-03T19:41:11,649][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [txvm2019] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to [9300-9400]]; nested: BindException[Cannot assign requested address];
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-7.2.0.jar:7.2.0]
	at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.2.0.jar:7.2.0]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.2.0.jar:7.2.0]
Caused by: org.elasticsearch.transport.BindTransportException: Failed to bind to [9300-9400]
	at org.elasticsearch.transport.TcpTransport.bindToPort(TcpTransport.java:389) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.transport.TcpTransport.bindServer(TcpTransport.java:355) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.transport.netty4.Netty4Transport.doStart(Netty4Transport.java:136) ~[?:?]
	at org.elasticsearch.xpack.core.security.transport.netty4.SecurityNetty4Transport.doStart(SecurityNetty4Transport.java:81) ~[?:?]
	at org.elasticsearch.xpack.security.transport.netty4.SecurityNetty4ServerTransport.doStart(SecurityNetty4ServerTransport.java:43) ~[?:?]
	at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:59) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.transport.TransportService.doStart(TransportService.java:230) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:59) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.node.Node.start(Node.java:662) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:273) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:358) ~[elasticsearch-7.2.0.jar:7.2.0]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.2.0.jar:7.2.0]
	... 6 more
Caused by: java.net.BindException: Cannot assign requested address
	at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
	at sun.nio.ch.Net.bind(Net.java:433) ~[?:?]
	at sun.nio.ch.Net.bind(Net.java:425) ~[?:?]
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[?:?]
	at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:132) ~[?:?]
	at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:563) ~[?:?]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1332) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:503) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:488) ~[?:?]
	at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:984) ~[?:?]
	at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:259) ~[?:?]
	at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:366) ~[?:?]
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[?:?]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:405) ~[?:?]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) ~[?:?]
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906) ~[?:?]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[?:?]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]

2, 오류: max number of threads[2048] for user [elasticsearch] is too low, increase to atleast[4096] 해결 방법: 편집/etc/security/limits.conf, 아래 내용 추가; soft nofile 65536  hard nofile 65536
[2020-04-03T19:46:34,046][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [txvm2019] [controller/27023] [Main.cc@110] controller (64 bit): Version 7.2.0 (Build 65aefcbfce449b) Copyright (c) 2019 Elasticsearch BV
[2020-04-03T19:46:34,526][DEBUG][o.e.a.ActionModule       ] [txvm2019] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2020-04-03T19:46:34,867][INFO ][o.e.d.DiscoveryModule    ] [txvm2019] using discovery type [zen] and seed hosts providers [settings]
[2020-04-03T19:46:35,768][INFO ][o.e.n.Node               ] [txvm2019] initialized
[2020-04-03T19:46:35,768][INFO ][o.e.n.Node               ] [txvm2019] starting ...
[2020-04-03T19:46:35,923][INFO ][o.e.t.TransportService   ] [txvm2019] publish_address {172.17.0.1:9300}, bound_addresses {0.0.0.0:9300}
[2020-04-03T19:46:35,932][INFO ][o.e.b.BootstrapChecks    ] [txvm2019] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [2] bootstrap checks failed
[1]: max number of threads [2048] for user [elasticsearch] is too low, increase to at least [4096]
[2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
[2020-04-03T19:46:35,978][INFO ][o.e.n.Node               ] [txvm2019] stopping ...
[2020-04-03T19:46:36,012][INFO ][o.e.n.Node               ] [txvm2019] stopped
[2020-04-03T19:46:36,012][INFO ][o.e.n.Node               ] [txvm2019] closing ...
[2020-04-03T19:46:36,032][INFO ][o.e.n.Node               ] [txvm2019] closed

 
3. 오류:cluster.initial_master_nodes]must be configured 해결 방법:elasticsearch의config 디렉터리에서elasticsearch를 수정합니다.yml 프로필, 다음 프로필을 이 프로필에 추가합니다.
ip 교체 host1 등, 다중 노드는 여러 개의 ip 주소를 추가하십시오. 단일 노드는 기본값으로 # 다음 세 가지를 설정할 수 있습니다. 최소 1 # [discovery.seed_hosts,discovery.seed_providers,cluster.initial_master_nodes] cluster.initial_master_nodes: ["node-1"] #여기 node-1은 node-name에 설정된 값입니다.
[2020-04-03T19:51:41,427][DEBUG][o.e.a.ActionModule       ] [txvm2019] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2020-04-03T19:51:41,799][INFO ][o.e.d.DiscoveryModule    ] [txvm2019] using discovery type [zen] and seed hosts providers [settings]
[2020-04-03T19:51:42,729][INFO ][o.e.n.Node               ] [txvm2019] initialized
[2020-04-03T19:51:42,729][INFO ][o.e.n.Node               ] [txvm2019] starting ...
[2020-04-03T19:51:42,890][INFO ][o.e.t.TransportService   ] [txvm2019] publish_address {172.17.0.1:9300}, bound_addresses {0.0.0.0:9300}
[2020-04-03T19:51:42,900][INFO ][o.e.b.BootstrapChecks    ] [txvm2019] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

 
4. 데이터 삭제 오류: "reason": "Wildcard expressions or all indices are not allowed"해결 방법: 모든 인덱스를 삭제할 때curl-X DELETE"http://localhost:9200/* "또는 curl-X DELETE"localhost: 9200/_all "삭제 오류를 방지하기 위해elasticsearch.yml 속성 action.destructive_requires_name을true로 설정할 수 있습니다. 와일드카드나 _all로 인덱스를 삭제하는 것을 금지하고 이름이나 별명을 사용해야 인덱스를 삭제할 수 있습니다. false로 수정하면 모든 action.destructive_requires_name:false를 삭제할 수 있습니다."
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Wildcard expressions or all indices are not allowed"}],"type":"illegal_argument_exception","reason":"Wildcard expressions or all indices are not allowed"},"status":400}

5, 인덱스 생성 오류: mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true. 해결 방법: 수정:
{
    "settings": {
        "number_of_shards": 3,
        "number_of_replicas": 2
    },
    "mappings": {
            "properties": {
                "commodity_id": {
                    "type": "long"
                },
                "commodity_name": {
                    "type": "text"
                },
                "picture_url": {
                    "type": "text"
                },
                "price": {
                    "type": "double"
                }
            }
    }
}

이게 나온 이유는elasticsearch7이 기본적으로 지정한 색인 형식을 지원하지 않기 때문입니다. 기본 색인 형식은_doc, 변경하려면 include_ 구성type_name:true면 됩니다. (이것은 테스트가 없습니다. 공식 문서에서 말한 바와 같이 가능하든 안 되든 하지 마십시오. 왜냐하면elasticsearch8 이후에는 이 필드를 제공하지 않기 때문입니다.)
{
   "error":    {
      "root_cause": [      {
         "type": "illegal_argument_exception",
         "reason": "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."
      }],
      "type": "illegal_argument_exception",
      "reason": "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."
   },
   "status": 400
}

 
6. 조회 집합 중 오류: "Fielddata is disabled on text fields by default..."해결 방법: 검색 검증을 통해 이 오류가 발생한 것은 5.x 이후, Elasticsearch는 정렬, 집합에 근거한 필드에 대해 단독 데이터 구조 (fielddata) 로 메모리에 캐시를 했지만, 텍스트 필드에서는 기본적으로 비활성화되었습니다. 이렇게 하는 목적은 메모리 공간을 절약하기 위해서입니다.따라서 집합 작업이 필요하다면 단독으로 열어야 한다.다음 코드를 실행합니다(city는 관련 text의 필드 이름입니다).
PUT myindex/_mapping
{
  "properties": {
    "city": { 
      "type":     "text",
      "fielddata": true
    }
  }
}
"caused_by": {
  "type": "illegal_argument_exception",
  "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [city] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.",
  "caused_by": {
    "type": "illegal_argument_exception",
    "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [city] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."
  }
}

 

좋은 웹페이지 즐겨찾기