Elasticsearch-Kibana-7.13.2版本单机/集群搭建(一)

5 篇文章 0 订阅

Part1:安装单机/集群版ES

  • 环境版本
    Redhat/Centos7.0
    Elasticsearch7.13.2
    Kibana7.13.2
    jdk11
  • 下载
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.2-linux-x86_64.tar.gz
  • 解压
tar -xzvf elasticsearch-7.13.2-linux-x86_64.tar.gz
  • 修改配置文件
#进入配置目录
cd elasticsearch-7.13.2/config
#修改配置文件
vim elasticsearch.yml
#修改端口绑定
#====start====
#集群名称 同一集群的机器配置相同的名称
cluster.name: my-application
#节点名称 同一集群的机器配置不同的名称
node.name: node-1
#所有ip可访问,默认非本机不能访问
network.host: 0.0.0.0
#需要发现的集群节点(也可以只配置已在ES集群中的一个节点,该配置主要用于加入集群时的通信) 单节点可以不配置 
discovery.seed_hosts: ["192.168.137.127:9300", "192.168.137.128:9300", "192.168.137.129:9300"]
#初始化时候选主节点
cluster.initial_master_nodes: ["node-1"]
#开启跨域访问用于后续的监控组件使用
http.cors.enabled: true
http.cors.allow-origin: "*"
#====end====
  • 修改系统环境变量 此操作需要root权限
启动es报错:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
#使配置永久生效
#修改/etc/sysctl.conf
vim /etc/sysctl.conf
#This file contains the maximum number of memory map areas a process may have. Memory map areas are used as a side-effect of calling malloc, directly by mmap and mprotect, and also when loading shared libraries.While most applications need less than a thousand maps, certain programs, particularly malloc debuggers, may consume lots of them, e.g., up to one or two maps per allocation.The default value is 65536.
#max_map_count文件包含限制一个进程可以拥有的VMA(虚拟内存区域)的数量。虚拟内存区域是一个连续的虚拟地址空间区域。在进程的生命周期中,每当程序尝试在内存中映射文件,链接到共享内存段,或者分配堆空间的时候,这些区域将被创建。调优这个值将限制进程可拥有VMA的数量。限制一个进程拥有VMA的总数可能导致应用程序出错,因为当进程达到了VMA上线但又只能释放少量的内存给其他的内核进程使用时,操作系统会抛出内存不足的错误。如果你的操作系统在NORMAL区域仅占用少量的内存,那么调低这个值可以帮助释放内存给内核用。
#====start====
vm.max_map_count=262144
#====end====

#使配置临时生效
sysctl -w vm.max_map_count=262144

#查看结果:
sysctl -a | grep vm.max_map_count
  • 修改jvm参数
机器内存不够,启动es报错:
Exception in thread "main" java.nio.file.AccessDeniedException: /opt/soft/elasticsearch-7.13.2/config/jvm.options
#根据机器配置,配置合适的参数
vim config/jvm.options
#====start====
-Xms512m
-Xmx512m
#====end====
  • 修改最大文件描述符和最大用户线程数
启动es报错:
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [1786] for user [lck] is too low, increase to at least [4096]
vim /etc/security/limits.conf
#====start====
#*代表对所有用户生效 设置后不生效可以重启机器试试
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
#====end====

#修改后**重新登陆**,查看修改结果。设置不生效可以重启机器试试
ulimit -Hn
ulimit -Sn
  • 启动Es

    • 添加用户 es启动不能使用root用户

      #adduser
      useradd elk
      #update password
      echo "password" | passwd elk --stdin
      #change file owner
      chown -R elk:elk elk安装目录
      #设置elk角色具有sudo权限
      vim /etc/sudoers
      #====start====
      elk ALL=(ALL) ALL
      #====end====
      

如果是复制的文件夹创建的集群记得把data目录删除,该目录记录了es实例的唯一标识信息,该标识集群中不能重复

#切换到非root用户启动
#前台启动
bin/elasticsearch
#后台启动
bin/elasticsearch -d
  • 验证启动是否成功
#验证启动成功
http://192.168.137.127:9200/
#查看集群状态
http://192.168.137.127:9200/_cat/health?v
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ERROR Failed to compile with 48 errors 上午10:53:54 These dependencies were not found: * core-js/modules/es.array.push.js in ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/objectSpread2.js, ./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/.store/babel-loader@8.3.0/node_modules/babel-loader/lib!./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/.store/vue-loader@15.10.1/node_modules/vue-loader/lib??vue-loader-options!./src/components/HeaderSearch/index.vue?vue&type=script&lang=js& and 29 others * core-js/modules/es.error.cause.js in ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js, ./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/.store/babel-loader@8.3.0/node_modules/babel-loader/lib!./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/.store/vue-loader@15.10.1/node_modules/vue-loader/lib??vue-loader-options!./src/layout/components/Navbar.vue?vue&type=script&lang=js& and 5 others * core-js/modules/es.object.proto.js in ./node_modules/.store/@babel+runtime@7.22.6/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js * core-js/modules/es.regexp.dot-all.js in ./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/.store/babel-loader@8.3.0/node_modules/babel-loader/lib!./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/.store/vue-loader@15.10.1/node_modules/vue-loader/lib??vue-loader-options!./src/components/ThemePicker/index.vue?vue&type=script&lang=js&, ./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/.store/babel-loader@8.3.0/node_modules/babel-loader/lib!./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/.store/vue-loader@15.10.1/node_modules/vue-loader/lib??vue-loader-options!./src/layout/components/Navbar.vue?vue&type=script&lang=js& and 2 others * core-js/modules/web.url-search-params.delete.js in ./src/utils/request.js * core-js/modules/web.url-search-params.has.js in ./src/utils/request.js * core-js/modules/web.url-search-params.size.js in ./src/utils/request.js * qs in ./src/utils/request.js * svg-baker-runtime/browser-symbol in ./src/icons/svg/user.svg To install them, you can run: npm install --save core-js/modules/es.array.push.js core-js/modules/es.error.cause.js core-js/modules/es.object.proto.js core-js/modules/es.regexp.dot-all.js core-js/modules/web.url-search-params.delete.js core-js/modules/web.url-search-params.has.js core-js/modules/web.url-search-params.size.js qs svg-baker-runtime/browser-symbol怎么解决如何安装
07-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值