Elasticsearch安装包下载(一定不要安装在root下 可安装在/opt)
1)Elasticsearch官网: https://www.elastic.co/products/elasticsearch
2.2 安装Elasticsearch(单节点Linux环境)
[root@bigdata13 elasticsearch-5.2.2]# useradd itstar
1)解压elasticsearch-5.6.1.tar.gz到/opt/module目录下
[itstar@bigdata11 software]$ tar -zxvf elasticsearch-5.6.1.tar.gz -C /opt/module/
2)在/opt/module/elasticsearch-5.6.1路径下创建data和logs文件夹
[itstar@bigdata11 elasticsearch-5.6.1]$ mkdir data
[itstar@bigdata11 elasticsearch-5.6.1]$ mkdir logs
[root@bigdata13 elasticsearch-5.2.2]# chown -R itstar:itstar /opt/module/elasticsearch-5.2.2/
3)修改配置文件/opt/module/elasticsearch-5.2.2/config/elasticsearch.yml
[itstar@bigdata11 config]$ pwd
/opt/module/elasticsearch-5.6.1/config
[itstar@bigdata11 config]$ vi elasticsearch.yml
# ---------------------------------- Cluster ------------------------------------- cluster.name: Andy # ------------------------------------ Node --------------------------------------(三个不能一样) node.name: node-102 # ----------------------------------- Paths --------------------------------------- path.data: /opt/module/elasticsearch-5.6.1/data path.logs: /opt/module/elasticsearch-5.6.1/logs # ----------------------------------- Memory ----------------------------------- bootstrap.memory_lock: false bootstrap.system_call_filter: false # ---------------------------------- Network ------------------------------------ network.host: 192.168.1.102 # --------------------------------- Discovery ------------------------------------ discovery.zen.ping.unicast.hosts: ["bigdata11"] |
(1)cluster.name
如果要配置集群需要两个节点上的elasticsearch配置的cluster.name相同,都启动可以自动组成集群,这里如果不改cluster.name则默认是cluster.name=my-application,
(2)nodename随意取但是集群内的各节点不能相同
(3)修改后的每行前面不能有空格,修改后的“:”后面必须有一个空格
5)配置linux系统环境(参考:http://blog.csdn.net/satiling/article/details/59697916)
(1)编辑limits.conf 添加类似如下内容
[itstar@bigdata11 elasticsearch-5.6.1]$ sudo vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
(2)进入limits.d目录下修改配置文件。
[itstar@bigdata11 elasticsearch-5.6.1]$ sudo vi /etc/security/limits.d/20-nproc.conf
修改如下内容:
* soft nproc 1024
#修改为
* soft nproc 2048
(3)修改配置sysctl.conf
[itstar@bigdata11 elasticsearch-5.6.1]$ sudo vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
[itstar@bigdata11 elasticsearch-5.6.1]$ sudo sysctl -p
然后,重新启动elasticsearch,即可启动成功。
6)启动elasticsearch
[itstar@hadoop105 elasticsearch-5.6.1]$ bin/elasticsearch
后台启动方式
[itstar@hadoop105 elasticsearch-5.6.1]$ bin/elasticsearch -d
7)测试elasticsearch
[itstar@bigdata11 elasticsearch-5.6.1]$ curl http://bigdata11:9200{ "name" : "node-102", "cluster_name" : "my-application", "cluster_uuid" : "znZfW5tGQou9rKzb6pG6vA", "version" : { "number" : "5.6.1", "build_hash" : "667b497", "build_date" : "2017-09-14T19:22:05.189Z", "build_snapshot" : false, "lucene_version" : "6.6.1" }, "tagline" : "You Know, for Search" } |
chrome://extensions/