#!/bin/sh
APP_NAME=es
DOCKER_PID=$(docker ps -a --filter name=${APP_NAME} | awk '{if (NR>1){print $1}}')
if [ "$DOCKER_PID" ]; then
echo ">>> Dcoker is already running PID=${DOCKER_PID} <<<"
docker stop ${DOCKER_PID}
docker rm ${DOCKER_PID}
fi
docker run -p 9200:9200 -p 9300:9300 --name ${APP_NAME} -e "discovery.type=single-node" -e "cluster.name=elasticsearch" -v $PWD/data:/usr/share/elasticsearch/data -v $PWD/plugins:/usr/share/elasticsearch/plugins -d elasticsearch:7.9.3
chmod 774 $PWD/data
cd plugins
mkdir ik
cd ik
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.9.3/elasticsearch-analysis-ik-7.9.3.zip
unzip elasticsearch-analysis-ik-7.9.3.zip
cp ../../IKAnalyzer.cfg.xml ./config/
docker stop es
docker start es
网友评论