ES 6.2.2 安装
一、下载es
我这里使用的是6.2.2版本。下载地址如下:
https://www.elastic.co/products/elasticsearch
二、解压:
tar zxvf elasticsearch-6.2.2.tar.gz
解压成功后获得elasticsearch-6.2.2文件夹
三、创建es用户
默认ES 6.x.x 不允许root用户运行的,否则ES运行的时候会报错,所以我们需要创建新的用户
- [[email protected] es]# groupadd es
- [roo[email protected] es]# useradd es -g es
- [[email protected] es]# passwd es
- 更改用户 es 的密码 。
- 新的 密码:
- 重新输入新的 密码:
- passwd: 所有的身份验证令牌已经成功更新。
四、修改es目录权限
修改ES的根目录的权限
chown -R es:es elasticsearch-6.2.2
五、运行es
切换当前用户为es , 进入es的目录, 使用命令
./bin/elasticsearch 就可以将ES 运行起来了
命令示例:
- [[email protected] es]# su es
- [[email protected] es]$ cd elasticsearch-6.2.2
- [[email protected] elasticsearch-6.2.2]$ ./bin/elasticsearch
正常的启动后我们可以看到如下信息:
可以验证一下服务是否正常
输入 :
curl -i "http://localhost:9200"
如果可以看到如下信息说明启动正常:
- HTTP/1.1 200 OK
- content-type: application/json; charset=UTF-8
- content-length: 436
- {
- "name" : "linux-2",
- "cluster_name" : "li-application",
- "cluster_uuid" : "LeGL4ApCTDS-Nj76INkZAg",
- "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"
- }
六、配置es,使得支持外网访问:
修改配置文件elasticsearch.yml
去掉以**释,修改以下配置(记得配置项名称冒号后面是有一个空格的,若没有空格会报错
cluster.name: my_es#集群名称,可以自行修改
node.name: lnoide-1 #节点名称,自行修改
network.host: 172.16.111.111 #主机地址,这里写本机IP
http.port: 9200 #端口
修改后,再次启动ES,可能会报一下错误:
ERROR: bootstrap checks failed
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
问题原因:因为Centos6不支持SecComp,而ES5.2.1默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。详见 :https://github.com/elastic/elasticsearch/issues/22899
解决方法:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
修改后再次启动
通过浏览器访问:
页面如果出现以下信息表示安装成功!在启动的时候也可能会报其他错误,可以根据具体报错信息进行相关处理。
http://192.168.111.111:9200/