通知短信+运营短信,5秒速达,支持群发助手一键发送🚀高效触达和通知客户 广告
[TOC] > [阮一峰参考文档](http://www.ruanyifeng.com/blog/2017/08/elasticsearch.html) > [docker 安装(版本可选择)](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html) ## 概述 - 需要 java8 环境 以 `REST API` 格式进行操作 快速地储存、搜索和分析海量数据 ### Node 与 Cluster ``` Elastic 本质上是一个分布式数据库,允许多台服务器协同工作,每台服务器可以运行多个 Elastic 实例。 单个 Elastic 实例称为一个节点(node)。一组节点构成一个集群(cluster) ``` ### Index 可看做数据库 `curl -X GET 'http://localhost:9200/_cat/indices?v'` ### Document Index 里面单条的记录称为 Document(文档)。许多条 Document 构成了一个 Index。 就是一条记录 ``` { "user": "张三", "title": "工程师", "desc": "数据库管理" } ``` ### Type 根据规划,Elastic 6.x 版只允许每个 Index 包含一个 Type,7.x 版将会彻底移除 Type。 ## 安装 ``` $ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.1.zip $ unzip elasticsearch-5.5.1.zip $ cd elasticsearch-5.5.1/ $ ./bin/elasticsearch ``` 测试 `curl localhost:9200` ``` { "name" : "atntrTf", "cluster_name" : "elasticsearch", "cluster_uuid" : "tf9250XhQ6ee4h7YI11anA", "version" : { "number" : "5.5.1", "build_hash" : "19c13d0", "build_date" : "2017-07-18T20:44:24.823Z", "build_snapshot" : false, "lucene_version" : "6.6.0" }, "tagline" : "You Know, for Search" } ``` ## 设置 ``` //集群名称 cluster.name: elasticsearch_production //节点名称 node.name: elasticsearch_005_data http.port:9200 network.host: 0.0.0.0 // 配置数据/日志/插件路径 path.data: /path/to/data1,/path/to/data2 path.logs: /path/to/logs path.plugins: /path/to/plugins //允许可视化工具访问 http.cors.enabled: true http.cors.allow-origin: "*" ``` ### 集成 > [集成](https://blog.csdn.net/zxc123e/article/details/79206526) 配置 主节点 ``` network.host: 0.0.0.0 http.cors.enabled: true http.cors.allow-origin: "*" cluster.name: idcpj_cluster node.name: idcpj_1 node.master: true ``` 子节点 ``` http.cors.enabled: true http.cors.allow-origin: "*" cluster.name: idcpj_cluster node.name: idcpj_2 node.master: false discovery.zen.ping.unicast.hosts: ["127.0.0.1"] ``` ## 问题 ### max file descriptors 4096 for elasticsearch process is too low 切换到root 用户 ``` vim /etc/security/limits.conf * soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096 ``` ### max virtual memory areas vm.maxmapcount [65530] is too low ``` sudo sysctl -w vm.max_map_count=26214 ``` ### system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own ris ``` bootstrap.memory_lock: false//修改此行 bootstrap.system_call_filter: false //添加此行 ```