ElasticSearch安装

ElaticSearch安装

ElasticSearch介绍

Elasticsearch是一个基于Lucene的实时的分布式搜索和分析引擎。
设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。
基于Restful接口
- 普通请求是...get?a=1
- rest请求...get/a/1

ElasticSearch的用户
- Github,Wikipedia,ebay等...

1.解压文件

[root@node01 software]# tar -zxvf elasticsearch-2.4.0.tar.gz -C /opt/modules/

Markdown

2.编写ElasticSearch配置文件

修改config/elasticsearch.yml    (注意要顶格写,冒号后面要加一个空格)
a)  Cluster.name: matrix   (同一集群要一样)
b)  Node.name: node-1  (同一集群要不一样)
c)  Network.Host: 192.168.230.10   这里不能写127.0.0.1
d)  防止脑裂的配置
# 关闭组合方式寻找机器
discovery.zen.ping.multicast.enabled: false
# 寻找机器的时间
discovery.zen.ping_timeout: 120s
client.transport.ping_timeout: 60s
# 在集群里有可能找到这几个机器
discovery.zen.ping.unicast.hosts: ["192.168.230.10","192.168.230.11", "192.168.230.12"]

2.1.配置node01节点上的ElasticSearch

[root@node01 modules]# cd elasticsearch-2.4.2
[root@node01 elasticsearch-2.4.2]# vi config/elasticsearch.yml

a)  Cluster.name: matrix
b)  Node.name: node-1
c)  Network.Host: 192.168.230.10

discovery.zen.ping.multicast.enabled: false
discovery.zen.ping_timeout: 120s
client.transport.ping_timeout: 60s
discovery.zen.ping.unicast.hosts: ["192.168.230.10","192.168.230.11", "192.168.230.12"]

Markdown

Markdown

Markdown

2.2.将node01节点上的ElasticSearch分发到node02、node03节点上

[root@node01 modules]# scp -r elasticsearch-2.4.2 root@node02:/opt/modules/
[root@node01 modules]# scp -r elasticsearch-2.4.2 root@node03:/opt/modules/

2.2.配置node02节点上的ElasticSearch

[root@node01 elasticsearch-2.4.2]# vi config/elasticsearch.yml

a)  Cluster.name: matrix
b)  Node.name: node-2
c)  Network.Host: 192.168.230.11

discovery.zen.ping.multicast.enabled: false
discovery.zen.ping_timeout: 120s
client.transport.ping_timeout: 60s
discovery.zen.ping.unicast.hosts: ["192.168.230.10","192.168.230.11", "192.168.230.12"]

2.2.配置node03节点上的ElasticSearch

[root@node01 elasticsearch-2.4.2]# vi config/elasticsearch.yml

a)  Cluster.name: matrix
b)  Node.name: node-3
c)  Network.Host: 192.168.230.12

discovery.zen.ping.multicast.enabled: false
discovery.zen.ping_timeout: 120s
client.transport.ping_timeout: 60s
discovery.zen.ping.unicast.hosts: ["192.168.230.10","192.168.230.11", "192.168.230.12"]

3.启动ElasticSearch集群

注意:Elastic不能在root用户下运行,node01、node02、node03机器是一样的步骤

[root@node01 elasticsearch-2.4.2]# useradd matrix
[root@node01 elasticsearch-2.4.2]# chown -R matrix:matrix ../*
[root@node01 elasticsearch-2.4.2]# ll
total 48
drwxr-xr-x. 2 matrix matrix  4096 Jan  6 18:30 bin
drwxr-xr-x. 2 matrix matrix  4096 Jan  6 20:21 config
drwxr-xr-x. 2 matrix matrix  4096 Jan  6 18:30 lib
-rw-rw-r--. 1 matrix matrix 11358 Jan 27  2016 LICENSE.txt
drwxr-xr-x. 2 matrix matrix  4096 Jan  6 20:34 logs
drwxrwxr-x. 4 matrix matrix  4096 Jan 27  2016 modules
-rw-rw-r--. 1 matrix matrix   150 Jan 27  2016 NOTICE.txt
-rw-rw-r--. 1 matrix matrix  8700 Jan 27  2016 README.textile
[root@node01 elasticsearch-2.2.0]# passwd matrix
Changing password for user matrix.
New password: 
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@node01 elasticsearch-2.2.0]# su matrix

3.1.运行ElasticSearch

[matrix@node01 elasticsearch-2.4.2]$ chmod u+x ./bin/elasticsearch
[matrix@node01 elasticsearch-2.4.2]$ ./bin/elasticsearch

Markdown

4.ElasticSearch安装后访问http://localhost:9200

注意这里最好用火狐或者chrome浏览器

http://192.168.230.10:9200/

Markdown

http://192.168.230.11:9200/

Markdown

http://192.168.230.12:9200/

Markdown

4.1.查看整个集群的状态

http://192.168.230.11:9200/_cluster/health?pretty

Markdown

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值