当前位置: 首页 > news >正文

es8.16单机部署+分词+kibana

环境:
Os:Centos 7
es:8.16.6

说明:
a.不需要单独安装java,es8内部自带java

 

##################################安装es############################
1.获取安装介质
https://www.elastic.co/downloads/past-releases?product=elasticsearch
在这里找到相关介质es和kibana

分词插件如下地址获取
https://release.infinilabs.com/analysis-ik/stable/
我这里获取到的介质如下:
[root@es-217 es8]# ls -1
elasticsearch-8.16.6-linux-x86_64.tar.gz
elasticsearch-analysis-ik-8.16.6.zip
kibana-8.16.6-linux-x86_64.tar.gz


2.创建中间件安装目录和数据文件、日志文件目录
我这里通过机器上安装了多个es,目录带上大版本号以区分
[root@hadoop-slave1 soft]# mkdir -p /usr/local/services
[root@hadoop-slave1 soft]# mkdir -p /data/middle/elasticsearch/data
[root@hadoop-slave1 soft]# mkdir -p /data/middle/elasticsearch/logs

3.创建用户和用户组
[root@pg1 elasticsearch]# groupadd -g 1500 elasticsearch
[root@pg1 elasticsearch]# useradd -u 1500 -g elasticsearch elasticsearch
[root@pg1 elasticsearch]# passwd elasticsearch

4.上传到服务器
解压缩并创建数据目录
[root@localhost soft]# cd /soft
[root@localhost soft]# tar -xvf elasticsearch-8.16.6-linux-x86_64.tar.gz
[root@localhost soft]# mv elasticsearch-8.16.6 /usr/local/services/elasticsearch

5.将elasticsearch目录权限修改为elasticsearch
[root@hadoop-slave1 config]# cd /usr/local/services
[root@hadoop-slave1 services]# chown -R elasticsearch:elasticsearch ./elasticsearch
同时修改数据文件和日志文件目录给到elasticsearch

[root@hadoop-slave1 services]# cd /data/middle
[root@hadoop-slave1 middle]# chown -R elasticsearch:elasticsearch ./elasticsearch

6.创建备份目录
su - root
mkdir -p /data/middle/esbak
chown -R elasticsearch:elasticsearch /data/middle/esbak/

 

7.生成ca文件
生成证书:
su - elasticsearch
[elasticsearch@rac01 bin]$ cd /usr/local/services/elasticsearch/bin
[elasticsearch@master bin]$ ./elasticsearch-certutil ca
一路回车

[elasticsearch@rac01 bin]$./elasticsearch-certutil cert --ca elastic-stack-ca.p12
一路回车

[elasticsearch@localhost bin]$ cd /usr/local/services/elasticsearch
[elasticsearch@master elasticsearch]$ ls
[elasticsearch@localhost elasticsearch]$ ls
bin elastic-certificates.p12 jdk LICENSE.txt modules plugins
config elastic-stack-ca.p12 lib logs NOTICE.txt README.asciidoc


这个时候会生成 elastic-certificates.p12 和 elastic-stack-ca.p12 这2个文件
将这两个文件拷贝到config目录下面
[elasticsearch@master elasticsearch]$ mv elastic-certificates.p12 ./config/
[elasticsearch@master elasticsearch]$ mv elastic-stack-ca.p12 ./config/

 

8.修改配置文件

[root@hadoop-slave1 middle]# su - elasticsearch
[elasticsearch@hadoop-slave1 ~]$ cd /usr/local/services/elasticsearch/config
[elasticsearch@hadoop-slave1 config]$ vi elasticsearch.yml
node.name: node01
path.data: /data/middle/elasticsearch/data
path.logs: /data/middle/elasticsearch/logs
network.host: 192.168.204.218
http.port: 19200
##transport.port: 9400 ##不单独指定,默认是9300
path.repo: /data/middle/esbak
discovery.seed_hosts: ["192.168.204.218"]
cluster.initial_master_nodes: ["192.168.204.218"]
##安全认证
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12##第三方中间件配置参数,看情况需要
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

 

9.修改jvm参数( /usr/local/services/elasticsearch/config/jvm.options)

################################################################
## IMPORTANT: JVM heap size
################################################################
##
## The heap size is automatically configured by Elasticsearch
## based on the available memory in your system and the roles
## each node is configured to fulfill. If specifying heap is
## required, it should be done through a file in jvm.options.d,
## which should be named with .options suffix, and the min and
## max should be set to the same value. For example, to set the
## heap to 4 GB, create a new file in the jvm.options.d
## directory containing these lines:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/8.15/heap-size.html
## for more information
##
################################################################-Xms4g
-Xmx4g

 

10.系统参数设置

每个节点上都要执行,这里确保每台机器都能启动
[root@rac01 middle]# su - elasticsearch
[elasticsearch@rac01 ~]$ ulimit -Hn
65536

检查是否是65536,不是的话修改修改
/etc/security/limits.conf,该文件最后加入

* soft nofile 65536
* hard nofile 65536

报错的话:
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
在 /etc/sysctl.conf 文件最后添加一行
[root@localhost ~]#vm.max_map_count=262144
[root@localhost ~]#sysctl -p

 

11.启动
su - elasticsearch
[elasticsearch@hadoop-slave1 ~]$ cd /usr/local/services/elasticsearch/bin
./elasticsearch -d

 

12.验证
这个时候登陆会报错误

[elasticsearch@master bin]$ curl http://192.168.204.218:19200/?pretty
[elasticsearch@localhost bin]$ curl http://192.168.204.218:19200/?pretty
{"error" : {"root_cause" : [{"type" : "security_exception","reason" : "missing authentication credentials for REST request [/?pretty]","header" : {"WWW-Authenticate" : ["Basic realm=\"security\", charset=\"UTF-8\"","ApiKey"]}}],"type" : "security_exception","reason" : "missing authentication credentials for REST request [/?pretty]","header" : {"WWW-Authenticate" : ["Basic realm=\"security\", charset=\"UTF-8\"","ApiKey"]}},"status" : 401
}

 

12.安装安全认证(我这里密码全部设置为 elastic)

[elasticsearch@master bin]$ cd /usr/local/services/elasticsearch/bin
[elasticsearch@localhost bin]$ ./elasticsearch-setup-passwords interactive
******************************************************************************
Note: The 'elasticsearch-setup-passwords' tool has been deprecated. This       command will be removed in a future release.
******************************************************************************Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]

 

这里提示 elasticsearch-setup-passwords 这个工具后续会弃用

我们尝试另外的工具

[elasticsearch@localhost bin]$ ./elasticsearch-reset-password -u elastic -i
This tool will reset the password of the [elastic] user.
You will be prompted to enter the password.
Please confirm that you would like to continue [y/N]yEnter password for [elastic]: 
Re-enter password for [elastic]: 
Password for the [elastic] user successfully reset.我们这里设置的密码是:elastic

 

13.再次验证
curl -u elastic:elastic http://192.168.204.218:19200/?pretty
curl -u elastic:elastic -X GET "192.168.204.218:19200/_cat/indices?v"

 

################################安装分词插件###########################################

1.查看当前的安装的插件
[root@hadoop-slave1 soft]# curl -u elastic:elastic -X GET "http://192.168.204.218:19200/_cat/plugins?v&s=component&h=name,component,version,description&pretty"
name component version description

 

2.将分词插件上传到相应目录并将该目录修改为es启动的用户
[root@hadoop-slave1 soft]# pwd
/soft
[root@hadoop-slave1 soft]# mkdir fenci
[root@hadoop-slave1 soft]# mv elasticsearch-analysis-ik-8.16.6.zip ./fenci/
[root@hadoop-slave1 soft]# chown -R elasticsearch:elasticsearch ./fenci/

 

3.切换到启动es的账号安装

su - elasticsearch
[elasticsearch@hadoop-slave1 bin]$ cd /usr/local/services/elasticsearch/bin
[elasticsearch@localhost bin]$ ./elasticsearch-plugin install file:///soft/fenci/elasticsearch-analysis-ik-8.16.6.zip
warning: ignoring JAVA_HOME=/usr/local/java/jdk1.8.0_361; using bundled JDK
-> Installing file:///soft/fenci/elasticsearch-analysis-ik-8.16.6.zip
-> Downloading file:///soft/fenci/elasticsearch-analysis-ik-8.16.6.zip
[=================================================] 100%?? 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@     WARNING: plugin requires additional permissions     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.net.SocketPermission * connect,resolve
See https://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.Continue with installation? [y/N]y
-> Installed analysis-ik
-> Please restart Elasticsearch to activate any plugins installed

 

重启es
kill es进程

su - elasticsearch
[elasticsearch@hadoop-slave1 ~]$ cd /usr/local/services/elasticsearch/bin
./elasticsearch -d

 

再次查看

curl -u elastic:elastic -X GET "http://192.168.204.218:19200/_cat/plugins?v&s=component&h=name,component,version,description&pretty"
[elasticsearch@localhost bin]$ curl -u elastic:elastic -X GET "http://192.168.204.218:19200/_cat/plugins?v&s=component&h=name,component,version,description&pretty"
name   component   version description
node01 analysis-ik 8.16.6  IK Analyzer for Elasticsearch

 

################################安装kibana#############################################
1.解压安装
cd /soft
[root@hadoop-slave1 soft]# tar -xvf kibana-8.16.6-linux-x86_64.tar.gz
[root@hadoop-slave1 soft]# mv kibana-8.16.6 /opt/kibana-8.16.6

2.给 kibana_system 账号设置密码
su - elasticsearch
[elasticsearch@master bin]$ cd /usr/local/services/elasticsearch/bin
[elasticsearch@localhost bin]$ ./elasticsearch-reset-password -u kibana_system -i


3.修改配置文件
[root@hadoop-slave1 config]# cd /opt/kibana-8.16.6/config
vi kibana.yml

server.port: 5601
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://192.168.204.218:19200"]
elasticsearch.username: "kibana_system"
elasticsearch.password: "kibana_system"

#下面两项,需要开启RBAC时需要打开配合es使用,发现es8 是不能使用elastic超级用户的
无法启动并有如下提示:
[2026-03-06T16:15:28.880+08:00][FATAL][root] Reason: [config validation of [elasticsearch].username]: value of "elastic" is forbidden

 


4.修改目录权限并使用普通用户启动服务
[root@localhost opt]# chown -R elasticsearch:elasticsearch /opt/kibana-8.16.6/
[root@localhost opt]# su - elasticsearch
[elasticsearch@localhost ~]$ cd /opt/kibana-8.16.6/bin/
[elasticsearch@localhost ~]$ nohup ./kibana &

5.登录
http://192.168.204.218:5601

 

http://www.jsqmd.com/news/443977/

相关文章:

  • 2026年Q1专业溶剂油墨工厂选型指南与TOP5推荐 - 2026年企业推荐榜
  • 学术会议场地怎么选?斯百德会展为您讲透选址核心逻辑 - 麦麦唛
  • 2026年3月西安民事纠纷/离婚/经济纠纷/刑辩/交通事故律师事务所服务市场竞争格局深度分析报告 - 2026年企业推荐榜
  • 选GEO优化服务商需要看成功案例吗? - 品牌推荐大师
  • 江门市大润发购物卡在线回收推荐平台 - 畅回收小程序
  • 2026三亚目的地婚礼推荐|全维度实力覆盖,高性价比不踩雷 - 提酒换清欢
  • 海南别墅售楼中心电话查询:信息核实与沟通建议 - 品牌推荐
  • FastAPI - Study Notes 3
  • Human in the Loop,关于如何控制AI对代码质量影响的尝试。
  • 2026年城市内涝与道路积水监测厂家推荐:河北品高电子,智慧城市生命线水位监测/智能电子水尺/排水防涝系统全系供应 - 品牌推荐官
  • 2026西安婚纱摄影商家口碑排名TOP5 精准选店不踩坑 - 提酒换清欢
  • 2026年实测:郑州阻火器厂家TOP3深度对比与选购指南 - 精选优质企业推荐榜
  • P3065 [USACO12DEC] First! G
  • STM32 MQTT客户端实现方案(基于二次开发包)
  • 海南别墅售楼中心电话查询:联系前需知的几点建议 - 品牌推荐
  • 中山大润发卡回收攻略 - 畅回收小程序
  • 半颗星教育电话查询:前沿技术驱动教学模式探讨 - 品牌推荐
  • 2026年 发电机厂家推荐排行榜:康明斯/玉柴/高压/大功率发电机组,专业动力与高效能解决方案深度解析 - 品牌企业推荐师(官方)
  • 基于神经网络、强化学习、模糊逻辑和小波相结合的混合方法控制欠驱动系统
  • 2026年实测对比:河南TOP3粉体阻火器厂家深度解析 - 精选优质企业推荐榜
  • 2026年口碑不错的商业计划书咨询公司,速来了解,服务市场调研报告/培训项目可行性,商业计划书代写公司推荐 - 品牌推荐师
  • 半颗星教育电话查询:培训服务与注意事项说明 - 品牌推荐
  • 2026年混合机供应商大盘点:选对不踩雷,无尘投料站/Z型斗提机/摇摆筛/旋振筛/超声波振动筛,混合机直销厂家推荐排行榜 - 品牌推荐师
  • 2026年实测:河南阻火器性价比TOP3品牌深度对比 - 精选优质企业推荐榜
  • 2026年实测对比:郑州阻火器方案设计TOP3深度解析 - 精选优质企业推荐榜
  • 2026年选国内激素类试剂盒供应商,教你辨别做得好的企业,his elisa试剂盒,激素类试剂盒产品推荐榜单 - 品牌推荐师
  • 2026现炒浇头面优质品牌推荐榜 - 真知灼见33
  • AI 辅助安卓逆向:TRAE+JADX-AI-MCP 插件实战
  • 东莞大润发卡推荐回收平台,靠谱又安心! - 畅回收小程序
  • 2026电池出海物流五家高口碑服务商助力跨境运输 - 深度智识库