docker单机安装elasticsearch

1.下载镜像

docker pull elasticsearch:7.12.0

2.创建容器卷目录

mkdir -p /liulei/elasticsearch/config
mkdir -p /liulei/elasticsearch/data
mkdir -p /liulei/elasticsearch/plugins

3.创建配置文件

echo "http.host: 0.0.0.0" >> /liulei/elasticsearch/config/elasticsearch.yml

异常一:文件夹未设置所有用户读写执行权限,处理:sudo chmod -R 777 /liulei/elasticsearch/

异常二:echo “http.host:0.0.0.0” ==》echo “http.host: 0.0.0.0”;“:”后面必须要有个空格

4.创建容器

sudo docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms2048m -Xmx3976m" \
-v /liulei/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /liulei/elasticsearch/data:/usr/share/elasticsearch/data \
-v /liulei/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.12.0

你可能感兴趣的:(elasticsearch,docker,大数据)