Elasticsearch安装笔记

1 准备JDK

每个节点:
安装JDK1.8 并配置JAVA_HOME

2 创建ES用户

每个节点:
默认ES 6.x.x 不允许root用户运行的,否则ES运行的时候会报错,所以我们需要创建新的用户

[root@es-1  zywa]# groupadd es  
[root@es-1 zywa]# useradd es -g es  
[root@es-1 zywa]# passwd es  
更改用户 es 的密码 。  
新的 密码:  
重新输入新的 密码:  
passwd: 所有的身份验证令牌已经成功更新。

3 下载ES安装包

集群节点es-01:
下载地址:https://www.elastic.co/products/elasticsearch
以6.2.2版本为例

4 解压

集群节点es-01:

tar zxvf  elasticsearch-6.2.2.tar.gz

解压成功后获得elasticsearch-6.2.2文件夹
保存到/zywa目录下

5 修改ES目录权限

集群节点es-01:
修改ES的根目录的权限

chown -R es:es elasticsearch-6.2.2  

6 分发ES

将集群节点es-01的/zywa/elasticsearch-6.2.2 分发至集群各个节点(集群节点es-02h和es-03)

7 修改配置

1.每个节点:
修改的/zywa/elasticsearch-6.2.2/config/jvm.options

-Xms15g
-Xmx15g

这两个数最大为31,并且最好不要超过内存的50%

2.集群节点es-01:
修改/zywa/elasticsearch-6.2.2/config/elasticsearch.yml

cluster.name: my_es_cluster
node.name: node-1
node.master: true
node.data: true
#防止脑裂 n/2(取整) + 1   # 其中n为节点数
discovery.zen.minimum_master_nodes: 2   
http.cors.enabled: true
http.cors.allow-origin: "*"
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["es-01","es-02","es-03"]

3.集群节点es-02:
修改/zywa/elasticsearch-6.2.2/config/elasticsearch.yml

cluster.name: my_es_cluster
node.name: node-2
node.master: true
node.data: true
#防止脑裂 n/2(取整) + 1   # 其中n为节点数
discovery.zen.minimum_master_nodes: 2   
http.cors.enabled: true
http.cors.allow-origin: "*"
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["es-01","es-02","es-03"]

4.集群节点es-03:
修改/zywa/elasticsearch-6.2.2/config/elasticsearch.yml

cluster.name: my_es_cluster
node.name: node-3
node.master: true
node.data: true
#防止脑裂 n/2(取整) + 1   # 其中n为节点数
discovery.zen.minimum_master_nodes: 2   
http.cors.enabled: true
http.cors.allow-origin: "*"
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["es-01","es-02","es-03"]

8 安装ik分词器

每个节点:

下载

下载地址:https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.2.2/elasticsearch-analysis-ik-6.2.2.zip
将elasticsearch-analysis-ik-6.2.2.zip放入/zywa/elasticsearch/plugins/

解压

1.进入目录

cd /zywa/elasticsearch/plugins/

2.解压

unzip elasticsearch-analysis-ik-6.2.2.zip

3.删除压缩包

rm elasticsearch-analysis-ik-6.2.2.zip

9 启动ES

每个节点:
进入目录/zywa/elasticsearch
执行

 bin/elasticsearch -d

10 验证

[root@es-01 ~]# curl -i ”es-01:9200”

可以看到如下信息:

HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 428

{
  "name" : "node-1",
  "cluster_name" : "my_es_cluster",
  "cluster_uuid" : "45F0hjhNSRuC7LMmdwkULw",
  "version" : {
    "number" : "6.2.2",
    "build_hash" : "10b1edd",
    "build_date" : "2018-02-16T19:01:30.685723Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值