安装版本:elasticsearch8.5.3,kibana8.5.3
建议运行es和kibana都不要用root角色
假设已经用useradd elastic新增了一个elastic的用户,以此用户运行下面的命令
1. 安装
选择最直接的tar包安装
elasticsearch8.5.3 安装文档
Install Elasticsearch from archive on Linux or MacOS | Elasticsearch Guide [8.5] | Elastic
kibana8.5.3安装文档
Install Kibana from archive on Linux or macOS | Kibana Guide [8.5] | Elastic
2. 配置elasticsearch
编辑 config/elasticsearch.yml
cluster.name: my-application-test
node.name: node-1
path.data: /datas/elastic/data
path.logs: /datas/elastic/logs
network.host: 192.168.0.123
http.port: 9200
ingest.geoip.downloader.enabled: false
以上是基本配置
3. 修改linux的参数
以root身份编辑
vim /etc/sysctl.conf
然后运行
sysctl -p
4. 启动
./bin/elasticsearch
启动时会自动生成安全设置,会设置elastic的密码,会生成密钥文件
配置文件elasticsearch.yml中自动添加了几行
# Enable security features
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
enabled: true
keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
enabled: true
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------
此时是以https的方式才能访问es,可以将其关闭掉
修改 这一行后重启
xpack.security.http.ssl:
enabled: false
打开浏览器,访问
http://192.168.0.123:9200/
输入刚刚启动时给的用户名和密码
用户名:elastic
密码:xxx
得到如下结果
说明启动elastic成功
接下来安装kibana
5. 安装kibana
解压缩kibana
6. 配置kibana用户
进入es目录,运行命令
./bin/elasticsearch-reset-password -u kibana_system
重置kibana的用户密码:得到如下密码串
复制出来,进入kibana配置文件编辑
server.port: 5601
server.host: "192.168.0.111"
server.name: "myhost-221"
elasticsearch.hosts: ["http://l92.168.0.123:9200"]
elasticsearch.username: "kibana_system"
elasticsearch.password: "thcCW7nlidxPHqY6aaaa"
elasticsearch.pingTimeout: 1500
elasticsearch.requestTimeout: 3000
elasticsearch.compression: true
elasticsearch.shardTimeout: 3000
i18n.locale: "zh-CN"
host:填写elasticsearch的访问地址(注意不要加https)
i18n.locale: zh-CN是指中文
timeout写少一点,3000毫米即可
用户名和密码就是上面给的用户名和密码
第三步:安装ik分词器
release地址
Releases · medcl/elasticsearch-analysis-ik · GitHub
对应8.5.3的可以下载8.5.2版本
放到es_home/plugin目录下
然后运行unzip 命令解压缩到es_home/plugin/ik目录下
编辑plugin-descriptor.properties文件
修改版本号,修改成和es版本号一致
version=8.5.3
elasticsearch.version=8.5.3
修改config/IKAnalyzer.cfg.xml目录,添加自己的词典
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>IK Analyzer 扩展配置</comment>
<!--用户可以在这里配置自己的扩展字典 -->
<entry key="ext_dict">my.dic</entry>
<!--用户可以在这里配置自己的扩展停止词字典-->
<entry key="ext_stopwords"></entry>
<!--用户可以在这里配置远程扩展字典 -->
<!-- <entry key="remote_ext_dict">words_location</entry> -->
<!--用户可以在这里配置远程扩展停止词字典-->
<!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>
在同级目录下添加自己的词典文件my.dic
重启es,完成ik分词器的添加