Series installation Docker] [docker elasticsearch7.4.2, elasticsearch-analysis-ik tokenizer, elasticsearch-head

1, the mirror pulling docker elasticsearch

[root@hadoop-keda /]# docker pull elasticsearch:7.4.2
7.4.2: Pulling from library/elasticsearch

2, configure the parameters of the host, or not start, it will error:
max Virtual Memory Areas vm.max_map_count [65530] IS TOO Low, Increase to AT Least [262144]

[root@study-01 ~]# vim /etc/sysctl.conf
vm.max_map_count=655360
[root@study-01 ~]# sysctl -p 

3, start concise version of the container

sudo docker run -id \
--net docker-hadoop-net \
--ip 172.170.0.15 \
--restart=always \
--hostname=hadoop_elasticsearch \
--name=hadoop-elasticsearch \
-p 19200:9200 \
-p 19300:9300 \
-v /etc/localtime:/etc/localtime \
-e ES_JAVA_OPTS="-Xms2g -Xmx2g" \
-e "discovery.type=single-node" \
-e TZ='Asia/Shanghai' \
-e LANG="en_US.UTF-8" \
elasticsearch:7.4.2

4, copy files container, to the host

[root@hadoop-keda software]# docker cp 97d21381af5a4e49e:/usr/share/elasticsearch/config/ /usr/docker/software/elasticsearch/
[root@hadoop-keda software]# docker cp 97d21381af5a4e49e:/usr/share/elasticsearch/data/ /usr/docker/software/elasticsearch/
[root@hadoop-keda software]# docker cp 97d21381af5a4e49e:/usr/share/elasticsearch/logs/ /usr/docker/software/elasticsearch/
[root@hadoop-keda software]# docker cp 97d21381af5a4e49e:/usr/share/elasticsearch/plugins/ /usr/docker/software/elasticsearch/

5, start elasticsearch container

sudo docker run -tid \
--net docker-hadoop-net \
--ip 172.170.0.15 \
--restart=always \
--hostname=hadoop_elasticsearch \
--name=hadoop-elasticsearch \
-p 19200:9200 \
-p 19300:9300 \
-v /usr/docker/software/elasticsearch/config/:/usr/share/elasticsearch/config/ \
-v /usr/docker/software/elasticsearch/data/:/usr/share/elasticsearch/data/ \
-v /usr/docker/software/elasticsearch/logs/:/usr/share/elasticsearch/logs/ \
-v /usr/docker/software/elasticsearch/plugins/:/usr/share/elasticsearch/plugins/ \
-v /etc/localtime:/etc/localtime \
-e ES_JAVA_OPTS="-Xms2g -Xmx2g" \
-e "discovery.type=single-node" \
-e TZ='Asia/Shanghai' \
-e LANG="en_US.UTF-8" \
elasticsearch:7.4.2

Note:
-e "SINGLE-Node discovery.type =" represents a single node starts.
If yml file, configuration is a cluster environment, this needs to be removed


6, port open host, and (Ali cloud server, you need to turn through the console port 19200)
7, access the test


8, install IK tokenizer (install plug into the docker container)

[root@hadoop-keda config]# docker exec -it 9e4e12672334 bash
[root@hadoop_elasticsearch elasticsearch]# ls
bin  config  data  jdk  lib  LICENSE.txt  logs  modules  NOTICE.txt  plugins  README.textile
[root@hadoop_elasticsearch elasticsearch]# cd bin/
[root@hadoop_elasticsearch bin]# ls
elasticsearch           elasticsearch-cli       elasticsearch-enve      elasticsearch-node           elasticsearch-setup-passwords  elasticsearch-sql-cli-7.4.2.jar  x-pack-env
elasticsearch-certgen   elasticsearch-croneval  elasticsearch-keystore  elasticsearch-plugin         elasticsearch-shard            elasticsearch-syskeygen          x-pack-security-env
elasticsearch-certutil  elasticsearch-env       elasticsearch-migrate   elasticsearch-saml-metadata  elasticsearch-sql-cli          elasticsearch-users              x-pack-watcher-env
[root@hadoop_elasticsearch bin]# elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.2/elasticsearch-analysis-ik-7.4.2.zip
-> Downloading https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.4.2/elasticsearch-analysis-ik-7.4.2.zip
[=================================================] 100%   
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@     WARNING: plugin requires additional permissions     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.net.SocketPermission * connect,resolve
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.

Continue with installation? [y/N]y
-> Installed analysis-ik


9, mounting mobz / elasticsearch-head and connected to the container elasticsearch

[root@hadoop-keda ~]# sudo docker run -dit \
> --net docker-hadoop-net \
> --ip 172.170.0.18 \
> --restart=always \
> --hostname=hadoop_elasticsearch_head \
> --name=hadoop-elasticsearch-head \
> -p 19100:9100 \
> -v /etc/localtime:/etc/localtime \
> -e TZ='Asia/Shanghai' \
> -e LANG="en_US.UTF-8" \
> mobz/elasticsearch-head:5

10, open port of the host, (Ali cloud server, you need to open port 19100 through the console)

Published 111 original articles · won praise 28 · views 40000 +

Guess you like

Origin blog.csdn.net/weixin_42697074/article/details/103815945