1、centos环境,利用docker拉取es和kibana的镜像
sudo docker pull elasticsearch:7.16.3
sudo docker pull kibana:7.16.3
2、free -m命令查看内存占用
3、创建挂载用目录
mkdir -p /mydata/elasticsearch/config
mkdir -p /mydata/elasticsearch/data
mkdir -p /mydata/elasticsearch/plugins
echo "http.host:0.0.0.0" >> /mydata/elasticsearch/config/elasticearch.yml
4、赋予data目录读写权限
chmod -R 777 /mydata/elasticsearch/
5、启动es实例:
docker run -elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms64m -Xmx128m" \
-v /mydata/elasticsearch/config/elasticearch.yml:/usr/share/elasticsearch/config/elasticearch.yml \
-v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \
-v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.16.3
6、测试9200端口访问情况
查看节点相关信息:http://192.168.56.10:9200/_cat/
查看所有节点:http://192.168.56.10:9200/_cat/nodes
7、启动kibana实例:
docker run --name kibana -e ELASTICSEARCH_HOSTS=http://192.168.56.10:9200 -p 5601:5601 \
-d kibana:7.16.3
启动成功
8、ES REST API:
get /_cat/nodes: 查看所有节点
get /_cat/health: 查看es健康状态
get /_cat/master: 查看主节点
get /_cat/indices: 查看所有索引