ElasticSearch是基于Lucene这个非常成熟的索引方案,另加上一些分布式的实现:集群,sharding,replication等。以下是对其采用yum安装的方法。
1.下载并安装GPG key
[root@linux-node1 ~]# rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
2.添加yum仓库
[root@linux-node1 ~]# cat /etc/yum.repos.d/elasticsearch.repo[elasticsearch-2.x]name=Elasticsearch repository for 2.x packagesbaseurl=http://packages.elastic.co/elasticsearch/2.x/centosgpgcheck=1gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearchenabled=1
3.安装elasticsearch
[root@hadoop-node1 ~]# yum install -y elasticsearch
4.配置elasticsearch
[root@abcdocker ~]# vim /etc/elasticsearch/elasticsearch.yml #修改配置文件cluster.name: myes #ES集群名称node.name: abcdocker-node-1 #节点名称path.data: /data/es-date #数据存储的目录(多个目录使用逗号分隔)path.logs: /var/log/elasticsearch #日志格式bootstrap.memory_lock: true #锁住es内存,保证内存不分配至交换分区network.host: 192.168.56.11 #设置本机IP地址http.port: 9200 #端口默认9200
5. 设置数据目录权限
[root@abcdocker ~]# chown -R elasticsearch:elasticsearch /data/es-date/
6.启动
[root@abcdocker ~]# systemctl start elasticsearc[root@abcdocker ~]# netstat –lntupActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 532/ssh dtcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 724/maste rtcp6 0 0 192.168.56.11:9200 :::* LISTEN 2125/jav atcp6 0 0 192.168.56.11:9300 :::* LISTEN 2125/jav atcp6 0 0 :::22 :::* LSTEN 532/sshdtcp6 0 0 ::1:25 :::*LISTEN 724/master端口默认:9200