Linux Centos7下安装Elasticsearch

  1. 如果没有安装Java环境, 需要先安装。

通过yum list java* 查看需要安装的java版本。

image


这里安装 java-1.8.0-openjdk。 yum -y install java-1.8.0-openjdk

image


查看java版本是否安装成功。java -version

image

  1. 下载并安装GPG公共签名秘钥

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

  1. 添加 Elasticsearch 的 yum 仓库。vim /etc/yum.repos.d/elasticsearch.repo 后,把下面配置写进去。

[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

  1. yum安装Elasticsearch.

yum install elasticsearch

  1. 配置Elasticsearch, 配置外网访问, 端口。vim /etc/elasticsearch/elasticsearch.yml

image

如果这里不设置 cluster.initial_master_nodes 节点,会报错如下:

bootstrap check failure [1] of [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_host...be configured
Sep 16 15:52:03 VM_0_8_centos systemd-entrypoint[19004]: ERROR: Elasticsearch did not exit normally - check the logs at /var/log/elasticsearch/elasticsearch.log

image

  1. 配置完成后,启动Elasticsearch.

systemctl restart elasticsearch.service

  1. 查看Elasticsearch的状态。绿色代表已启动了。

systemctl status elasticsearch.service

image

  1. 测试ES能否请求。curl localhost:9200, 或者用 postman用外网ip请求试试。
{
    "name": "node-1",
    "cluster_name": "elasticsearch",
    "cluster_uuid": "_na_",
    "version": {
        "number": "7.14.1",
        "build_flavor": "default",
        "build_type": "rpm",
        "build_hash": "66b55ebfa59c92c15db3f69a335d500018b3331e",
        "build_date": "2021-08-26T09:01:05.390870785Z",
        "build_snapshot": false,
        "lucene_version": "8.9.0",
        "minimum_wire_compatibility_version": "6.8.0",
        "minimum_index_compatibility_version": "6.0.0-beta1"
    },
    "tagline": "You Know, for Search"
}

image


image

至此,安装Elasticsearch的流程结束!

相关文章

TCP/IP套接字登录方法是MySQL在一切服务平台都提供的一种登录...
easy-rule规则引擎最佳落地
Elasticsearch 是一个分布式、高扩展、高实时的搜索与数据分...
最近壹哥的一个学生,在利用spring-data-elasticsearch访问E...
java 操作elasticsearch详细总结
原文链接:http://www.ruanyifeng.com/blog/2017/08/elastic...