CentOS7.9.2009安装elasticsearch7.11.1(单节点)

本文章使用CentOS7.9.2009服务器安装elasticsearch7.11.1软件

1.服务器信息

[root@elasticsearch ~]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
[root@elasticsearch ~]# 
[root@elasticsearch ~]# cat /etc/hosts | grep elasticsearch
192.168.10.243	elasticsearch
[root@elasticsearch ~]# 

2.ES安装

2.1.创建ES用户

创建ES用户和组

命令:

useradd elk

[root@elasticsearch ~]# useradd elk
[root@elasticsearch ~]# cat /etc/passwd | grep elk
elk:x:1000:1000::/home/elk:/bin/bash
[root@elasticsearch ~]# 

2.2.OS系统参数调优

-->编辑/etc/security/limits.conf文件,添加如下调优配置

*    soft    nofile    65535
*    hard    nofile    65535

[root@elasticsearch ~]# cat /etc/security/limits.conf  | grep -Ev "^#|^$" 
*	soft	nofile	65535
*	hard	nofile	65535
[root@elasticsearch ~]# 

-->编辑/etc/security/limits.d/20-nproc.conf文件,添加如下调优配置

*          soft    nproc     4096
root       soft    nproc     unlimited

[root@elasticsearch limits.d]# cat /etc/security/limits.d/20-nproc.conf | grep -Ev "^#|^$"
*          soft    nproc     4096
root       soft    nproc     unlimited
[root@elasticsearch limits.d]# 

-->重启服务器生效

2.3.配置java环境变量

-->上传JDK11.0.10版本至CentOS7.9.2009并解压

[root@elasticsearch ~]# ls -l jdk-11.0.10_linux-x64_bin.tar.gz 
-rw-r--r-- 1 root root 181727980 Oct 18 20:08 jdk-11.0.10_linux-x64_bin.tar.gz
[root@elasticsearch ~]# tar -zxvf jdk-11.0.10_linux-x64_bin.tar.gz -C /usr/local/
[root@elasticsearch ~]# cd /usr/local/
[root@elasticsearch local]# ls -ld jdk-11.0.10/
drwxr-xr-x 8 root root 115 Oct 25 09:20 jdk-11.0.10/
[root@elasticsearch local]# 

-->配置JDK环境变量,编辑/etc/profile文件,添加如下代码

export JAVA_HOME=/usr/local/jdk-11.0.10
export PATH=$PATH:$JAVA_HOME/bin

[root@elasticsearch ~]# tail -n2 /etc/profile
export JAVA_HOME=/usr/local/jdk-11.0.10
export PATH=$PATH:$JAVA_HOME/bin
[root@elasticsearch ~]# 

-->生效环境变量,并查看JDK版本,显示出版本信息,则证明安装成功

命令:

source /etc/profile

java -version

[root@elasticsearch ~]# source /etc/profile
[root@elasticsearch ~]# java -version
java version "11.0.10" 2021-01-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.10+8-LTS-162)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.10+8-LTS-162, mixed mode)
[root@elasticsearch ~]# 

2.4.安装ES7.11.1

-->官网下载ES7.11.1版本

地址:

Past Releases of Elastic Stack Software | Elastic

--> 上传elasticsearch7.11.1版本至CentOS7.9.2009并解压

[root@elasticsearch ~]# ls -l elasticsearch-7.11.1-linux-x86_64.tar.gz 
-rw-r--r-- 1 root root 322835716 Oct 18 20:11 elasticsearch-7.11.1-linux-x86_64.tar.gz
[root@elasticsearch ~]# tar -zxvf elasticsearch-7.11.1-linux-x86_64.tar.gz -C /usr/local/
[root@elasticsearch ~]# cd /usr/local/
[root@elasticsearch local]# ls -ld elasticsearch-7.11.1/
drwxr-xr-x 10 root root 167 Oct 25 09:39 elasticsearch-7.11.1/
[root@elasticsearch local]# 

-->编辑/usr/local/elasticsearch-7.11.1/config/elasticsearch.yml并保存

对于ES单节点,只需更改如下配置,其它保持不变

network.host: 0.0.0.0
#网络地址设置为0.0.0.0表示用来监听全网卡接收外部请求,还可以为实际IP地址等

[root@elasticsearch config]# pwd
/usr/local/elasticsearch-7.11.1/config
[root@elasticsearch config]# cat elasticsearch.yml 
# ======================== 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:
#
node.name: elasticsearch 
#
# 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:
#
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小黑要上天

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值