linux centos7安装部署安装Elasticsearch并后台启动

这篇具有很好参考价值的文章主要介绍了linux centos7安装部署安装Elasticsearch并后台启动。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

centos7安装部署安装Elasticsearch


前言

为什么要使用“Elastic Stack”   
 它到底是什么?它是一组快速且高度可扩展的组件(Elasticsearch、Kibana、Beats、Logstash 等),
 它们共同使您能够安全地从任何来源以任何格式获取数据,
 然后对其进行搜索、分析和可视化。
	官网地址:
	https://www.elastic.co/cn/
	tar包地址
	https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-17-3

一、安装环境?

jdk1.8、elasticsearch-7.17.3-linux-x86_64

二、安装及启动步骤

1、解压 elasticsearch-7.17.3-linux-x86_64.tar

1:切换到/opt/software 目录
	cd /opt/software
2:创建es目录
	mkdir es
3:将elasticsearch-7.17.3-linux-x86_64.tar上传至 /opt/software/es
4:解压缩es安装包
	tar -zxvf elasticsearch-7.17.3-linux-x86_64.tar	
5、修改配置文件
	cd /opt/software/es/elasticsearch-7.17.3 /config
	vim elasticsearch.yml                                --编辑es配置文件
	单机如下图配置所示  									--##EDIT下为修改部分
# ======================== 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-application
#
# ------------------------------------ Node ------------------------------------
#节点信息
# Use a descriptive name for the node:
##EDIT
node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#关闭自检程序
##EDIT
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 -----------------------------------
#网络配置
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
##EDIT
network.host: 本机ip
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
##EDIT
http.port: 9200
#
# 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]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
##EDIT
cluster.initial_master_nodes: ["node-1"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#
# ---------------------------------- Security ----------------------------------
#
#                                 *** WARNING ***
#
# Elasticsearch security features are not enabled by default.
# These features are free, but require configuration changes to enable them.
# This means that users don’t have to provide credentials and can get full access
# to the cluster. Network connections are also not encrypted.
#
# To protect your data, we strongly encourage you to enable the Elasticsearch security features. 
# Refer to the following documentation for instructions.
#
# https://www.elastic.co/guide/en/elasticsearch/reference/7.16/configuring-stack-security.html
#增加跨域配置
##EDIT
http.cors.enabled: true
http.cors.allow-origin: "*"

6、修改jvm.options配置文件

################################################################
##
## JVM configuration
##
################################################################
##
## WARNING: DO NOT EDIT THIS FILE. If you want to override the
## JVM options in this file, or set any additional options, you
## should create one or more files in the jvm.options.d
## directory containing your adjustments.
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/jvm-options.html
## for more information.
##
################################################################



################################################################
## 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:
##EDIT
-Xms512m
-Xmx512m
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/heap-size.html
## for more information
##
################################################################


################################################################
## Expert settings
################################################################
##
## All settings below here are considered expert settings. Do
## not adjust them unless you understand what you are doing. Do
## not edit them in this file; instead, create a new file in the
## jvm.options.d directory containing your adjustments.
##
################################################################

## GC configuration
8-13:-XX:+UseConcMarkSweepGC
8-13:-XX:CMSInitiatingOccupancyFraction=75
8-13:-XX:+UseCMSInitiatingOccupancyOnly

## G1GC Configuration
# NOTE: G1 GC is only supported on JDK version 10 or later
# to use G1GC, uncomment the next two lines and update the version on the
# following three lines to your version of the JDK
# 10-13:-XX:-UseConcMarkSweepGC
# 10-13:-XX:-UseCMSInitiatingOccupancyOnly
14-:-XX:+UseG1GC

## JVM temporary directory
-Djava.io.tmpdir=${ES_TMPDIR}

## heap dumps

# generate a heap dump when an allocation from the Java heap fails; heap dumps
# are created in the working directory of the JVM unless an alternative path is
# specified
-XX:+HeapDumpOnOutOfMemoryError

# exit right after heap dump on out of memory error. Recommended to also use
# on java 8 for supported versions (8u92+).
9-:-XX:+ExitOnOutOfMemoryError

# specify an alternative path for heap dumps; ensure the directory exists and
# has sufficient space
-XX:HeapDumpPath=data

# specify an alternative path for JVM fatal error logs
-XX:ErrorFile=logs/hs_err_pid%p.log

## JDK 8 GC logging
8:-XX:+PrintGCDetails
8:-XX:+PrintGCDateStamps
8:-XX:+PrintTenuringDistribution
8:-XX:+PrintGCApplicationStoppedTime
8:-Xloggc:logs/gc.log
8:-XX:+UseGCLogFileRotation
8:-XX:NumberOfGCLogFiles=32
8:-XX:GCLogFileSize=64m

# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m

7、创建用户并赋予权限,不能再root用户下启动
useradd 用户名
passwd 用户名 随后会提示输入密码
赋予权限
cd /opt/software/es
chown -R 用户名:用户名 ./ —chown将指定文件的拥有者改为指定的用户或组,
usermod -g root 用户 —将当前用户添加至root组
8、elasticsearch 启动的时候要求当前用户最大线程数至少为 4096 个线程,修改当前用户最大线程数
如下所示
显示 当前用户拥有线程数 ulimit -a

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 3834                  -----此处为当前用户线程数
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 3834
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

修改线程数
vim /etc/security/limits.conf
文件末尾加入 如下三行

用户名 soft nofile 65536
用户名 hard nofile 65536
用户名  -  nproc  65535

2、 前台启动elasticsearch

cd /opt/software/es/elasticsearch-7.17.3/bin
./elasticsearch                                            --前台启动es
http://ip:9200											   --访问es网址
如下
{
  "name" : "node-1",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "933ymxObQnKVmo3j6jXp0g",
  "version" : {
    "number" : "7.17.3",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "5ad023604c8d7416c9eb6c0eadb62b14e766caff",
    "build_date" : "2022-04-19T08:11:19.070913226Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
前台启动成功

3、 后台启动elasticsearch

后台启动文章来源地址https://www.toymoban.com/news/detail-604677.html

./bin/elasticsearch -d                                    

到了这里,关于linux centos7安装部署安装Elasticsearch并后台启动的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • centos7设置elasticsearch开机自启动

    1、编辑elasticsearch.service文件 编写服务: 2、启动服务、设置开机自启动 启动服务: 如果启动失败先尝试杀死原有的elasticsearch进程 设置开机自启动: 查看服务状态:

    2024年02月11日
    浏览(44)
  • 最新Elasticsearch8.4.3 + Kibana8.4.3在云服务器Centos7.9安装部署(参考官方文档)

      最近笔者学习Elasticsearch,官方最新稳定版为 Elasticsearch-8.4.3,想在云服务器上Centos7.9搭建。搭建之路坑多路少啊(指网上的博文教程五花八门,基本都是ES7版本居多,ES8有少数,各种配置参数一头雾水,细节不多说,照搬了踩坑跌得头破血流),对小菜的我来说,简直要

    2024年02月02日
    浏览(47)
  • linux centos7系统离线部署mysql-8.0.35免安装版本

    在CentOS中默认安装有MariaDB,是MySQL的一个分支,主要由开源社区维护。 CentOS 7及以上版本已经不再使用MySQL数据库,而是使用MariaDB数据库。 如果直接安装MySQL,会和MariaDB的文件冲突。 因此,需要先卸载自带的MariaDB,再安装MySQL。 查看版本: 卸载 检查是否卸载干净: 注意:

    2024年01月18日
    浏览(36)
  • Centos7单机部署ElasticSearch

    Elasticsearch是一种广泛使用的开源搜索引擎,专门为分布式环境设计,但也可以在单机上运行。它使存储、搜索和分析大量数据变得更加容易和高效。此教程将引导你通过在Centos7上单机部署Elasticsearch,涵盖了从系统准备到服务启动的每一个细节。 Elasticsearch概览 Elasticsearch基于

    2024年02月13日
    浏览(32)
  • Elasticsearch 8.3集群部署(centos7)实战

    【提示】elasticsearch7以上的版本压缩包内自带JDK 本地安装 下载elasticsearch 的rpm包,然后 使用 rpm -ivh elasticsearch #这个命令安装,名字不全# systemctl daemon-reload # 重新加载某个服务的配置文件,如果新安装了一个服务,归属于 systemctl 管理,要是新服务的服务程序配置文件生效,

    2023年04月15日
    浏览(36)
  • (Linux)Centos7.*版本安装配置Java环境、Tomcat、Nginx并打包部署SSM框架web系统

    目录 一、准备软件与安装包 (一)、必须的软件 1、点击下载Xshell 2、点击下载FileZilla (二)、准备安装包 1、点击下载JDK1.8Linux版本 2、点击下载Nginx 3、点击下载Tomcat   二、关于FileZilla软件的使用说明 (一)、FileZilla软件的打开和说明 (二)、配置服务器地址去连接服务器  三、X

    2023年04月25日
    浏览(44)
  • 【centos7安装ElasticSearch】

    最近工作中有用到ES ,当然少不了自己装一个服务器捣鼓。本文的ElasticSearch 的版本: 7.17.3 点此下载 下载完成后上传至 Linux 服务器,本文演示放在: /root/ 下,进行解压: ES比较耗内存,建议虚拟机4G或以上内存,jvm1g以上的内存分配。运行Elasticsearch,需安装并配置JDK。 各

    2024年02月08日
    浏览(30)
  • centos7.6部署ELK集群(一)之elasticsearch7.7.0集群部署

    32.3. 部署es7.7.0 32.3.1. 下载es(各节点都做) wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.7.0-linux-x86_64.tar.gz 32.3.2. 解压至安装目录(各节点都做) tar -xvf elasticsearch-7.7.0-linux-x86_64.tar.gz -C /vmdata/ 32.3.3. 创建es用户并设置密码(各节点都做) ES 7.x 开始不再允许以任何方

    2023年04月17日
    浏览(30)
  • CentOS系统环境搭建(十二)——CentOS7安装Elasticsearch

    centos系统环境搭建专栏🔗点击跳转 🔗https://www.elastic.co/downloads/past-releases/elasticsearch-7-17-6 若你是centos64位服务器,下载LINUX X86_64,下载后上传到linux服务器。 上传至/usr/local/ 进入/usr/local/ 执行解压 若你电脑性能强劲,这个应该可以不改。 修改为1g内存占用。 在当前版本,已

    2024年02月12日
    浏览(41)
  • 39.Linux系统启动原理及故障排除(centos7)

    目录 1.centos7 系统启动过程 2.登陆系统图解 3.管理系统服务  4.运行级别  例 1:默认系统启动使用 3 级别字符界面  例 2:默认系统启动使用 5 级别图形界面  例 3: centos7 修改内核启动顺序  1.centos7 系统启动过程 加载 BIOS/UEFI 信息,进行硬件检测。按照 BIOS 设定找到第一个

    2023年04月08日
    浏览(28)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包