首页 > 其他分享 >elasticsearch安装-集群

elasticsearch安装-集群

时间:2023-12-12 17:11:23浏览次数:32  
标签:jdk local 集群 usr 10.10 elasticsearch 安装 es

下载安装包

国内镜像,速度非常快
https://mirrors.huaweicloud.com/elasticsearch/
https://mirrors.huaweicloud.com/kibana/

wget https://mirrors.huaweicloud.com/elasticsearch/7.9.3/elasticsearch-7.9.3-linux-x86_64.tar.gz

安装

准备3台机器:

1、安装目录:

/usr/local/elasticsearch-7.9.3

2、解压

tar -zxvf elasticsearch-7.9.3-linux-x86_64.tar.gz -C /usr/local

3、解决es强依赖jdk问题

由于es和jdk是一个强依赖的关系,所以当我们在新版本的ElasticSearch压缩包中包含有自带的jdk,但是当我们的Linux中已经安装了jdk之后,就会发现启动es的时候优先去找的是Linux中已经装好的jdk,此时如果jdk的版本不一致,就会造成jdk不能正常运行,报错如下:

warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
Future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/jdk1.8.0_291/jre] does not meet this requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.

注:如果Linux服务本来没有配置jdk,则会直接使用es目录下默认的jdk,反而不会报错

解决办法:
修改elasticsearch启动脚本
vim /usr/local/elasticsearch-7.9.3/elasticsearch

source "`dirname "$0"`"/elasticsearch-env

这句后面追加以下

############## 添加配置解决jdk版本问题 ##############
# 将jdk修改为es中自带jdk的配置目录
export JAVA_HOME=/usr/local/elasticsearch-7.13.2/jdk
export PATH=$JAVA_HOME/bin:$PATH

if [ -x "$JAVA_HOME/bin/java" ]; then
        JAVA="/usr/local/elasticsearch-7.13.2/jdk/bin/java"
else
        JAVA=`which java`
fi

4、新增专用用户并授权

#新增专用用户
useradd user-es
#为用户授权目录:
chown user-es:user-es -R /usr/local/elasticsearch-7.9.3

es用户拥有的内存权限太小,至少需要262144
切换到root用户,执行命令
vim /etc/sysctl.conf
文件最后添加 vm.max_map_count=262144

5、设置集群和节点, 启动

# 10.10.1.11机器的配置
vim /usr/local/elasticsearch-7.9.3/config/elasticsearch.yml

cluster.name: testes
node.name: es-node0
network.host: 10.10.1.11
discovery.seed_hosts: ["10.10.1.11","10.10.1.12","10.10.1.13"]
cluster.initial_master_nodes: ["es-node0","es-node1","es-node2"]
# 10.10.1.12机器的配置
vim /usr/local/elasticsearch-7.9.3/config/elasticsearch.yml

cluster.name: testes
node.name: es-node1
network.host: 10.10.1.12
discovery.seed_hosts: ["10.10.1.11","10.10.1.12","10.10.1.13"]
cluster.initial_master_nodes: ["es-node0","es-node1","es-node2"]
# 10.10.1.13机器的配置
vim /usr/local/elasticsearch-7.9.3/config/elasticsearch.yml

cluster.name: testes
node.name: es-node2
network.host: 10.10.1.13
discovery.seed_hosts: ["10.10.1.11","10.10.1.12","10.10.1.13"]
cluster.initial_master_nodes: ["es-node0","es-node1","es-node2"]

启动
su user-es
前台运行:
/usr/local/elasticsearch-7.9.3/bin/elasticsearch
后台运行:
/usr/local/elasticsearch-7.9.3/bin/elasticsearch -d

跟踪日志tail -100f /usr/local/elasticsearch-7.9.3/logs/testes.log
出现started为正常

6、可能遇到的问题

6.1 可能遇到 max file descriptors [4096]问题

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
切换到root用户,执行命令
vi /etc/security/limits.conf
文件最后添加

* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

重启linux

6.2 可能遇到 max number of threads [2048] for user [user-es] is too low, increase to at least [4096]

切换到root用户,执行命令
vi /etc/security/limits.conf
文件最后添加

user-es - nproc 65535

重启linux

标签:jdk,local,集群,usr,10.10,elasticsearch,安装,es
From: https://www.cnblogs.com/binli33/p/17897340.html

相关文章

  • 在Windows 10上安装和配置EasyGUI库的步骤
     EasyGUI是一个方便易用的Python库,可以帮助开发者快速构建图形用户界面(GUI)应用程序。下面是在Windows10上安装和配置EasyGUI库的步骤: 1.安装Python: 首先,确保你的Windows10系统已经安装了Python解释器。 2.安装pip: 在Windows10上,可以通过以下步骤安装pip包管理器: -打开命......
  • Redhat7或Centos7自带Yum源卸载并安装国内Yum源
    自带Yum源卸载由于操作yum源涉及到权限,我们使用的普通用户是无法操作的。这里我们要登陆超级权限账号。(默认账号是root,如果你在安装时修改过就把下面命令的root修改为你安装输入的账号名)注意:这里回车后输入密码是不显示的,密码也是你安装时填写的。输入好密码回车,下一条左边就会......
  • Linux系统安装docker源失败
    错误描述yum添加完docker源的地址,执行yummakecache后返回如下的问题yummakecachefailure:repodata/repomd.xmlfromdocker-ce-stable:[Errno256]Nomoremirrorstotry. https://download.docker.com/linux/centos/$releasever/x86_64/stable/repodata/repomd.xml:[Err......
  • 在 RHEL 上安装 Docker 引擎
    参考 在RHEL上安装Docker引擎(s390x)|Docker文档1、在尝试安装新版本之前卸载任何此类旧版本,以及相关的依赖项。同时卸载和关联的依赖项(如果已安装):dockerdocker-enginePodmansudoyumremovedocker\docker-client\docker-clie......
  • 【Centos】Centos 7.6 安装 PostageSQL 14
    1  前言接上节,配置完虚拟内存,首先我先安装下数据库。2 安装步骤2.1 查看系统信息查看发行版本cat/etc/centos-release 查看处理器类型2.2 前往官网根据系统信息,以及要安装的版本信息:https://www.postgresql.org/download/linux/redhat/2.3 命令执行2.3......
  • 从根上理解elasticsearch(lucene)查询原理(2)-lucene常见查询类型原理分析
    大家好,我是蓝胖子,在上一节我提到要想彻底搞懂elasticsearch慢查询的原因,必须搞懂lucene的查询原理,所以在上一节我分析了lucene查询的整体流程,除此以外,还必须要搞懂各种查询类型内部是如何工作,比如比较复杂的查询是将一个大查询分解成了小查询,然后通过对小查询的结果进行合并得到......
  • docker 安装
    1.防御性操作——卸载。其实我的os是Ubuntu2004,应该是不会有的,但是我还是执行了一下:apt-getremovedockerdocker-enginedocker.iocontainerdrunc2.惯例,执行aptupdate:3.安装docker依赖,docker在Ubuntu上有一些依赖的软件包,一个命令搞定:apt-getinstallca-certifica......
  • Rocky Linux 9 安装 Podman
    1、安装Podmandnf-yinstallpodman2、配置镜像加速和私有镜像仓库#vim/etc/containers/registries.confunqualified-search-registries=["docker.io"][[registry]]prefix="docker.io"insecure=falseblocked=falselocation="docker.io"......
  • httprunner 安装
    接口自动化httprunner4.x安装  python最好安装3.8及以下安装pip3installhttprunner 卸载 pip3uninstallhttprunner安装后查看是否安装成功提示:'hrp'不是内部或外部命令 由于安装的是httprunner4.x的版本,不能直接使用hrp命令行工具,需要手动配置,下载编译产物,......
  • RabbitMQ-3.12:安装教程详解
    安装环境: centOS7操作系统1.1什么是MQMQ即消息队列(MessageQueue),是一种用于进行异步通信的技术。它允许应用程序异步地向队列中发送消息,而不需要立即等待接收方处理完毕。MQ将消息缓存在队列中,等待消费者进行处理1.2什么是RabbitMQRabbitMQ是一个开源的消息队列中间件,它实......