Elasticsearch 5.x安装
node1 | elasticsearch |
node2 | elasticsearch |
node3 | elasticsearch |
前期准备
- JDK1.8
- 修改/etc/security/limits.conf
elasticsearch hard nofile 65536 elasticsearch soft nofile 65536
1.下载并安装
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.1.rpm
rpm -ivh elasticsearch-5.2.1.rpm
2.修改配置文件/etc/elasticsearch/elasticsearch.yml
cluster.name: test #集群名称 node.name: es-node1 #(节点名称)每个节点不同 path.data: /dfs/elasticsearch #可以指定多个 path.logs: /dfs/elasticsearch/logs network.host: 0.0.0.0
discovery.seed_hosts: ["IP1","IP2","IP3"] http.cors.enabled: true http.cors.allow-origin: "*" bootstrap.memory_lock: false bootstrap.system_call_filter: false discovery.zen.ping.unicast.hosts: ["node1", "node2", "node3"]
如果调整内存,修改/etc/elasticsearch/jvm.options文件,两个值需要一致。
-Xms2g
-Xmx2g
3.创建数据和日志目录
mkdir -p /dfs/elasticsearch/logs chown elasticsearch.elasticsearch -R /dfs/elasticsearch
4.修改/etc/init.d/elasticsearch
定义JAVA_HOME
export JAVA_HOME=/path/java(按照实际路径修改)
启动,如果有错误查看日志排错
/etc/init.d/elasticsearch start
5.安装elasticsearch-head,5.x版本elasticsearch-head已经不能作为插件安装了
1.可以使用chrome安装elasticsearch-head插件 https://chrome.google.com/webstore/detail/elasticsearch-head/ffmkiejjmecolpfloofpjologoblkegm 2.使用python启动 git clone git://github.com/mobz/elasticsearch-head.git cd elasticsearch-head python -m SimpleHTTPServer 会监听在8000端口,然后访问IP:8000