使用VMvare创建虚拟机

我的创建的三台分别是:
  192.168.115.129 node-1
  192.168.115.130 node-2
  192.168.115.131 node-3

注意:克隆虚拟机的时候需要修改linux的ip策略为static,否则会导致ip一直在变

1:使用ifconfig命令查看我们Windows的网关

2:编辑虚拟机的ip ,这里只给出一份。其他两个虚拟机在克隆之后修改即可。

vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPADDR=192.168.115.130 # 这里自定义ip,192.168不能变
GATEWAY=192.168.3.1 # 这里是前面Windows查到的网关地址
NAME=ens33
UUID=51ee4604-9cf3-40c9-9d7d-cc10e9eb513e
DEVICE=ens33
ONBOOT=yes

3.下载es安装包

https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-linux-x86_64.tar.gz

创建存放目录,然后使用工具上传

mkdir /usr/local/es/

4.解压

tar -zxvf elasticsearch-7.6.2-linux-x86_64.tar.gz

5. 修改配置文件

cd ./config
vi elasticsearch.yml

这里给出node1的配置文件

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-elasticsearch
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
# 表示该节点会不会作为主节点,true表示会;false表示不会
node.master: true
# 当前节点是否用于存储数据,是:true、否:false
node.data: true
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /usr/local/es/elasticsearch-7.6.2/data
#
# Path to log files:
#
path.logs: /usr/local/es/elasticsearch-7.6.2/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: false
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.115.129
#
# Set a custom port for HTTP:
#
http.port: 9200
transport.tcp.port: 9300
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
# es7.x 之后新增的配置,写入候选主节点的设备地址,在开启服务后可以被选为主节点
discovery.seed_hosts: ["192.168.115.129","192.168.115.130","192.168.115.131"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
discovery.zen.minimum_master_nodes: 2
# 判断结点是否脱离时间配置
discovery.zen.fd.ping_timeout: 60s
# 判断结点是否脱离次数配置
discovery.zen.fd.ping_retries: 5
# es7.x 之后新增的配置,初始化一个新的集群时需要此配置来选举master
cluster.initial_master_nodes: ["node-1","node-2","node-3"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
# 表示开启蛞蝓访问支持,此值默认为fals
http.cors.enabled: true
# 表示跨域访问允许的域名地址,可使用正则表达式,“*”则表示允许所有域名访问
http.cors.allow-origin: "*"

6. jdk配置,es7.6.2需要依赖jdk11,不过7.0之后es自带jdk,如果我们自己安装的jdk,则会优先使用我们安装的,使用自带的话则需要修改配置。

具体修改可以参考该博客:
https://blog.csdn.net/xiaoxiong_web/article/details/105597150

7.创建普通用户

es无法使用root用户启动,所以我们需要创建一个用户用于es的启动

创建用户组   groupadd esgroup
创建用户 useradd -g esgroup es
设置权限 chown -R es:esgroup /usr/local/es/
设置密码 passwd es

8.修改linux内核参数

需要修改Linux文件打开最大数,否则启动会报错

修改/etc/security/limits.conf 增加下面内容

* soft nproc 65535* hard nproc 65535* soft nofile 65535* hard nofile 131072

修改/etc/sysctl.conf 增加内容: vm.max_map_count=655360

然后执行命令,使配置生效: sysctl -p

9.关闭防火墙

systemctl disable firewalld

完成以上步骤之后,开始克隆虚拟机(克隆完整镜像)

1)克隆完成之后,修改虚拟机的ip(上面有提到)

2)修改es的配置文件 elasticsearch.yml

其他两个节点只需修改node.name和host

node.name: node-2
twork.host: 192.168.115.130
node.name: node-3
twork.host: 192.168.115.131

到这里就大功告成了,切换到 es的 bin目录,启动

cd bin/
切换到之前创建的普通用户
su es
启动
./elasticsearch

注意:我遇到一个很坑的问题,因为我先启动一个节点的elasticsearch,然后再拷贝虚拟机去搭建集群,导致后面虽然配置文件没问题,但是三个节点独立存在,没有形成集群,一直以为是配置出了问题,到时候才知道需要删掉

es的data目录下的数据,否则不会更新节点信息。

Linux下搭建Elasticsearch7.6.2集群的更多相关文章

  1. linux下安装Elasticsearch(单机版和集群版)

    一.linux下安装Elasticsearch(单机) 1.软件下载 下载地址:https://www.elastic.co/cn/downloads/past-releases/elasticsea ...

  2. linux下redis的安装和集群搭建

    一.redis概述 1.1.目前redis支持的cluster特性: 1):节点自动发现. 2):slave->master 选举,集群容错. 3):Hot resharding:在线分片. 4 ...

  3. Linux上搭建Hadoop2.6.3集群以及WIN7通过Eclipse开发MapReduce的demo

    近期为了分析国内航空旅游业常见安全漏洞,想到了用大数据来分析,其实数据也不大,只是生产项目没有使用Hadoop,因此这里实际使用一次. 先看一下通过hadoop分析后的结果吧,最终通过hadoop分析 ...

  4. windows下搭建Consul分布式系统和集群

    随着大数据时代的到来,分布式是解决大数据问题的一个主要手段,随着越来越多的分布式的服务,如何在分布式的系统中对这些服务做协调变成了一个很棘手的问题.我们在一个项目上注册了很多服务,在进行运维时,需要时 ...

  5. centos7 下搭建hadoop2.9 分布式集群

    首先说明,本文记录的是博主搭建的3节点的完全分布式hadoop集群的过程,环境是centos 7,1个nameNode,2个dataNode,如下: 1.首先,创建好3个Centos7的虚拟机,具体的 ...

  6. Linux下"负载均衡+高可用"集群的考虑点 以及 高可用方案说明(Keepalive/Heartbeat)

    当下Linux运维技术越来越受到企业的关注和追捧, 在某些企业, 尤其是牵涉到电子商务和电子广告类的网站,通常会要求作负载均衡和高可用的Linux集群方案.那么如何实施Llinux集群架构,才能既有效 ...

  7. 在CentOS7下搭建Hadoop2.9.0集群

    系统环境:CentOS 7 JDK版本:jdk-8u191-linux-x64 MYSQL版本:5.7.26 Hadoop版本:2.9.0 Hive版本:2.3.4 Host Name Ip User ...

  8. 【MongoDB】在windows平台下搭建mongodb的分片集群(二)

    在上一片博客中我们讲了Mongodb数据库中分片集群的主要原理. 在本篇博客中我们主要讲描写叙述分片集群的搭建过程.配置分片集群主要有两个步骤.第一启动全部须要的mongod和mongos进程. 第二 ...

  9. Linux下搭建Lotus Domino集群

    Linux下搭建Lotus Domino 集群 本文内容是Linux平台下Lotus Domino服务器部署案例(http://chenguang.blog.51cto.com/350944/1334 ...

  10. Linux下搭建tomcat集群全记录(转)

    本文将讲述如何在Linux下搭建tomcat集群,以及搭建过程中可能的遇到的问题和解决方法.为简单起见,本文演示搭建的集群只有两个tomact节点外加一个apache组成,三者将安装在同一机器上:ap ...

随机推荐

  1. 如何查看Linux的系统信息?

    在Linux服务器上,可以通过几个简单的命令来查看操作系统的详细信息. 1.使用uname命令获取操作系统基本信息,包括内核名称.网络节点名称.内核版本.架构等. uname -a 2.查看`/etc ...

  2. Vue学习:18.Vue插槽

    Vue 中的插槽(slot)是一种灵活的机制,用于在父组件中将内容传递到子组件的特定位置.它允许我们在子组件中定义可以在父组件中传递任意内容的"插槽",从而实现更灵活的组件化. 在 ...

  3. skywalking需要引入的背景(查询调用链),传统的日志查询方法, 引入EFK日志搜索重要性

    1.根据两次请求日志的关键点来截取日志,缩小日志的范围.tail -f orderApi.log | grep "orderKeyWordSubmit"     确定两次异常请求的 ...

  4. .Net8 AddKeyedScoped键值key注册服务异常

    异常描述:This service descriptor is keyed. Your service provider may not support keyed services. 场景:.Net ...

  5. 日志之log4j2和springboot

    log4j2比logback好用. 现在之所有以spring采用logback,根据我个人的理解应该是某种非常特殊的理由.否则log4j2的性能比logback更好,且异步性能极好! 异步日志是log ...

  6. 基于 Linux 2.6的 硬中断 / 软中断的原理以及实现

    Author:zhangskd @ csdn blog 概述 从本质上来讲,中断是一种电信号,当设备有某种事件发生时,它就会产生中断,通过总线把电信号发送给中断控制器. 如果中断的线是激活的,中断控制 ...

  7. NXP i.MX 8M Mini工业级核心板规格书(四核ARM Cortex-A53 + 单核ARM Cortex-M4,主频1.6GHz)

     1 核心板简介 创龙科技SOM-TLIMX8是一款基于NXP i.MX 8M Mini的四核ARM Cortex-A53 + 单核ARM Cortex-M4异构多核处理器设计的高端工业级核心板,AR ...

  8. 深度长文解析SpringWebFlux响应式框架15个核心组件源码

    Spring WebFlux 介绍 Spring WebFlux 是 Spring Framework 5.0 版本引入的一个响应式 Web 框架,它与 Spring MVC 并存,提供了一种全新的编 ...

  9. C#开发单实例应用程序并响应后续进程启动参数

    C#默认的WinForm模板是不支持设置单实例的,也没有隔壁大哥VB.NET那样有个"生成单个实例应用程序"的勾选选项(VB某些时候要比C#更方便),实现单实例可以有多种方法: 检 ...

  10. vulnhub - w1r3s.v1.0.1

    vulnhub - w1r3s.v1.0.1 高质量视频教程 - b站红队笔记 靶机下载 本地环境 本机ip:192.168.157.131 w1r3s虚拟机设置NAT模式 信息收集 扫描网段得到攻击 ...