Docker安装elasticsearch和kibana

Docker 安装elasticsearch和kibana

可能遇到的问题

  • es暴露的端口很多
  • es十分耗内存
  • es的数据一般需要放置到安全目录!挂载
  • --net somenetwork ?网络配置

启动elasticsearch

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

docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.6.2
Unable to find image ‘elasticsearch:7.6.2‘ locally
7.6.2: Pulling from library/elasticsearch
ab5ef0e58194: Pull complete 
c4d1ca5c8a25: Pull complete 
941a3cc8e7b8: Pull complete 
43ec483d9618: Pull complete 
c486fd200684: Pull complete 
1b960df074b2: Pull complete 
1719d48d6823: Pull complete 
Digest: sha256:1b09dbd93085a1e7bca34830e77d2981521a7210e11f11eda997add1c12711fa
Status: Downloaded newer image for elasticsearch:7.6.2
86f72bacc50f788e55092c1ab415ef0635edfbe1c01c7c9ab9d8e6145e2baad9

# 启动后Linux就卡住了, docker stats 查看cpu的状态
docker stats
CONTAINER ID   NAME            CPU %     MEM USAGE / LIMIT     MEM %     NET I/O           BLOCK I/O         PIDS
86f72bacc50f   elasticsearch   0.70%     1.169GiB / 1.941GiB   60.24%    936B / 0B         287MB / 729kB     44
d227e6d92a9e   tomcat01        0.45%     116MiB / 1.941GiB     5.83%     11.2kB / 126kB    33.5MB / 6.15MB   36
62c9a70b60fa   nginx01         0.00%     3.086MiB / 1.941GiB   0.16%     4.28kB / 3.55kB   0B / 8.19kB       5

测试es是否安装成功

curl localhost:9200
{
  "name" : "86f72bacc50f",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "6RGLiRo1TmGVU8CUnV4olg",
  "version" : {
    "number" : "7.6.2",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
    "build_date" : "2020-03-26T06:34:37.794943Z",
    "build_snapshot" : false,
    "lucene_version" : "8.4.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

关闭es,增加内存的限制,修改配置文件, -e 环境配置修改

docker run -d --name elasticsearch02 -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx512m" elasticsearch:7.6.2

测试是否安装成功

url localhost:9200
{
  "name" : "ab2a2c575946",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "85h515wFSOGFBFXKk1eb8A",
  "version" : {
    "number" : "7.6.2",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
    "build_date" : "2020-03-26T06:34:37.794943Z",
    "build_snapshot" : false,
    "lucene_version" : "8.4.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Docker安装elasticsearch和kibana

上一篇:聊聊Cookie和Session


下一篇:PXE高效批量网络装机