美文网首页
Linux 搭建 ElasticSearch

Linux 搭建 ElasticSearch

作者: 索性流年 | 来源:发表于2020-05-07 15:16 被阅读0次

文章合集

注意

Elasticsearch 是要基于 jdk 运行,所有在运行之前要检查JDK 环境

#Elasticsearch版本
elasticsearch-6.7.2

#jdk环境
jdk1.8.0_261

下载地址

官网地址

下载完成上传至/usr/local目录

cd /usr/local

添加 es 用户

# 创建 elasticsearch用户组
groupadd elasticsearch
# 创建 es 用户
useradd es
# 将 es 用户添加到 elasticsearch用户组
usermod -a -G elasticsearch es

为 es 用户添加 sudo 权限

vi /etc/sudoer

在root ALL=(ALL) ALL下添加

es ALL=(ALL) ALL

修改/config/elasticsearch.yml文件

#允许任何来源访问
network.host: 0.0.0.0
transport.tcp.port: 9300
http.port: 9200

修改防火墙

#禁用防火墙
systemctl stop firewalld.service
#禁止防火墙开机启动
systemctl disable firewalld.service

启动

# 切换用户
su es
# 进入目录
cd /usr/local/elasticsearch-6.7.2/bin
# 运行
./elasticsearch
#后台运行命令
./elasticsearch -d 

启动成功

图片.png

如若报错

  • max number of threads [3795] for user [es] is too low, increase to at least
  • 参考此文章

访问

http://192.168.112.143:9200/

图片.png

集群配置

cd /usr/local/elasticsearch/config
vi elasticsearch.yml

修改相关配置

#集群名称保证集群相同
cluster.name: my-application
#节点名称每个服务器一个名称
node.name: node-1
#集群地址改为节点对应地址
discovery.seed_hosts: ["host1", "host2"]

相关文章

网友评论

      本文标题:Linux 搭建 ElasticSearch

      本文链接:https://www.haomeiwen.com/subject/rgqgwhtx.html