|NO.Z.00001|——————————|Deployment|——|Hadoop&ElasticSearch集中式日志分析系统.v01|——|Elasticsearch.v01|Single-Node Mode部署|

一、Elasticsearch Single-Node Mode部署
### --- Elasticsearch Single-Node Mode部署

~~~     Elasticsearch是一个分布式全文搜索引擎,
~~~     支持单节点模式(Single-Node Mode)和集群模式(Cluster Mode)部署,
~~~     一般来说,小公司的业务场景往往使用Single-Node Mode部署即可。
~~~     先以Single-Node Mode部署感受下ES,后续搭建分布式集群深入学习。
二、虚拟机环境准备
### --- 虚拟机环境准备

~~~     服务器:Hadoop01
~~~     操作系统:CentOS 7.x 64 bit
~~~     客户端连接工具:SecureCRT
~~~     关闭虚拟机的防火墙
### --- 关闭firewalld

[root@hadoop01 ~]#systemctl stop firewalld.service          
[root@hadoop01 ~]#systemctl disable firewalld.service
[root@hadoop01 ~]#firewall-cmd --state

三、Elasticsearch Single-Node Mode部署
### --- 下载Elasticsearch Single-Node Mode版本包
~~~     在虚拟机上部署Single-Node Mode Elasticsearch
~~~     下载Elasticsearch 地址: https://www.elastic.co/cn/downloads/elasticsearch 
~~~     最新版本本课程使用7.3.0版本

[root@hadoop01 software]# wget -c https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.0-linux-x86_64.tar.gz
### --- 加压并修改配置文件目录

~~~     # 解压版本包
[root@hadoop01 software]# tar -zxvf elasticsearch-7.3.0-linux-x86_64.tar.gz -C ../servers/
~~~     # 修改版本包名称
[root@hadoop01 ~]# mv /opt/yanqi/servers/elasticsearch-7.3.0/ /opt/yanqi/servers/elasticsearch
四、修改Elasticsearch配置文件
### --- 编辑/opt/yanqi/servers/elasticsearch/config/elasticsearch.yml

~~~     修改配置文件
~~~     单机安装请取消注释:node.name: node-1,否则无法正常启动。
~~~     修改网络和端口,取消注释master节点,单机只保留一个node
[root@hadoop01 ~]# vim /opt/yanqi/servers/elasticsearch/config/elasticsearch.yml
~~~修改配置参数
node.name: node-1                           #   第23行
network.host: hadoop01                      #   第55~59行
#
# Set a custom port for HTTP:
#
http.port: 9200
cluster.initial_master_nodes: ["node-1"]    # 第72行
### --- 按需修改vim /opt/yanqi/servers/elasticsearch/config/jvm.options内存设置
~~~     修改jvm内存参数
~~~     根据实际情况修改占用内存,默认都是1G,单机1G内存,启动会占用700m+然后在安装kibana后,基本上无法运行了,运行了一会就挂了报内存不足。 内存设置超出物理内存,也会无法启动,启动报错。

[root@hadoop01 ~]# vim /opt/yanqi/servers/elasticsearch/config/jvm.options
~~~修改配置参数:第22~23行
-Xms2g
-Xmx2g
### --- 添加es用户,es默认root用户无法启动,需要改为其他用户

~~~     # 添加es用户并修改用户密码
[root@hadoop01 ~]# useradd elasticsearch
[root@hadoop01 ~]# passwd elasticsearch
### --- 改变es目录拥有者账号

~~~     # 修改elasticsearch程序的目录的属主
[root@hadoop01 ~]# chown -R elasticsearch /opt/yanqi/servers/elasticsearch/
### --- 修改/etc/sysctl.conf
~~~     修改/etc/sysctl.conf
~~~     ES因为需要大量的创建索引文件,需要大量的打开系统的文件,
~~~     所以我们需要解除linux系统当中打开文件最大数目的限制,不然ES启动就会抛错修改文件句柄数

[root@hadoop01 ~]# vim /etc/sysctl.conf
~~~在文件末尾添加如下参数
vm.max_map_count=655360 
~~~     # 执行sysctl -p 让其生效

[root@hadoop01 ~]# sysctl -p
### --- 修改/etc/security/limits.conf

~~~     # 修改linux系统对文件描述符的限制级别
[root@hadoop01 ~]# vim /etc/security/limits.conf
~~~在文件末尾添加如下参数
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
五、启动es服务
### --- 启动es:切换刚刚新建的用户

~~~     # 切换到es用户
[root@hadoop01 ~]# su elasticsearch
Hadoop01:9200
~~~     # 启动es服务
[elasticsearch@hadoop01 ~]$ /opt/yanqi/servers/elasticsearch/bin/elasticsearch 
~~~     # 查看启动进程

[root@hadoop01 ~]# jps
Elasticsearch
七、通过Chrome-UI访问elasticsearch: http://hadoop01:9200/ :输出下图参数,说明部署成功


 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

posted on   yanqi_vip  阅读(14)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示