Docker installs Elasticsearch and visualization tool Kibana

1. Install ElasticSearch

  1. Download mirror file
docker pull elasticsearch:7.4.2  #存储和检索数据
docker pull kibana:7.4.2         #可视化检索数据

Note: The version can be changed to what you need

2. Create an instance

mkdir -p /mydata/elasticsearch/config
mkdir -p /mydata/elasticsearch/data
echo "http.host: 0.0.0.0" >> /mydata/elasticsearch/config/elasticsearch.yml

chmod -R 777 /mydata/elasticsearch/ 保证权限

docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms128m -Xmx512m" \
-v/mydata/elasticsearch/config/:/usr/share/elasticsearch/config/ \
-v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \
-v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.4.2
 #启动占用64 最大512m 学习期间足够用了
 

If it prompts that the file jvm.option cannot be found, create a basic es container and copy the configuration file

docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.4.2

docker cp elasticsearch:/usr/share/elasticsearch/config  /mydata/elasticsearch

Then delete the image and run again

Later, install the plug-in outside and restart it;

Special attention:
-e ES_JAVA_OPTS="-Xms64m -Xmx256m" \ In the test environment, set the initial memory and maximum memory of ES, otherwise it will cause too large to start ES

3. Access test
The access address ip:9200
Test Results
shows that it is normal

2. Install Kibana

docker run --name kibana -e ELASTICSEARCH_HOSTS=http://192.168.2.88:9200 -p 5601:5601 -d kibana:7.4.2

http://192.168.2.88:9200 must be changed to the address of your own virtual machine, which is the address of our es above, and the version here should correspond to es

access test
192.168.2.88:5601
insert image description here

Guess you like

Origin blog.csdn.net/weixin_44485316/article/details/131867260