docker-compose一键部署单机es

已安装docker以及docker-compose

docker-compose.yml文件

  1. version: '3'
  2. services:
  3. elasticsearch:
  4. image: nshou/elasticsearch-kibana # 镜像elasticsearch`
  5. container_name: elasticsearch # 容器名为'elasticsearch'
  6. restart: always # 指定容器退出后的重启策略为始终重启
  7. # volumes: # 数据卷挂载路径设置,将本机目录映射到容器目录
  8. # - "./elasticsearch/data:/usr/share/elasticsearch/data:rw"
  9. # - "./elasticsearch/conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml"
  10. # - "./elasticsearch/conf/jvm.options:/usr/share/elasticsearch/config/jvm.options"
  11. # - "./elasticsearch/logs:/usr/share/elasticsearch/logs:rw"
  12. environment: # 设置环境变量,相当于docker run命令中的-e
  13. TZ: Asia/Shanghai
  14. LANG: en_US.UTF-8
  15. discovery.type: single-node
  16. ports:
  17. - "9200:9200"
  18. - "9300:9300"

在文件夹下创建docker-compose.yml文件后执行命令
docker-compose up -d

访问http://ip:9200显示如下即可

image.png

配置谷歌插件

ElasticSearch Head
image.png
点击后配置自己的ip点击连接,即可访问
image.png

集群部署方案一

部署 - 图4

单机源文件部署问题汇总

You must address the points described in the following [5] lines before starting Elasticsearch
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

编辑 /etc/security/limits.conf,追加以下内容;
* soft nofile 65536
* hard nofile 65536
此文件修改后需要重新登录用户,才会生效

修改limits.d目录下的配置文件:
vi /etc/security/limits.d/90-nproc.conf
改为4096

soft  nproc 4096

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

在/etc/sysctl.conf文件最后添加一行
vm.max_map_count=262144

system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

elasticsearch.yml中增加


bootstrap.memory_lock: false
# 追加配置项
bootstrap.system_call_filter: false

the default discovery settings are unsuitable for production use; at least one of [discovery.seed_ho

在elasticsearch的config目录下,修改elasticsearch.yml配置文件,将下面的配置加入到该配置文件中:

ip替换host1等,多节点请添加多个ip地址,单节点可写按默认来
#配置以下三者,最少其一
#[discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes]
cluster.initial_master_nodes: ["node-1"] #这里的node-1为node-name配置的值