IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 系统运维 -> centos7安装elasticsearch-6.6.0 -> 正文阅读

[系统运维]centos7安装elasticsearch-6.6.0

1 下载elasticsearch-6.6.0

[liucf@node1 softfile]$  wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.0.tar.gz
[liucf@node1 softfile]$  wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.0.tar.gz
--2021-09-19 22:42:55--  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.0.tar.gz
Resolving artifacts.elastic.co (artifacts.elastic.co)... 34.120.127.130, 2600:1901:0:1d7::
Connecting to artifacts.elastic.co (artifacts.elastic.co)|34.120.127.130|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 114106988 (109M) [application/x-gzip]
Saving to: ‘elasticsearch-6.6.0.tar.gz’

100%[============================================================================================>] 114,106,988  958KB/s   in 1m 57s 

2021-09-19 22:44:52 (950 KB/s) - ‘elasticsearch-6.6.0.tar.gz’ saved [114106988/114106988]

[liucf@node1 softfile]$ 

?2 解压

tar -zxvf elasticsearch-6.6.0.tar.gz -C ../soft

3 修改elasticsearch配置文件

# ======================== 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: liucf-es
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node1
#
# 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: /home/liucf/soft/elasticsearch-6.6.0/data
#
# Path to log files:
#
path.logs: /home/liucf/soft/elasticsearch-6.6.0/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: true
#
# 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: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 
#
# For more information, consult the zen discovery 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

4 启动elasticsearch

[liucf@node1 bin]$ /home/liucf/soft/elasticsearch-6.6.0/bin/elasticsearch -d
[liucf@node1 bin]$ jps
2517 JobHistoryServer
106148 Elasticsearch  ##可以看到已经启动起来了
2280 NameNode
2377 ResourceManager
106155 Jps
2988 QuorumPeerMain
8605 Kafka
[liucf@node1 bin]$ jps ##再次jps 查看Elasticsearch  的进程死掉了
2517 JobHistoryServer
2280 NameNode
2377 ResourceManager
106250 Jps
2988 QuorumPeerMain
8605 Kafka

那么为什么起来之后有挂掉了呢

查看日志

cd /home/liucf/soft/elasticsearch-6.6.0/logs
[liucf@node1 logs]$ cat liucf-es.log
...
[2021-09-19T23:05:08,139][INFO ][o.e.p.PluginsService     ] [node1] no plugins loaded
[2021-09-19T23:05:12,173][INFO ][o.e.x.s.a.s.FileRolesStore] [node1] parsed [0] roles from file [/home/liucf/soft/elasticsearch-6.6.0/config/roles.yml]
[2021-09-19T23:05:12,752][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [node1] [controller/106179] [Main.cc@109] controller (64 bit): Version 6.6.0 (Build bbb4919f4d17a5) Copyright (c) 2019 Elasticsearch BV
[2021-09-19T23:05:13,748][DEBUG][o.e.a.ActionModule       ] [node1] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2021-09-19T23:05:14,401][INFO ][o.e.d.DiscoveryModule    ] [node1] using discovery type [zen] and host providers [settings]
[2021-09-19T23:05:15,966][INFO ][o.e.n.Node               ] [node1] initialized
[2021-09-19T23:05:15,966][INFO ][o.e.n.Node               ] [node1] starting ...
[2021-09-19T23:05:16,142][INFO ][o.e.t.TransportService   ] [node1] publish_address {192.168.109.151:9300}, bound_addresses {[::]:9300}
[2021-09-19T23:05:16,153][INFO ][o.e.b.BootstrapChecks    ] [node1] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2021-09-19T23:05:16,155][ERROR][o.e.b.Bootstrap          ] [node1] node validation exception
[3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: memory locking requested for elasticsearch process but memory is not locked
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2021-09-19T23:05:16,158][INFO ][o.e.n.Node               ] [node1] stopping ...
[2021-09-19T23:05:16,183][INFO ][o.e.n.Node               ] [node1] stopped
[2021-09-19T23:05:16,183][INFO ][o.e.n.Node               ] [node1] closing ...
[2021-09-19T23:05:16,193][INFO ][o.e.n.Node               ] [node1] closed

可见主要问题是:

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: memory locking requested for elasticsearch process but memory is not locked
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

针对[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

修改/etc/security/limits.conf文件,增加配置,用户退出后重新登录生效

[liucf@node1 softfile]$ sudo vim /etc/security/limits.conf
..
#@student        -       maxlogins       4
* soft nofile 65536
* hard nofile 65536

# End of file

..

验证:

## 退出用户重新登录后
[liucf@node1 ~]$ ulimit -Hn
65536
[liucf@node1 ~]$ ulimit -Sn
65536

针对[2]: memory locking requested for elasticsearch process but memory is not locked

关闭

bootstrap.memory_lock: false

针对 [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

在/etc/sysctl.conf文件最后添加一行

vm.max_map_count=262144

[liucf@node1 ~]$ sudo vim /etc/sysctl.conf
[sudo] password for liucf: 

# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
vm.max_map_count=262144

执行/sbin/sysctl -p 立即生效

[liucf@node1 ~]$ sudo /sbin/sysctl -p 
vm.max_map_count = 262144
[liucf@node1 ~]$ 

重新启动elasticsearch

?/home/liucf/soft/elasticsearch-6.6.0/bin/elasticsearch -d

然后问题解决了

5 验证elasticsearch启动效果

?

  系统运维 最新文章
配置小型公司网络WLAN基本业务(AC通过三层
如何在交付运维过程中建立风险底线意识,提
快速传输大文件,怎么通过网络传大文件给对
从游戏服务端角度分析移动同步(状态同步)
MySQL使用MyCat实现分库分表
如何用DWDM射频光纤技术实现200公里外的站点
国内顺畅下载k8s.gcr.io的镜像
自动化测试appium
ctfshow ssrf
Linux操作系统学习之实用指令(Centos7/8均
上一篇文章      下一篇文章      查看所有文章
加:2021-09-20 16:05:36  更:2021-09-20 16:06:39 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/15 15:21:02-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码