一、docker安装elasticsearch
docker pull elasticsearch:7.4.2 存储和检索数据
docker pull kibana:7.4.2 可视化检索数据
mkdir -p /mydata/elasticsearch/config
mkdir -p /mydata/elasticsearch/data
echo "http.host: 0.0.0.0" >> /mydata/elasticsearch/config/elasticsearch.yml
docker run --name elasticsearch -p 9200:9200 -p 9300:9300
-e "discovery.type=single-node"
-e ES_JAVA_OPTS="-Xms64m -Xmx128m"
-v /kikiguli/mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /kikiguli/mydata/elasticsearch/data:/usr/share/elasticsearch/data \
-v /kikiguli/mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.6.2
注意:
如果启动失败,可以调整ES_JAVA_OPTS=“-Xms64m -Xmx128m"加大内存 如果加大内存后仍启动失败使用命令:docker logs kiki-es 查看日志 如果是ElasticsearchException[failed to bind service]; nested: AccessDeniedException[/usr/share/elasticsearch/data/nodes];”, 使用chmod -R 777 /kikiguli/mydata/elasticsearch 递归改变该文件夹下的所有文件
二、访问
输入http:ip:9200 回车后得到 则es配置成功
{
"name" : "a3ee6db0578f",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "1mdrZmc8RcafI30PYKE8Lg",
"version" : {
"number" : "7.6.2",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
"build_date" : "2020-03-26T06:34:37.794943Z",
"build_snapshot" : false,
"lucene_version" : "8.4.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
|