docker 安装elasticsearch

本文详细介绍如何通过Docker部署并配置Elasticsearch 5.6.12版本,包括创建必要的挂载目录、配置elasticsearch.yml及log4j2.properties文件、启动容器以及安装分词插件。
摘要由CSDN通过智能技术生成
  1. 创建挂载目录
 mkdir -p /home/software/elasticsearch5.6.12_mall/data
 mkdir -p /home/software/elasticsearch5.6.12_mall/config
 mkdir -p /home/software/elasticsearch5.6.12_mall/logs
 mkdir -p /home/software/elasticsearch5.6.12_mall/plugins

2.增加elasticsearch.yml和log4j2.properties配置文件

# cat elasticsearch.yml 
http.host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"

# cat log4j2.properties
status = error

appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n

rootLogger.level = info
rootLogger.appenderRef.console.ref = console

3.创建容器

docker run -p 19200:9200 -p 19300:9300 --name elasticsearch5.6.12_mall \
-d --restart=always \
-e TZ="Asia/Shanghai" \
-e "discovery.type=single-node" \
-e "cluster.name=elasticsearch" \
-e ES_JAVA_OPTS="-Xms2048m -Xmx4096m" \
--privileged=true   \
-v /home/software/elasticsearch5.6.12_mall/plugins:/usr/share/elasticsearch/plugins \
-v /home/software/elasticsearch5.6.12_mall/data:/usr/share/elasticsearch/data \
-v /home/software/elasticsearch5.6.12_mall/config/elasticsearch.yml:/usr/share/elasticsearch/\
config/elasticsearch.yml \
-v /home/software/elasticsearch5.6.12_mall/config/log4j2.properties:/usr/share/elasticsearch/\
config/log4j2.properties \
-v /home/software/elasticsearch5.6.12_mall/logs:/usr/share/elasticsearch/logs \
elasticsearch:5.6.12

3.安装分词插件

#docker exec -it 9e2ae883e39d /bin/bash

root@9e2ae883e39d:elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.6.12/elasticsearch-analysis-ik-5.6.12.zip

# docker restart 9e2ae883e39d
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值