一、yum安装:
1. 在/etc/yum.repos.d/目录创建文件elasticsearch.repo
2. 添加以下内容
[elasticsearch-6.x] name=Elasticsearch repository for 6.x packages baseurl=https://artifacts.elastic.co/packages/6.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md
3. 执行yum命令:sudo yum install elasticsearch -y
4. 设置开机启动:sudo chkconfig --add elasticsearch
5. 启动:sudo -i service elasticsearch start
-- 关闭 sudo -i service elasticsearch stop
-- 重启 sudo -i service elasticsearch restart
二、测试项目是否运行
-- curl -X GET 'http://localhost:9200/?pretty'
返回结果类似如下显示:
{ "name" : "Cp8oag6", "cluster_name" : "elasticsearch", "cluster_uuid" : "AT69_T_DTp-1qgIJlatQqA", "version" : { "number" : "6.4.3", "build_flavor" : "default", "build_type" : "zip", "build_hash" : "f27399d", "build_date" : "2016-03-30T09:51:41.449Z", "build_snapshot" : false, "lucene_version" : "7.4.0", "minimum_wire_compatibility_version" : "1.2.3", "minimum_index_compatibility_version" : "1.2.3" }, "tagline" : "You Know, for Search" }
三、更改配置,增加远程访问
-- 配置文件目录:/etc/elasticsearch/
-- elasticsearch.yml文件增加如下属性:
- network.host: 0.0.0.0