千家信息网

ElasticSearch单节点模式的搭建

发表于:2026-11-03 作者:千家信息网编辑
千家信息网最后更新 2026年11月03日,环境CentOS7安装了JDK1.8这里用的elasticsearch6.2.2为例,你也可以用5.6.1或者更高的版本1.最好以非root用户解压ElasticSearch,如果用root用户,要不
千家信息网最后更新 2026年11月03日ElasticSearch单节点模式的搭建

环境CentOS7
安装了JDK1.8
这里用的elasticsearch6.2.2为例,你也可以用5.6.1或者更高的版本

1.最好以非root用户解压ElasticSearch,如果用root用户,要不然以后还要将文件的权限以及组转移给非foot用户
1)解压elasticsearch-5.2.2.tar.gz到/opt/module目录下
[root@hdp21 ~]# su asy
[asy@hdp21 root]$ tar -zxvf elasticsearch-5.2.2.tar.gz -C /opt/module
2)在/opt/module/elasticsearch-5.2.2路径下创建data和logs文件夹
mkdir data
mkdir logs

如果你用root账号,请先添加一个非root账号,因为elaticsearch不能用root账号运行
user add asy
chown -R asy:asy /opt/module/elasticsearch-5.2.2/

3)root账号修改配置文件/opt/module/elasticsearch-5.2.2/config/elasticsearch.yml
[root@hdp21 config]# pwd
/opt/module/elasticsearch-5.2.2/config
[root@hdp21 config]# vi elasticsearch.yml
修改以下参数

---------------------------------- Cluster -------------------------------------

cluster.name: Asy

------------------------------------ Node --------------------------------------(三个不能一样)

node.name: node-1

----------------------------------- Paths ---------------------------------------

path.data: /opt/module/elasticsearch-5.2.2/data
path.logs: /opt/module/elasticsearch-5.2.2/logs

----------------------------------- Memory -----------------------------------

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

---------------------------------- Network ------------------------------------

network.host: hdp21
http.port: 9200

--------------------------------- Discovery ------------------------------------

discovery.zen.ping.unicast.hosts: ["hdp21"]

path.data
path.logs data和logs的路径

network.host ip地址或者host域名地址
http.port端口号

5)配置linux系统环境(参考:
(1)编辑limits.conf 添加类似如下内容
[root@hdp21 config]# vi /etc/security/limits.conf
添加如下内容:

  • soft nofile 65536
  • hard nofile 131072
  • soft nproc 2048
  • hard nproc 4096
    (2)进入limits.d目录下修改配置文件。
    [root@hdp21 config]# vi /etc/security/limits.d/20-nproc.conf
    修改如下内容:如果超过2048则不用修改
  • soft nproc 1024
    #修改为
  • soft nproc 2048
    (3)修改配置sysctl.conf
    [root@hdp21 config]# vi /etc/sysctl.conf
    添加下面配置:
    vm.max_map_count=655360

退回到上一级目录
并执行命令:
[root@hdp21 config]# cd ..
[root@hdp21 elasticsearch-5.2.2]# pwd
/opt/module/elasticsearch-5.2.2

[root@hdp21 elasticsearch-5.2.2]# sysctl -p
然后,重新启动elasticsearch,即可启动成功。
6)启动elasticsearch
[asy@hdp21 elasticsearch-5.2.2]$ bin/elasticsearch
后台启动方式
[asy@hdp21 elasticsearch-5.2.2]$ bin/elasticsearch-d
7)测试elasticsearch
[root@hdp21 ~]# curl http://hdp21:9200
{
"name" : "node1",
"cluster_name" : "Asy",
"cluster_uuid" : "8T7xJ-NLTbmYHOPKa3a4tA",
"version" : {
"number" : "5.2.2",
"build_hash" : "f9d9b74",
"build_date" : "2017-02-24T17:26:45.835Z",
"build_snapshot" : false,
"lucene_version" : "6.4.1"
},
"tagline" : "You Know, for Search"
}

执行bin/elasticsearch的时候
如果有 max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536] 的报错

这个对应v/etc/security/limits.conf

  • soft nofile 65536
    已经修改了,怎么不生效呢?
    重新进入该非 root user即可

Google浏览器调试Elastic Search
打开更多工具,扩展程序并且打开开发者模式
将elasticsearch-head.crx拖入浏览器窗口成功完成插件的安装
输入http://192.168.234.21:9200/
其中192.168.234.21为linux主机的IP地址,9200为端口号

配置 文件 账号 内容 地址 用户 目录 成功 口号 浏览器 环境 路径 浏览 模式 三个 不用 主机 参数 后台 命令 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 科技创新与互联网经济 互联网为科技 金融科技与互联网金融 西安互联网科技 米客互联网科技 互联网科技小额贷款 联恩商钥互联网科技有限公司 老年人脱离互联网科技的作文 湖南洣水互联网科技有限公司扣款 互联网对科技的发展 南平创想时代互联网科技有限公司 赶超互联网科技 微信多开 阿大互联网科技有限公司 佛山市翊博互联网络科技有限公司 阿里互联网科技企业 四川慕妮娅互联网科技有限公司 广州千川互联网科技有限公司 神州科技互联网有限公司 北京天晋互联网科技有限公司 科技和互联网行业的特点 广州紫鲸互联网科技有限公司 河南真二互联网科技有限公司 互联网 科技馆 上海宁丞科技互联网 互联网科技公司实习生 互联网在线教育科技创业 世界互联网领先科技成果获奖 上海万顺科技互联网有限公司招聘 玉溪新华互联网科技怎么选 知域互联网科技有限公司官网
0