安装
docker pull elasticsearch:6.5.4
运行
docker run -d --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:6.5.4
进入容器
docker exec -it es /bin/bash
进行配置
# 显示文件
ls
结果如下:
LICENSE.txt README.textile config lib modules
NOTICE.txt bin data logs plugins
# 进入配置文件夹
cd config
# 显示文件
ls
结果如下:
elasticsearch.keystore ingest-geoip log4j2.properties roles.yml users_roles
elasticsearch.yml jvm.options role_mapping.yml users
# 修改配置文件
vi elasticsearch.yml
# 加入跨域配置
http.cors.enabled: true
http.cors.allow-origin: "*"
重启容器
docker restart es
安装 elasticsearch-head
docker pull mobz/elasticsearch-head:5
运行容器
docker run -d --name es_admin -p 9100:9100 mobz/elasticsearch-head:5
错误1
Time1 Station: 20110103000000:03547
Exception in thread "Thread-2" Exception in thread "Thread-3" org.elasticsearch.common.util.concurrent.UncategorizedExecutionException: Failed execution
at org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:90)
at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:49)
at com.example.s3putobject.Dao.EsDaoImp.SyncIndex(EsDaoImp.java:70)
at com.example.s3putobject.Service.PutObject$1.run(PutObject.java:110)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.getValue(BaseFuture.java:292)
at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:279)
at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:117)
at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:45)
... 2 more
Caused by: java.lang.NullPointerException
at org.elasticsearch.action.bulk.BulkRequest.validate(BulkRequest.java:479)
at org.elasticsearch.action.TransportActionNodeProxy.execute(TransportActionNodeProxy.java:52)
at org.elasticsearch.client.transport.support.InternalTransportClient$1.doWithNode(InternalTransportClient.java:109)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:205)
at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106)
at org.elasticsearch.client.support.AbstractClient.bulk(AbstractClient.java:167)
at org.elasticsearch.client.transport.TransportClient.bulk(TransportClient.java:370)
at org.elasticsearch.action.bulk.BulkRequestBuilder.doExecute(BulkRequestBuilder.java:166)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
... 2 more
org.elasticsearch.common.util.concurrent.UncategorizedExecutionException: Failed execution
at org.elasticsearch.action.support.AdapterActionFuture.rethrowExecutionException(AdapterActionFuture.java:90)
at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:49)
at com.example.s3putobject.Dao.EsDaoImp.SyncIndex(EsDaoImp.java:70)
at com.example.s3putobject.Service.PutObject$2.run(PutObject.java:155)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.getValue(BaseFuture.java:292)
at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:279)
at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:117)
at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:45)
... 2 more
Caused by: java.lang.NullPointerException
at org.elasticsearch.action.bulk.BulkRequest.validate(BulkRequest.java:479)
at org.elasticsearch.action.TransportActionNodeProxy.execute(TransportActionNodeProxy.java:52)
at org.elasticsearch.client.transport.support.InternalTransportClient$1.doWithNode(InternalTransportClient.java:109)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:205)
at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106)
at org.elasticsearch.client.support.AbstractClient.bulk(AbstractClient.java:167)
at org.elasticsearch.client.transport.TransportClient.bulk(TransportClient.java:370)
at org.elasticsearch.action.bulk.BulkRequestBuilder.doExecute(BulkRequestBuilder.java:166)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
... 2 more