- Elasticsearch5.X Centos7安装过程。
下载地址:Elasticsearch-5.5.2.tar.gz
ElasticSearch 安装
#Elasticsearch默认不推荐使用root用户启动,所以创建用户
#创建用户elastic
useradd elastic
#设置密码 (回车后输入密码)
passwd elastic
#切到elastic用户目录下
cd /home/elastic
#下载Elasticsearch安装包
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.2.tar.gz
#解压安装包
tar -xzvf elasticsearch-5.5.2.tar.gz
#给elastic用户设置文件读写权限
chown -R elastic:elastic elasticsearch-5.5.2
#切换到elastic用户,并启动elasticsearch
su elastic
sh elasticsearch-5.5.2/bin/elasticsearch
启动测试
执行命令 curl http://localhost:9200/
#得到以下结果则启动成功
{
"name" : "_EArkv7",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "q9gTAC0gTduDqxiV9JgE_g",
"version" : {
"number" : "5.5.2",
"build_hash" : "b2f0c09",
"build_date" : "2017-08-14T12:33:14.154Z",
"build_snapshot" : false,
"lucene_version" : "6.6.0"
},
"tagline" : "You Know, for Search"
}
主机不能访问虚拟机9200端口
编辑Elasticsearch config/elasticsearch.yml
配置文件。 如下图所示
启动过程可能遇到的错误
ERROR: bootstrap checks failed
1.max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
2.max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
1.问题一解决方法
#切换到root用户,编辑limits.conf
vi /etc/security/limits.conf
#添加如下内容
* hard nofile 65536
* soft nofile 65536
2.问题二解决方法
#切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
#添加下面配置:
vm.max_map_count=655360
#并执行命令:
sysctl -p
#重启Elasticsearch
网友评论