ElasticSearch7 Kibana集群安装
创始人
2024-05-11 20:18:28
0

文章目录

  • ElasticSearch安装
    • 下载安装包
    • 基础环境安装
      • JDK安装
      • 修改Linux配置
    • 安装ES
    • 启动报错
      • bootstrap check failure [1] of [1]: memory locking requested for elasticsearch process but memory is not locked
  • Kibana安装
    • Kibana简介
    • Kibana下载
    • Kibana安装

ElasticSearch安装

下载安装包

下载地址:https://www.elastic.co/cn/downloads/past-releases#elasticsearch

安装版本:7.14.2

在这里插入图片描述

基础环境安装

JDK安装

安装es的机器都需要安装

JDK版本11

  • 将安装包移动到/opt目录下
tar -zxvf jdk-11.0.17_linux-x64_bin.tar.gz 
  • JDK加入环境变量

    修改/etc/profile,在尾部添加

    export JAVA_HOME=/opt/jdk-11.0.17
    export PATH=$PATH:$JAVA_HOME/bin
    

修改Linux配置

  • 编辑 /etc/security/limits.conf,追加以下内容
* soft nofile 65536
* hard nofile 65536
* hard memlock unlimited
* soft memlock unlimited
  • 在/etc/sysctl.conf文件最后添加一行
vm.max_map_count=262144

执行

sysctl -p

  • 修改 /etc/systemd/system.conf
vi /etc/systemd/system.conf
DefaultLimitMEMLOCK=infinity

安装ES

需要安装es的集群都要执行以下步骤

  • 将安装包移动到/opt目录
mv elasticsearch-7.14.2-linux-x86_64.tar.gz /opt
  • 修改ES使用内存

修改配置文件config/jvm.options

################################################################
## IMPORTANT: JVM heap size
################################################################
##
## The heap size is automatically configured by Elasticsearch
## based on the available memory in your system and the roles
## each node is configured to fulfill. If specifying heap is
## required, it should be done through a file in jvm.options.d,
## and the min and max should be set to the same value. For
## example, to set the heap to 4 GB, create a new file in the
## jvm.options.d directory containing these lines:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################
-Xms25g
-Xmx25g
  • 修改elasticsearch.yml配置
cluster.name: dev-cluster
node.name: node-2
node.master: true
node.data: true
node.ingest: true
bootstrap.memory_lock: true
bootstrap.system_call_filter: false
network.host: 172.16.24.192
http.port: 9200
transport.tcp.port: 9300
transport.tcp.compress: true
http.cors.enabled: true
http.cors.allow-origin: "*"
cluster.initial_master_nodes:  ["node-1","node-2","node-3"]
discovery.zen.ping.unicast.hosts: ["172.16.24.191:9300","172.16.24.192:9300","172.16.24.193:9300"]
discovery.zen.minimum_master_nodes: 1
# 启用脚本 默认painless
cluster.routing.allocation.same_shard.host: true
#超时时间
discovery.zen.ping_timeout: 5s
discovery.zen.fd.ping_timeout: 5s
#禁止自动创建索引
action.auto_create_index: true
# 一个集群中的N个节点启动后,才允许进行恢复处理 
gateway.recover_after_nodes: 1
# 设置初始化恢复过程的超时时间,超时时间从上一个配置中配置的N个节点启动后算起 
gateway.recover_after_time: 5m 
# 设置这个集群中期望有多少个节点.一旦这N个节点启动(并且recover_after_nodes也符合), 
# 立即开始恢复过程(不等待recover_after_time超时) 
gateway.expected_nodes: 2
# 线程池  
thread_pool.search.size: 100  
thread_pool.search.queue_size: 1000 
#xpack 插件的授权类型,basic是免费的,还有其他收费版本
xpack.license.self_generated.type: basic
#是否开启安全验证
xpack.security.enabled: true
#是否开启远程访问安全验证
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
# 证书位置,该文件在下面流程会生成
xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12
# 证书位置,该文件在下面流程会生成
xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12
  • 创建elasticsearch用户
useradd elasticsearch
passwd elasticsearch
  • 修改目录权限
chown elasticsearch.elasticsearch -R /opt/elasticsearch-7.14.2
  • 切换用户启动es
su elasticsearch
cd /opt/elasticsearch-7.14.2
  • 生成CA证书
bin/elasticsearch-certutil ca
warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
This tool assists you in the generation of X.509 certificates and certificate
signing requests for use with SSL/TLS in the Elastic stack.The 'ca' mode generates a new 'certificate authority'
This will create a new X.509 certificate and private key that can be used
to sign certificate when running in 'cert' mode.Use the 'ca-dn' option if you wish to configure the 'distinguished name'
of the certificate authorityBy default the 'ca' mode produces a single PKCS#12 output file which holds:* The CA certificate* The CA's private keyIf you elect to generate PEM format certificates (the -pem option), then the output will
be a zip file containing individual files for the CA certificate and private keyPlease enter the desired output file [elastic-stack-ca.p12]:  #直接回车即可,不用设置密码
Enter password for elastic-stack-ca.p12 : #直接回车即可,不用设置密码

在当前目录可以看到 elastic-stack-ca.p12文件

  • 生成密钥
bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
This tool assists you in the generation of X.509 certificates and certificate
signing requests for use with SSL/TLS in the Elastic stack.The 'cert' mode generates X.509 certificate and private keys.* By default, this generates a single certificate and key for useon a single instance.* The '-multiple' option will prompt you to enter details for multipleinstances and will generate a certificate and key for each one* The '-in' option allows for the certificate generation to be automated by describingthe details of each instance in a YAML file* An instance is any piece of the Elastic Stack that requires an SSL certificate.Depending on your configuration, Elasticsearch, Logstash, Kibana, and Beatsmay all require a certificate and private key.* The minimum required value for each instance is a name. This can simply be thehostname, which will be used as the Common Name of the certificate. A fulldistinguished name may also be used.* A filename value may be required for each instance. This is necessary when thename would result in an invalid file or directory name. The name provided hereis used as the directory name (within the zip) and the prefix for the key andcertificate files. The filename is required if you are prompted and the nameis not displayed in the prompt.* IP addresses and DNS names are optional. Multiple values can be specified as acomma separated string. If no IP addresses or DNS names are provided, you maydisable hostname verification in your SSL configuration.* All certificates generated by this tool will be signed by a certificate authority (CA)unless the --self-signed command line option is specified.The tool can automatically generate a new CA for you, or you can provide your own withthe --ca or --ca-cert command line options.By default the 'cert' mode produces a single PKCS#12 output file which holds:* The instance certificate* The private key for the instance certificate* The CA certificateIf you specify any of the following options:* -pem (PEM formatted output)* -keep-ca-key (retain generated CA key)* -multiple (generate multiple certificates)* -in (generate certificates from an input file)
then the output will be be a zip file containing individual certificate/key filesEnter password for CA (elastic-stack-ca.p12) : # 直接回车
Please enter the desired output file [elastic-certificates.p12]: # 直接回车
Enter password for elastic-certificates.p12 : # 直接回车Certificates written to /opt/elasticsearch-7.14.2/elastic-certificates.p12This file should be properly secured as it contains the private key for 
your instance.This file is a self contained file and can be copied and used 'as is'
For each Elastic product that you wish to configure, you should copy
this '.p12' file to the relevant configuration directory
and then follow the SSL configuration instructions in the product guide.For client applications, you may only need to copy the CA certificate and
configure the client to trust this certificate.

在当前目录会生成elastic-certificates.p12文件

  • 证书移动到指定目录
# 在config目录下创建certs
mkdir config/certs
# 证书移动到certs目录mv elastic-certificates.p12 config/certs/
  • 后台启动es
cd /opt/elasticsearch-7.14.2
bin/elasticsearch -d
  • 设置密码

这里可以复制输入

bin/elasticsearch-setup-passwords interactive
warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]yEnter password for [elastic]: 
Reenter password for [elastic]: 
Enter password for [apm_system]: 
Reenter password for [apm_system]: 
Enter password for [kibana_system]: 
Reenter password for [kibana_system]: 
Enter password for [logstash_system]: 
Reenter password for [logstash_system]: 
Enter password for [beats_system]: 
Reenter password for [beats_system]: 
Enter password for [remote_monitoring_user]: 
Reenter password for [remote_monitoring_user]: Changed password for user [apm_system]
Changed password for user [kibana_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]
  • 验证

浏览器访问http://ip:9200/,会提示输入账号密码,输入elastic账号与设置的密码登录即可

{"name" : "node-1","cluster_name" : "dev-cluster","cluster_uuid" : "J1_qbq7ZTcC7RC_9HIOJnw","version" : {"number" : "7.14.2","build_flavor" : "default","build_type" : "tar","build_hash" : "6bc13727ce758c0e943c3c21653b3da82f627f75","build_date" : "2021-09-15T10:18:09.722761972Z","build_snapshot" : false,"lucene_version" : "8.9.0","minimum_wire_compatibility_version" : "6.8.0","minimum_index_compatibility_version" : "6.0.0-beta1"},"tagline" : "You Know, for Search"
}

启动报错

bootstrap check failure [1] of [1]: memory locking requested for elasticsearch process but memory is not locked

修改参数

> vi /etc/systemd/system.conf
DefaultLimitMEMLOCK=infinity> /etc/security/limits.conf
* hard memlock unlimited
* soft memlock unlimited

Kibana安装

Kibana简介

Kibana是一个开源的基于浏览器的分析和可视化平台,可以用于搜索,查看,删除Elasticsearch索引并与存储在Elasticsearch索引中的数据进行交互。可以执行高级数据分析,并且以各种图标、表格和地图的形式可视化数据。

Kibana下载

下载地址:https://www.elastic.co/cn/downloads/past-releases#elasticsearch

安装版本:7.14.2

在这里插入图片描述

Kibana安装

  • 安装包移动到/opt目录
 mv kibana-7.14.2-linux-x86_64 /opt
  • 解压
 tar -zxvf kibana-7.14.2-linux-x86_64.tar.gz 
  • 修改配置文件

vi config/kibana.yml

server.host: "172.16.24.191"
elasticsearch.hosts: ["http://172.16.24.191:9200"]
# 设置支持中文
i18n.locale: "zh-CN"
# 在es中设置kibana密码
elasticsearch.username: "kibana"
elasticsearch.password: "设置的密码"
  • 修改权限
chown elasticsearch.elasticsearch -R kibana-7.14.2-linux-x86_64
  • 启动
nohup bin/kibana > kibana.log &
  • 查看进程
ps -ef|grep kibana
elastic+ 11336 11288 99 14:09 pts/0    00:00:12 /opt/kibana-7.14.2-linux-x86_64/node/bin/node --preserve-symlinks-main --preserve-symlinks /opt/kibana-7.14.2-linux-x86_64/src/cli/dist
  • 访问地址

http://ip:5601

输入账号elastic,与设置的密码登录

在这里插入图片描述

相关内容

热门资讯

美国不提安卓系统华为,迈向自主... 华为与美国:一场关于技术、市场与政策的较量在当今这个数字化的世界里,智能手机已经成为我们生活中不可或...
安卓系统怎么打开ppt,选择文... 你有没有遇到过这种情况:手里拿着安卓手机,突然需要打开一个PPT文件,却怎么也找不到方法?别急,今天...
谷歌退回到安卓系统,探索创新未... 你知道吗?最近科技圈可是炸开了锅,谷歌竟然宣布要退回到安卓系统!这可不是一个简单的决定,背后肯定有着...
安卓系统待机耗电多少,深度解析... 你有没有发现,手机电量总是不经用?尤其是安卓系统,有时候明明没怎么用,电量就“嗖”的一下子就下去了。...
小米主题安卓原生系统,安卓原生... 亲爱的手机控们,你是否曾为手机界面单调乏味而烦恼?想要给手机换换“衣服”,让它焕然一新?那就得聊聊小...
voyov1安卓系统,探索创新... 你有没有发现,最近你的手机是不是变得越来越流畅了?没错,我要说的就是那个让手机焕发青春的Vivo V...
电脑刷安卓tv系统,轻松打造智... 你有没有想过,家里的安卓电视突然变得卡顿,反应迟钝,是不是时候给它来个“大保健”了?没错,今天就要来...
安卓系统即将要收费,未来手机应... 你知道吗?最近有个大消息在科技圈里炸开了锅,那就是安卓系统可能要开始收费了!这可不是开玩笑的,这可是...
雷凌车载安卓系统,智能出行新体... 你有没有发现,现在的汽车越来越智能了?这不,我最近就体验了一把雷凌车载安卓系统的魅力。它就像一个聪明...
怎样拍照好看安卓系统,轻松拍出... 拍照好看,安卓系统也能轻松搞定!在这个看脸的时代,拍照已经成为每个人生活中不可或缺的一部分。无论是记...
安卓车机系统音频,安卓车机系统... 你有没有发现,现在越来越多的汽车都开始搭载智能车机系统了?这不,咱们就来聊聊安卓车机系统在音频方面的...
老苹果手机安卓系统,兼容与创新... 你手里那台老苹果手机,是不是已经陪你走过了不少风风雨雨?现在,它竟然还能装上安卓系统?这可不是天方夜...
安卓系统7.dns,优化网络连... 你有没有发现,你的安卓手机最近是不是有点儿“慢吞吞”的?别急,别急,让我来给你揭秘这可能与你的安卓系...
安卓手机系统怎么加速,安卓手机... 你有没有发现,你的安卓手机最近变得有点“慢吞吞”的?别急,别急,今天就来给你支几招,让你的安卓手机瞬...
小米note安卓7系统,探索性... 你有没有发现,手机更新换代的速度简直就像坐上了火箭呢?这不,小米Note这款手机,自从升级到了安卓7...
安卓和鸿蒙系统游戏,两大系统游... 你有没有发现,最近手机游戏界可是热闹非凡呢!安卓和鸿蒙系统两大巨头在游戏领域展开了一场激烈的较量。今...
安卓手机没有系统更,揭秘潜在风... 你有没有发现,现在安卓手机的品牌和型号真是五花八门,让人挑花了眼。不过,你知道吗?尽管市面上安卓手机...
充值宝带安卓系统,安卓系统下的... 你有没有发现,最近手机上的一款充值宝APP,在安卓系统上可是火得一塌糊涂呢!这不,今天就来给你好好扒...
安卓系统8.0镜像下载,轻松打... 你有没有想过,想要给你的安卓手机升级到最新的系统,却不知道从哪里下载那个神秘的安卓系统8.0镜像呢?...
安卓系统修改大全,全方位修改大... 你有没有想过,你的安卓手机其实是个大宝藏,里面藏着无数可以让你手机焕然一新的秘密?没错,今天就要来个...