安装

    1. docker pull elasticsearch:6.5.4

    运行

    1. docker run -d --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:6.5.4

    进入容器

    1. docker exec -it es /bin/bash

    进行配置

    1. # 显示文件
    2. ls
    3. 结果如下:
    4. LICENSE.txt README.textile config lib modules
    5. NOTICE.txt bin data logs plugins
    6. # 进入配置文件夹
    7. cd config
    8. # 显示文件
    9. ls
    10. 结果如下:
    11. elasticsearch.keystore ingest-geoip log4j2.properties roles.yml users_roles
    12. elasticsearch.yml jvm.options role_mapping.yml users
    13. # 修改配置文件
    14. vi elasticsearch.yml
    15. # 加入跨域配置
    16. http.cors.enabled: true
    17. http.cors.allow-origin: "*"

    重启容器

    1. docker restart es

    安装 elasticsearch-head

    1. docker pull mobz/elasticsearch-head:5

    运行容器

    1. docker run -d --name es_admin -p 9100:9100 mobz/elasticsearch-head:5

    错误1

    1. Time1 Station: 20110103000000:03547
    2. Exception in thread "Thread-2" Exception in thread "Thread-3" org.elasticsearch.common.util.concurrent.UncategorizedExecutionException: Failed execution
    3. at org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:90)
    4. at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:49)
    5. at com.example.s3putobject.Dao.EsDaoImp.SyncIndex(EsDaoImp.java:70)
    6. at com.example.s3putobject.Service.PutObject$1.run(PutObject.java:110)
    7. Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
    8. at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.getValue(BaseFuture.java:292)
    9. at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:279)
    10. at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:117)
    11. at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:45)
    12. ... 2 more
    13. Caused by: java.lang.NullPointerException
    14. at org.elasticsearch.action.bulk.BulkRequest.validate(BulkRequest.java:479)
    15. at org.elasticsearch.action.TransportActionNodeProxy.execute(TransportActionNodeProxy.java:52)
    16. at org.elasticsearch.client.transport.support.InternalTransportClient$1.doWithNode(InternalTransportClient.java:109)
    17. at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:205)
    18. at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106)
    19. at org.elasticsearch.client.support.AbstractClient.bulk(AbstractClient.java:167)
    20. at org.elasticsearch.client.transport.TransportClient.bulk(TransportClient.java:370)
    21. at org.elasticsearch.action.bulk.BulkRequestBuilder.doExecute(BulkRequestBuilder.java:166)
    22. at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
    23. at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
    24. ... 2 more
    25. org.elasticsearch.common.util.concurrent.UncategorizedExecutionException: Failed execution
    26. at org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:90)
    27. at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:49)
    28. at com.example.s3putobject.Dao.EsDaoImp.SyncIndex(EsDaoImp.java:70)
    29. at com.example.s3putobject.Service.PutObject$2.run(PutObject.java:155)
    30. Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
    31. at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.getValue(BaseFuture.java:292)
    32. at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:279)
    33. at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:117)
    34. at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:45)
    35. ... 2 more
    36. Caused by: java.lang.NullPointerException
    37. at org.elasticsearch.action.bulk.BulkRequest.validate(BulkRequest.java:479)
    38. at org.elasticsearch.action.TransportActionNodeProxy.execute(TransportActionNodeProxy.java:52)
    39. at org.elasticsearch.client.transport.support.InternalTransportClient$1.doWithNode(InternalTransportClient.java:109)
    40. at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:205)
    41. at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106)
    42. at org.elasticsearch.client.support.AbstractClient.bulk(AbstractClient.java:167)
    43. at org.elasticsearch.client.transport.TransportClient.bulk(TransportClient.java:370)
    44. at org.elasticsearch.action.bulk.BulkRequestBuilder.doExecute(BulkRequestBuilder.java:166)
    45. at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
    46. at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
    47. ... 2 more