centos8 安装ElasticSearch
准备工作:
由于ElasticSearch 是java开发的所以需要安装Java的开发环境
安装jdk
sudo yum search java-11
sudo yum install java-11-openjdk.x86_64 -y
安装 ElasticSearch 7.8
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.0-x86_64.rpm
rpm -ivh elasticsearch-7.8.0-x86_64.rpm
这样就安装成功了
设置开机启动
systemctl daemon-reload # 重新加载systemd程序的配置文件
systemctl enable elasticsearch.service # 设置开机自启动
systemctl start elasticsearch.service # 启动服务
访问curl -XGET http://localhost:9200
[root@zhufanyu ~]# curl -XGET http://localhost:9200
{
"name" : "zhufanyu",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "afsn8pUNT4ephGnrWadBMA",
"version" : {
"number" : "7.8.0",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "757314695644ea9a1dc2fecd26d1a43856725e65",
"build_date" : "2020-06-14T19:35:50.234439Z",
"build_snapshot" : false,
"lucene_version" : "8.5.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
配合ES
进入ES配置文件的目录 /etc/elasticsearch
elasticsearch.yml 是es的配置文件,jvm.options是jvm的配置文件
node.name: node-1
cluster.initial_master_nodes: ["node-1"]
取消上面的注释, 保存退出
重启ES
systemctl restart elasticsearch.service
开启远程访问连接
修改elasticsearch.yml 配置文件
network.host: 0.0.0.0
http.port: 9200
重启ES
防火墙开放9200端口,云服务器安全组规则里开放9200端口