linux系统安装elasticsearch搜索服务器

硅谷探秘者 1333 0 0

软件下载地址:https://pan.baidu.com/s/13gX0ParcOMO_XYcdfSPlzg   提取码:9y0e

安装的时候注意jdk和elasticsearch版本问题,本次测试版本:java 14,elasticsearch 7.6.0

elasticsearch安装需要依赖java环境,所以首先配置java环境变量: http://www.jiajiajia.club/blog/artical/yjw520/21

将elasticsearch的安装包上传到linux系统,我放在了 /usr/local 文件夹下。解压

进入elasticsearch的安装目录:/usr/local/elasticsearch-7.6.0/

执行运行命令:

./bin/elasticsearch

如果报错如下:

error:
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000600000000, 8589934592, 0) failed; error='Not enough space' (errno=12)

说明你服务器的内存不够,修改配置文件:

注意(下面所有的修改配置文件均在root用户下进行)

vim ./config/jvm.options

将相应的配置修改为如下(根据自己的服务器大小来):

-Xms512m
-Xmx512m

修改完成后再次启动报错:

uncaught exception in thread [main]
java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105)
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172)
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349)

这是权限问题,elasticsearch不能再root用户下启动,所以需要添加es用户,赋予相应的权限,再es用户下启动。

添加es用户,用es用户启动

useradd es
passwd es
chown -R es:es /usr/local/elasticsearch-7.6.0
su es
./bin/elasticsearch

如果没问题的话,启动成功,在另一个连接终端下执行:curl -X GET http://localhost:9200,会出现如下代码:

{
  "name" : "192.168.202.128",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "B-eVRGgOQFe7QgKgqHpQHA",
  "version" : {
    "number" : "7.6.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "7f634e9f44834fbc12724506cc1da681b0c3b1e3",
    "build_date" : "2020-02-06T00:09:00.449973Z",
    "build_snapshot" : false,
    "lucene_version" : "8.4.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

解决外网不可访问问题:

前提是防火墙将 9200端口放开

修改配置文件:
vim ./config/elasticsearch.yml 
末尾添加:
network.host: 0.0.0.0

修改上述配置文件后启动报错:

错误1
ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

修改

vim /etc/security/limits.conf
#添加:
* soft nofile 65536
* hard nofile 65536
#此文件修改后需要重新登录
错误2
ERROR: [2] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

修改:

vim /etc/sysctl.conf
#末尾添加:
vm.max_map_count=655360
#保存执行如下命令:
sysctl -p
错误3
ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

修改:

vim ./config/elasticsearch.yml

追加:

cluster.initial_master_nodes: ["node-1"]

开放端口后外网访问:http://192.168.202.128:9200/

{
  "name" : "192.168.202.128",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "B-eVRGgOQFe7QgKgqHpQHA",
  "version" : {
    "number" : "7.6.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "7f634e9f44834fbc12724506cc1da681b0c3b1e3",
    "build_date" : "2020-02-06T00:09:00.449973Z",
    "build_snapshot" : false,
    "lucene_version" : "8.4.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

 


评论区
请写下您的评论...
暂无评论...
猜你喜欢
框架 1525 环境::centos7java环境:jdk1.8版本:elasticsearch-7.3.2elasticsearch下载官网:https://www.elastic.co/cn
其他 4061 1.卸载apache查看有没有过:yumlist|grephttpd停止:systemctlstophttpd.service卸载httpd:yumerase
linux系统 1808 软件版本:一、linux版本:CentOS-7-x86_64-DVD-1708.iso下载地址:http://mirror.nsc.liu.se/centos-store/7.4.1708
weblog 1003 环境:centos7rabbitmq:rabbitmq-server-3.6.10-1.el7.noarch.rpmsocatyum-yinstallsocat
weblog 1114 centos7版本部署的tomcat,需要将8080端口放开执行如下命令:firewall-cmd--zone=public--add-port=8080/tcp--permanentfirewall
linux 1009 /rabbitmq/erlang-rpm/releases,我下载的版本是23.3.4.6上传到上执行命令:rpm-ivherlang-23.3.4.6-1.el7.x86_64.rpm二、
linux系统 3058 linuxyummysql1.下载并MySQL官方的YumRepository[root@localhost/]#wget-i-chttp://dev.mysql.com/get
apache服务器安装教程 linux 933 1.卸载apache查看有没有过yumlist|grephttpd停止:systemctlstophttpd.service卸载httpd:yumerase
归档
2018-11  12 2018-12  33 2019-01  28 2019-02  28 2019-03  32 2019-04  27 2019-05  33 2019-06  6 2019-07  12 2019-08  12 2019-09  21 2019-10  8 2019-11  15 2019-12  25 2020-01  9 2020-02  5 2020-03  16 2020-04  4 2020-06  1 2020-07  7 2020-08  13 2020-09  9 2020-10  5 2020-12  3 2021-01  1 2021-02  5 2021-03  7 2021-04  4 2021-05  4 2021-06  1 2021-07  7 2021-08  2 2021-09  8 2021-10  9 2021-11  16 2021-12  14 2022-01  7 2022-05  1 2022-08  3 2022-09  2 2022-10  2 2022-12  5 2023-01  3 2023-02  1 2023-03  4 2023-04  2 2023-06  3 2023-07  4 2023-08  1 2023-10  1 2024-02  1 2024-03  1
标签
算法基础 linux 前端 c++ 数据结构 框架 数据库 计算机基础 储备知识 java基础 ASM 其他 深入理解java虚拟机 nginx git 消息中间件 搜索 maven redis docker dubbo vue 导入导出 软件使用 idea插件 协议 无聊的知识 jenkins springboot mqtt协议 keepalived minio mysql ensp 网络基础 xxl-job rabbitmq haproxy srs 音视频 webrtc javascript
目录
没有一个冬天不可逾越,没有一个春天不会来临。最慢的步伐不是跬步,而是徘徊,最快的脚步不是冲刺,而是坚持。