- 下载地址 :https://www.elastic.co/cn/start下载 elasticsearch-8.0.0-linux-x86_64.tar.gz 完成后复制到虚拟机安装java8环境
yum install -y java-1.8.0-openjdk
- 虚拟机配置
vim /etc/security/limits.conf # 添加 * soft nofile 65536 * hard nofile 65536 # 保存,并重新登陆 vim /etc/sysctl.conf # 最后一行添加 vm.max_map_count=262144 # 保存 sysctl -p
- 安装:注意不能使用root用户
tar -xvzf elasticsearch-8.0.0-linux-x86_64.tar.gz # 修改配置 cd elasticsearch-8.0.0 vim config/elasticsearch.yml # 设置network.host的IP为0.0.0.0 # 设置node.name: node-1 # 设置cluster.initial_master_nodes: ["node-1"] # 添加 xpack.reporting.encryptionKey: "chenqionghe" xpack.security.encryptionKey: "122333444455555666666777777788888888" xpack.encryptedSavedObjects.encryptionKey: "122333444455555666666777777788888888" # 保存 # 启动 cd bin ./elasticsearch
- 查看
访问 https://192.168.122.8:9200/ (使用htpps协议)
用户名密码在启动后的提示信息中
✅ Elasticsearch security features have been automatically configured! ✅ Authentication is enabled and cluster connections are encrypted. ℹ️ Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`): 密码
- 出现以下内容说明访问正常
{
"name" : "node-1",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "err8U3ufRS-EiKUqWTh4wQ",
"version" : {
"number" : "8.0.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "1b6a7ece17463df5ff54a3e1302d825889aa1161",
"build_date" : "2022-02-03T16:47:57.507843096Z",
"build_snapshot" : false,
"lucene_version" : "9.0.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
二、kibana 安装
- 下载地址 :https://www.elastic.co/cn/start下载 kibana-8.0.0-linux-x86_64.tar.gz完成后复制到虚拟机配置
- 安装:注意不能使用root用户
tar -xvzf kibana-8.0.0-linux-x86_64.tar.gz vim kibana-8.0.0/config/kibana.yml # 修改server.host: "0.0.0.0" # 修改中文 i18n.locale: "zh-CN" # 修改 server.publicbaseUrl: "http://localhost:5601/" # 保存 cd kibana-8.0.0/bin/ # 启动 ./kibana
- 复制日志中的链接,修改为虚拟机地址并访问在elasticsearch的日志中复制token,填到页面中,并点击Configure manually点击check address生成用户密码
cd elasticsearch-8.0.0/bin/ ./elasticsearch-reset-password --username kibana_system y
- 将用户名密码输入,并勾选node-1 点击配置使用elastic 的账号密码进行登陆
- 创建索引
# 注 number_of_shards:分片数
# number_of_replicas:备份数
PUT 索引名
{
"settings": {
"index": {
"number_of_shards": "5",
"number_of_replicas": "1"
}
}
}



