ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
docker部署es+es-head+kibana docker-harbor 下载官方镜像 更改版本号 上传到docker-harbor build镜像的流程 1.配置文件版本化 2.测试环境build-->提交配置文件-->build服务器拉取最新配置,修改版本号,build-->push到harbor-->客户端pull新镜像 # 第1章 官方地址 ``` https://www.elastic.co/guide/en/elasticsearch/reference/6.3/docker.html https://www.elastic.co/guide/en/kibana/current/docker.html https://hub.docker.com/r/alivv/elasticsearch-head/ ``` # 第2章 部署步骤 ## 2.1 下载需要的镜像 需要注意的是es的官方镜像国内下载不了,需要翻墙下载 es镜像 docker pull docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.0 kibana镜像 docker pull docker.elastic.co/kibana/kibana-oss:6.3.0 es-head插件镜像 docker pull alivv/elasticsearch-head ## 2.2 docker-compose启动管理文件 ``` version: '2.2' services: elasticsearch: image: elasticsearch:v2 container_name: elasticsearch environment: - cluster.name=docker-cluster - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - "discovery.zen.ping.unicast.hosts=elasticsearch" ulimits: memlock: soft: -1 hard: -1 volumes: - /data/docker_es_data:/usr/share/elasticsearch/data ports: - 9200:9200 networks: - esnet elasticsearch-head: image: elasticsearch-head:v1 container_name: elasticsearch-head ports: - 9100:9100 networks: - esnet kibana: image: kibana:v1 container_name: kibana environment: - ELASTICSEARCH_URL="http://elasticsearch:9200" - kibana.index=".kibana" ports: - 5601:5601 networks: - esnet networks: esnet: ``` ## 2.3 需要修改的地方 官方镜像的es配置里并没有并没有提供head插件访问的访问的而配置项,需要自己添加然后重新build镜像,在es的配置文件elasticsearch.yml里添加如下两行 ``` http.cors.enabled: true http.cors.allow-origin: "*" ``` 编写Dockerfile文件 ``` FROM docker.elastic.co/elasticsearch/elasticsearch:6.3.0 COPY --chown=elasticsearch:elasticsearch elasticsearch.yml /usr/share/elasticsearch/config/ ``` 重新bulid镜像 ``` docker build --tag=elasticsearch-custom . docker run -ti -v /usr/share/elasticsearch/data elasticsearch-custom ``` ## 2.4 filebeat安装 直接使用官方提供的deb安装包安装即可,需要注意软件版本需要和es以及kibana一致 ## 2.5 filebeat配置文件 ``` filebeat.prospectors: - type: log enabled: true paths: - /www/log/runtime.log json.keys_under_root: true json.overwrite_keys: true filebeat.config.modules: path: ${path.config}/modules.d/*.yml reload.enabled: false setup.template.settings: index.number_of_shards: 3 setup.kibana: output.elasticsearch: hosts: ["192.168.47.100:9200"] index: "runtime-%{+yyyy.MM}" setup.template: name: 'runtime' pattern: 'runtime-*' enabled: false ``` ansible elk_cluster -m shell -a "echo vm.max_map_count=262144 >> /etc/sysctl.conf && sysctl -p" 数据目录权限需要 775 ``` chmod 0775 /data/docker_es_data/ ```