Springboot整合Elasticsearch(一):Linux下安装 Elasticsearch 8.x

 1、下载安装包,官方下载地址:

Past Releases of Elastic Stack Software | Elastic

elasticsearch-8.8.1-linux-x86_64.tar.gz

 2、拷贝到 Linux 服务器上, 执行解压缩命令

安装包路径:/home/ELK_8.8.1

[root@localhost ELK_8.8.1]# tar -zxvf elasticsearch-8.8.1-linux-x86_64.tar.gz

3、Elasticsearch 不能使用 root用户启动,创建 es 用户

创建新用户es:

[root@localhost ELK_8.8.1]# useradd es

设置密码:

[root@localhost ELK_8.8.1]# passwd es

设置权限:

[root@localhost ELK_8.8.1]# chown -R es:es /home/ELK_8.8.1/elasticsearch-8.8.1

4、 修改 elasticsearch.yml

为了测试,先关闭一下认证,改成 false:

# Enable security features
xpack.security.enabled: false

xpack.security.enrollment.enabled: false

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: false
  keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: false
  verification_mode: certificate

5、切换用户,启动 Elasticsearch

[root@localhost ELK_8.8.1]# cd elasticsearch-8.8.1/bin/

[root@localhost bin]# su es


[es@localhost bin]$ ./elasticsearch -d  ( -d 表示后台启动)

6、验证 Elasticsearch是否启动成功

浏览器网址输入:Elasticsearch安装的服务器IP:9200,出现以下内容,证明服务启动正常;

{
  "name" : "localhost.localdomain",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "pSTONQoCS0yYIPrvx4KY6w",
  "version" : {
    "number" : "8.8.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "f8edfccba429b6477927a7c1ce1bc6729521305e",
    "build_date" : "2023-06-05T21:32:25.188464208Z",
    "build_snapshot" : false,
    "lucene_version" : "9.6.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

Springboot整合Elasticsearch(一):Linux下安装 Elasticsearch 8.x_第1张图片

你可能感兴趣的:(JAVA进阶,ELK-Stack,springboot,linux,elasticsearch,spring,boot)