惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

博客园 - 笨功夫才是真功夫

TortoiseSVN实现excel文件差异比对(集成ExcelMerge)[转] git仓库迁移 centos7.6 nginx配置ssl证书 在Debian12上安装mysql 8.0 Mysql8.0设置大小写不敏感解决方案[转] debian下常见问题 vue开发环境搭建 bash脚本的输入参数解析 python常用脚本 mysql数据库备份脚本 redis安装和运维 docker环境下安装RabbitMQ Linux系统设置开机启动(草稿) 在Windows10部署kibana Elasticsearch监控 Flink cdc实践(陆续更新) 在windows下安装mysql 8.1 VMware虚拟机开机自动启动 停止windows10的系统更新 elasticsearch安装-集群
elasticsearch安装-单实例
笨功夫才是真功夫 · 2023-12-12 · via 博客园 - 笨功夫才是真功夫

下载安装包

国内镜像,速度非常快
https://mirrors.huaweicloud.com/elasticsearch/
https://mirrors.huaweicloud.com/kibana/

wget https://mirrors.huaweicloud.com/elasticsearch/7.9.3/elasticsearch-7.9.3-linux-x86_64.tar.gz

安装

1、安装目录:

/usr/local/elasticsearch-7.9.3

2、解压

tar -zxvf elasticsearch-7.9.3-linux-x86_64.tar.gz -C /usr/local

3、解决es强依赖jdk问题

由于es和jdk是一个强依赖的关系,所以当我们在新版本的ElasticSearch压缩包中包含有自带的jdk,但是当我们的Linux中已经安装了jdk之后,就会发现启动es的时候优先去找的是Linux中已经装好的jdk,此时如果jdk的版本不一致,就会造成jdk不能正常运行,报错如下:

warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
Future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/jdk1.8.0_291/jre] does not meet this requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.

注:如果Linux服务本来没有配置jdk,则会直接使用es目录下默认的jdk,反而不会报错

解决办法:
修改elasticsearch启动脚本
vim /usr/local/elasticsearch-7.9.3/elasticsearch

source "`dirname "$0"`"/elasticsearch-env

这句后面追加以下

############## 添加配置解决jdk版本问题 ##############
# 将jdk修改为es中自带jdk的配置目录
export JAVA_HOME=/usr/local/elasticsearch-7.13.2/jdk
export PATH=$JAVA_HOME/bin:$PATH

if [ -x "$JAVA_HOME/bin/java" ]; then
        JAVA="/usr/local/elasticsearch-7.13.2/jdk/bin/java"
else
        JAVA=`which java`
fi

4、新增专用用户并授权

#新增专用用户
useradd user-es
#为用户授权目录:
chown user-es:user-es -R /usr/local/elasticsearch-7.9.3

es用户拥有的内存权限太小,至少需要262144
切换到root用户,执行命令
vim /etc/sysctl.conf
文件最后添加 vm.max_map_count=262144

5、设置集群和节点, 启动

vim /usr/local/elasticsearch-7.9.3/config/elasticsearch.yml

cluster.name: testes
node.name: es-node0
network.host: 10.10.1.11
cluster.initial_master_nodes: ["es-node0"]

启动
su user-es
前台运行:
/usr/local/elasticsearch-7.9.3/bin/elasticsearch
后台运行:
/usr/local/elasticsearch-7.9.3/bin/elasticsearch -d

跟踪日志tail -100f /usr/local/elasticsearch-7.9.3/logs/testes.log
出现started为正常

6、可能遇到的问题

6.1 可能遇到 max file descriptors [4096]问题

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
切换到root用户,执行命令
vi /etc/security/limits.conf
文件最后添加

* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

重启linux

6.2 可能遇到 max number of threads [2048] for user [user-es] is too low, increase to at least [4096]

切换到root用户,执行命令
vi /etc/security/limits.conf
文件最后添加

user-es - nproc 65535

重启linux

参考:https://blog.csdn.net/smilehappiness/article/details/118466378