linux centos7安装elasticsearch

Posted 自行车在路上

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux centos7安装elasticsearch相关的知识,希望对你有一定的参考价值。

慢慢写,慢慢加油

文章目录

下载es连接

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.16.3-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.16.3-linux-x86_64.tar.gz.sha512
shasum -a 512 -c elasticsearch-7.16.3-linux-x86_64.tar.gz.sha512 
tar -xzf elasticsearch-7.16.3-linux-x86_64.tar.gz

如果shasum命令找不到,请下载,

yum install perl-Digest-SHA

更改配置文件

es目录里的config里的jvm.options

-Xms256m
-Xmx256m

启动es

当启动es的bin里的

会报错

java.lang.RuntimeException: can not run elasticsearch as root
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:107)
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:183)

elasticsearch不能在root下执行
因此

创建es组,并把elasticsearch-7.16.3文件夹加入如权限

[root@localhost bin]# groupadd es
[root@localhost bin]# useradd es -g es
[root@localhost bin]# passwd es
[root@localhost bin]# chown -R es:es elasticsearch-7.16.3

切换es用户,到es的bin目录,进行启动

[root@localhost bin]# su es
[root@localhost bin]# ./elasticsearch

可启动成功了,访问

curl localhost:9200
[root@localhost ~]# curl localhost:9200

  "name" : "localhost.localdomain",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "vndxxZbCSIO58HZw8K3P1Q",
  "version" : 
    "number" : "7.16.3",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "4e6e4eab2297e949ec994e688dad46290d018022",
    "build_date" : "2022-01-06T23:43:02.825887787Z",
    "build_snapshot" : false,
    "lucene_version" : "8.10.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  ,
  "tagline" : "You Know, for Search"

参考资料

centos 解决 -bash: shasum: command not found
elasticsearch之can not run elasticsearch as root

以上是关于linux centos7安装elasticsearch的主要内容,如果未能解决你的问题,请参考以下文章

Centos7下安装Elasticsearch 5.6.6

Linux安装elasticsearch

ElasticSearch集群日志限制问题

linux 下部署单片 elasticsearch 服务

Linux Centos7部署环境安装-CentOS

如何在linux系统的was中启动节点