1. Docker deployment ES (Networking environment)

1.1 pull the mirror

Docker pull elasticsearch: 7.16.3Copy the code

1.2 Environment Preparations

mkdir /usr/local/ sdyy/es7.16.3 / {data, logs, plugins} - pvcd /usr/local/sdyy
chown 1000 es7.16.3 -R
touch /usr/local/ sdyy/es7.16.3 / elasticsearch. YmlCopy the code

Elasticsearch. Yml as follows

cluster.name: "test_evescn"
network.host: 0.0. 0. 0
#xpack.security.enabled: true
http.cors.allow-headers: Authorization
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
Copy the code

1.3 start the docker

docker run -d --restart=always --user=root \
  --privileged=true \
  --name es7.16.3 \
  -p 9210:9200 \
  -p 9310:9300 \
  --ulimit nofile=65536:65536 \
  -v "/ usr/local/sdyy es7.16.3 / elasticsearch. Yml":/usr/share/elasticsearch/config/elasticsearch.yml \
  -v "/ usr/local/sdyy/es7.16.3 / data":/usr/share/elasticsearch/data \
  -v "/ usr/local/sdyy/es7.16.3 / logs":/usr/share/elasticsearch/logs \
  -v "/ usr/local/sdyy es7.16.3 / plugins/":/usr/share/elasticsearch/plugins \
  -e "discovery.type=single-node" \
  -e ES_JAVA_OPTS="-Xms2G -Xmx2G"\ elasticsearch: 7.16.3Copy the code

If the startup fails

# check logDocker logs -ft --tail 500 ES7.16.3Copy the code

If it is a permission problem, it is likely that es7.16.3 has insufficient permissions

Re-execute the following

cd /usr/local/sdyy
chown 1000 es7.16.3 -R
docker restart es7.16.3
Copy the code

1.4 Setting a Password

docker exec-it es7.16.3 bash elasticSearch -setup- Passwords interactive.... Set the passwords of six es_xpack authentication accounts....Copy the code

Access verification after port mapping

2. Ik analyzer

2.1 Download IK word segmentation

Github.com/medcl/elast…

Find the corresponding version to download

2.2 Installing ik word dividers

  1. Unzip the file and name the unzip folder IK

  2. The upload folder to/usr/local/sdyy/es7.16.3 / plugins, and restart the docker

Restart the docker

Docker restart es7.16.3Copy the code

Validator word divider