ELK测试环境搭建

xiaoxiao2021-02-28  54

环境介绍, 单节点安装ELK 系统介绍: centos7.4  4C8G ELK版本5.6.9 ############## 安装部署, 1、首先安装JDK,本文采用的是jdk1.8 上传软件包到系统/opt目录下,在/目录下创建soft文件夹 mkdir /soft 解压JDK软件包, tar -zxvf jdk1.8.tar.gz -C /soft 配置环境变量, vim /etc/profile 在文件末尾添加 export JAVA_HOME=/soft/java(java文件的路径) export PATH=$PATH:$JAVA_HOME/bin 退出编辑文件,执行source /etc/profile立即生效 ##################################################### 安装elasticsearch 解压软件包,并且移动解压后的软件包到soft目录下, unzip elasticsearch 修改配置文件 vim /soft/elasticsear/conf/elasticsearch.yml cluster.name: poc node.name: poc network.host: es主机IP地址 开启跨越,如果不开启的话head无法使用 http.cors.enabled: true http.cors.allow-origin: "*" discovery.zen.ping.unicast.hosts: ["poc"](如果是多台主机,使用、隔开) discovery.zen.ping.timeout: 120s bootstrap.system_call_filter: false discovery.zen.minimum_master_nodes: 1 gateway.recover_after_nodes: 1 ##################################################### 更改主机配置文件, vim /etc/sysctl.conf vm.swapiness = 0 vm.max_map_count=2621444 退出执行sysctl -p生效 更改主机配置文件, vim  /etc/security/limits.conf *    soft    nofile 65536 *    hard    nofile    131072 *    soft    nproc    2048 *    hard    nproc    4096 保存退出 ####################################################### elasticsearch无法使用root用户启动,需要创建其他用户 useradd es 赋予elasticsearch解压后文件夹es的属主权限 chown -R es elasticsearch 启动elasticsearch su - es bin/elasticsearch -d(后台启动) ######################################################### 安装elasticsearch-head插件 从elasticsearch5版本以后head被node.js收购,单独成立一个项目所以bin/plugin命令无法使用 安装node.js xz -d node-v8.1.1-linuxx64.tar.xz tar -xvf node-v8.1.1-linuxx64.tar.xz 添加环境变量,修改配置文件/etc/profile vim /etc/profile export NODE_HOME=/home/tools/node-v8.1.1-linuxx64 export PATH=$PATH:$NODE_HOME/bin 执行以下命令环境变量生效 source /etc/profile 验证node.js是否安装成功 node -v npm -v #######################################################3 下载head git clone git://github.com/mobz/elasticsearch-head.git 安装依赖软件包,必须进入elasticsearch-head目录,需要一些时间 npm install npm install -g cnpm --registry= https://registry.npm.taobao.org 修改配置文件vim Gruntfile.js hostname:  '0.0.0.0' 启动ground 1.cd elasticsearchhead/node_modules/grunt/bin/ ./grunt server 或者进入elasticsearch-head目录后,配置完Gruntfile.js 直接 npm run start 即可 ############################################################################## 后台启动命令 nohup /home/tools/elasticsearch-head/node_modules/grunt/bin/grunt server & 页面中locahost需要换成es的地址 ######################################################################### logstasch安装解压logstash软件包 进入logstash/conf目录下, 创建.conf文件 例vim logstash-simple.conf 添加一下内容 input { stdin { } } output {   elasticsearch { hosts => ["localhost:9200"] }   stdout { codec => rubydebug }} 完成退出,启动logstash bin/logstash -f conf/logstash-simple.conf 此配置是交互式操作,输入hello word就会直接采集到elasticsearch中, ################################################################ kibana安装 解压kibana软件包,修改配置文件config/kibana.yml server.port: 5601 server.host: "192.168.100.233" (kibana主机) elasticsearch_url: "http://192.168.100.233:9200"(IP地址是elasticsearch地址) 后台启动 nohup bin/kibana & 访问地址: http://kibana地址:5601
转载请注明原文地址: https://www.6miu.com/read-2619188.html

最新回复(0)