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

采用ELK搭建日志平台,Elasticsearch安装

1、下载elasticsearch

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.7-linux-x86_64.tar.gz

2、解压到/usr/local/

mkdir -p /usr/local/elasticsearch7.17
tar -zxf elasticsearch-7.17.7-linux-x86_64.tar.gz -C /usr/local/elasticsearch7.17/ --strip-components=1 #--strip-components选项表示从目录级别上去除指定的前缀,以实现更加控制解压的效果

3、修改配置文件

cd /usr/local/elasticsearch7.17/config
vi elasticsearch.yml
cluster.name: production
#节点信息
node.name: 192.168.0.191
path.data: /data/elasticsearch7.17
path.logs: /data/elasticsearch7.17/logs
#网络配置
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["192.168.0.191"]
#自发现配置新节点向集群报到的主机名
cluster.initial_master_nodes: ["192.168.0.191"]
bootstrap.system_call_filter: false
#增加跨域配置
http.cors.enabled: true
http.cors.allow-origin: "*"
vi jvm.options
-Xms512m
-Xmx512m
-XX:HeapDumpPath=/data/elasticsearch7.17/
9-:-Xlog:gc*,gc+age=trace,safepoint:file=/data/elasticsearch7.17/logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m

4、创建日志目录

mkdir -p /data/elasticsearch7.17/logs

5、创建用户并赋予权限

useradd es
passwd es
chown -R es:es /usr/local/elasticsearch7.17/
chown -R es:es /data/elasticsearch7.17/
usermod -g root es

6、elasticsearch 启动的时候要求当前用户最大线程数至少为 4096 个线程,修改当前用户最大线程数

ulimit -a
pending signals                 (-i) 3834                  -----此处为当前用户线程数
vi /etc/security/limits.conf
es soft nofile 65536
es hard nofile 65536
es -  nproc  65535
vi /etc/sysctl.conf
vm.max_map_count = 655360

7、启动elasticsearch

su es
前台启动
cd /usr/local/elasticsearch7.17/bin
./elasticsearch
后台启动
cd /usr/local/elasticsearch7.17/bin
./elasticsearch -d

8、设置开机启动elasticsearch

touch /etc/systemd/system/elasticsearch.service
vi /etc/systemd/system/elasticsearch.service
[Unit]
Description=Elasticsearch
After=network.target
[Service]
Type=simple
User=es
LimitMEMLOCK=infinity
LimitNOFILE=65535
WorkingDirectory=/usr/local/elasticsearch7.17
ExecStart=/usr/local/elasticsearch7.17/bin/elasticsearch
Restart=on-failure
[Install]
WantedBy=multi-user.target加入开机启动
systemctl daemon-reload
systemctl enable elasticsearch

9、elasticsearch操作命令

systemctl start elasticsearch.service	启动
systemctl status elasticsearch.service	查看状态
systemctl restart elasticsearch.service	重启
systemctl stop elasticsearch.service	停止

10、开启防火墙

firewall-cmd --zone=public --add-port=9200/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-ports

centos7.9 elasticsearch(ES)环境安装结束


http://www.mrgr.cn/news/11257.html

相关文章:

  • 基于R语言遥感随机森林建模与空间预测
  • Vue中使用el-table自定义序号翻页后又从1开始没有连续
  • [Day 61] 區塊鏈與人工智能的聯動應用:理論、技術與實踐
  • 三层链路聚合
  • 【本社翻译】Unity官方XR开发电子书
  • 收银系统源码助力零售门店数字化升级
  • 【Android】Navigation动态设置Graph和Launch参数
  • 广播语义学许多PyTorch操作支持NumPy的广播语义。python编程 人工智能 神经网络
  • 【Tools】Prompt 的概念介绍
  • 探索商品详情API中的重量与体积信息:解锁精准物流管理与用户购物体验的秘密
  • 在VB.net中,LINQ有什么查询表达式,举例说明
  • 深度学习系列71:表格检测和识别
  • 探索Git:分布式版本控制系统的力量(二)
  • java 使用 aws s3 sdk 通过分段下载来实现 html 页面 video 的断点播放、拖动进度播放
  • nginx的代理服务器
  • docker数据卷及数据卷容器
  • NoSql数据库Redis集群
  • vue2的el-select虚拟下拉
  • 【嵌入式开发之网络编程】Socket套接字及TCP、UDP通信的实现
  • Excel vba listbox 鼠标滚轮滚动