国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

CentOS 8 部署 ELK 8.7真的是方便呀

這篇具有很好參考價值的文章主要介紹了CentOS 8 部署 ELK 8.7真的是方便呀。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

?

之前裝過一次 ELK 7.7,相比之下裝 8.7可方便太多了~??

?

CentOS版本

  CentOS-8.5.2111-x86_64-dvd1

?

JAVA
  ELK會自己使用內置版本的JDK

?

ElasticSearch

  8.7.0 下載頁面 Download Elasticsearch | Elastic

?

Kinbana

  8.7.0 下載地址 Download Kibana Free | Get Started Now | Elastic

?

Logstash

  8.7.0 下載地址 Download Logstash Free | Get Started Now | Elastic

?

安裝ElasticSearch8

?  加入資源

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

  在/etc/yum.repos.d/位置創(chuàng)建文件elasticsearch.repo

cd /etc/yum.repos.d/

vim elasticsearch.repo

  輸入如下內容:

[elasticsearch]
name=Elasticsearch repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md

?

將鏡像從?mirror.centos.org?更改為?vault.centos.org (yum可用,則跳過)

  進入到 yum 的 repos 目錄

cd /etc/yum.repos.d/

  修改 centos 文件內容

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

  生成緩存更新

yum makecache

  運行 yum update,并且重新安裝 vim

yum update -y
yum -y install vim

?

?  執(zhí)行 yum 命令完成 es 安裝

yum install --enablerepo=elasticsearch elasticsearch

  安裝完記得保存如下信息,便于后續(xù)使用

Authentication and authorization are enabled.
TLS for the transport and HTTP layers is enabled and configured.
 
The generated password for the elastic built-in superuser is : xxxxxxxxx
 
If this node should join an existing cluster, you can reconfigure this with
'/usr/share/elasticsearch/bin/elasticsearch-reconfigure-node --enrollment-token <token-here>'
after creating an enrollment token on your existing cluster.
 
You can complete the following actions at any time:
 
Reset the password of the elastic built-in superuser with 
'/usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic'.
 
Generate an enrollment token for Kibana instances with 
 '/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana'.
 
Generate an enrollment token for Elasticsearch nodes with 
'/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node'.

?

添加用戶和用戶組 es 并未用戶組提供文件夾權限

groupadd es 
useradd es -g es -p password 
 
chown es:es -R /usr/share/elasticsearch
chown es:es -R /etc/elasticsearch
chown es:es -R /var/lib/elasticsearch
chown es:es -R /var/log/elasticsearch
chown es:es -R /var/
chmod 777 /etc/elasticsearch
chmod 777 /usr/share/elasticsearch/
chmod 777 /etc/sysconfig/elasticsearch

?

?編輯 elasticsearch.yml 配置文件

 cd /etc/elasticsearch
vim elasticsearch.yml

  配置如下:

network.host: 0.0.0.0
http.port: 9200
xpack.security.enabled: false

  使用 es 賬號啟動 ElasticSearch

cd /usr/share/elasticsearch/bin/
su es
./elasticsearch -d

?

關閉防火墻或者開放9200端口,即可通過 IP:9200 訪問

# 查看防火墻狀態(tài)
systemctl status firewalld.service

# 關閉防火墻
systemctl stop firewalld.service

?

?  如果遇到安全提示則選擇繼續(xù)訪問,并輸入用戶名密碼這個用到的用戶名密碼是安裝Es后我們保存的那個哦

CentOS 8 部署 ELK 8.7真的是方便呀

?

安裝 Kibana

  在 /etc/yum.repos.d/ 位置創(chuàng)建文件 kibana.repo

cd /etc/yum.repos.d/

vim kibana.repo

  輸入如下內容

[kibana-8.x]
name=Kibana repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

  執(zhí)行yum命令完成安裝

yum install kibana

  修改 kibana 配置文件

vim /etc/kibana/kibana.yml

  增加如下內容:

server.host: "0.0.0.0"
server.post: 5601

  以root后臺啟動服務

nohup /usr/share/kibana/bin/kibana --allow-root &

  在ES安裝目錄 執(zhí)行如下代碼獲取 token (本文 8.7 版本不需要)

/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana

?  關閉防火墻或者開啟5601端口,并使用瀏覽器訪問 IP:5601

?

安裝 Logstash

  在 /etc/yum.repos.d/ 位置創(chuàng)建文件 logstash.repo

cd /etc/yum.repos.d/
vim logstash.repo

  輸入如下內容:

[logstash-8.x]
name=Elastic repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

  執(zhí)行yum命令完成安裝

yum install logstash

  安裝完成后的啟動目錄

/usr/share/logstash/bin/logstash

  在 /etc/logstash/ 目錄下創(chuàng)建 logstash.conf 配置文件

cd /etc/logstash/
vim logstash.conf

  輸入如下內容,以搜集 Nginx 的日志

#---------------------------------------------------------------- nginx-----------------------------------------------------------------------
input {
   file {
        type => "nginx-error-log"
        path => "/usr/local/nginx/logs/error.log"
    }
    file {
        type => "nginx-access-log"
        path => "/usr/local/nginx/logs/access.log"
        codec => json
    }
}
 
filter {
    if [type] =~ "nginx-error-log" 
    {
        grok {
            match => {
                "message" => "(?<datetime>\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}) \[(?<errtype>\w+)\] \S+: \*\d+ (?<errmsg>[^,]+), (?<errinfo>.*$)"
            }
        }
 
        mutate {
            rename => {
                "message" => "z_message" 
                "host" => "fromhost"
            } 
        }   
    } else if [type] =~ "nginx-access-log"  {
        mutate {
            split => {"upstremtime" => ","}
        }
        mutate {
            convert => { "upstremtime" => "float"}
        }
    }
 
    if [errinfo]
    {
            ruby {
                code => "
                        new_event = LogStash::Event.new(Hash[event.get('errinfo').split(', ').map{ |l| l.split(': ')  }])
                        new_event.remove('@timestamp')
                        event.append(new_event)
                "
            }
 
            grok {
                match => {
                    "request" => '"%{WORD:verb} %{URIPATHPARAM:urlpathparam}?(?: HTTP/%{NUMBER:httpversion})"'
                }
                patterns_dir => ["/home/data/logstash/patterns/"]
                remove_field => [ "errinfo","request" ]
            }
     }
}
 
output {
    #elasticsearch { host => localhost }
    stdout { codec => rubydebug }
    if [type] =~ "nginx-error-log" {
        elasticsearch {
            hosts => ["http://ES的域名或者IP地址"]
            index => "logstash-nginx-error-log-%{+YYYY.MM.dd}"
            document_type => "data"
            user => "es用戶名"
            password => "es密碼"
        }      
    }else if [type] =~ "nginx-access-log"  {
          elasticsearch {
            hosts => ["http://ES的域名或者IP地址"]
            index => "logstash-nginx-access-log-%{+YYYY.MM.dd}"
            document_type => "data"
            user => "es用戶名"
            password => "es密碼"
        }      
    }
}

  指定配置文件,啟動 logstash

/usr/share/logstash/bin/logstash -f /etc/logstash/logstash.conf

# 后臺啟動
nohup /usr/share/logstash/bin/logstash -f /etc/logstash/logstash.conf &

?

格式化 Nginx 日志

  進入 nginx 配置文件(以各自的文件目錄、文件名為準)

cd /usr/local/nginx/conf/
vim nginx.conf

  在 http 里輸入如下內容:

    log_format main '{"@timestamp":"$time_iso8601",'
        '"host":"$server_addr",'
        ' "clientip" : "$remote_addr",'
        ' "size" : "$body_bytes_sent" ,'
        '"respnsetime":"$request_time",'
        '"upstremtime":"$upstream_response_time",'
        '"upstremhost":"$upstream_addr",'
        '"httphost":"$host",'
        '"referer":"$http_referer",'
        '"xff":"$http_x_forwarded_for",'
        '"agent":"$http_user_agent",'
        '"clientip":"$remote_addr",'
        '"request":"$request",'
        '"uri":"$uri",'
        '"status":"$status"}';
   
    access_log /usr/local/nginx/logs/access.log main;
    error_log /usr/local/nginx/logs/error.log error;

  重新加載 Nginx?

/usr/local/nginx/sbin/nginx -s reload

  進入 kibana,就能看到推過來的 Nginx 的日志

CentOS 8 部署 ELK 8.7真的是方便呀

?

安裝 filebeat

  logstash 占用的資源比較大,沒有 filebeat 輕量,所以官方也推薦使用beats來作為日志采集工具。而且beats可擴展,支持自定義構建。

yum install filebeat -y

  備份其配置文件,并新建

mv /etc/filebeat/filebeat.yml /etc/filebeat/filebeat.yml.bek

vim /etc/filebeat/filebeat.yml

  輸入如下內容:

- type: log
  paths: - /var/log/messages   # 指定需要收集的日志文件的路徑
  output.elasticsearch:
     hosts: ["127.0.0.1:9200"] # 配置 Elasticsearch 服務器的 IP 地址

  命令

systemctl start filebeat       #啟動
systemctl enable filebeat      #開機啟動
systemctl status filebeat      #查看
systemctl stop filebeat        #停止

?

?  告辭~

?

?

?

?

?

?

?

?

?

?


?文章來源地址http://www.zghlxwxcb.cn/news/detail-435009.html

到了這里,關于CentOS 8 部署 ELK 8.7真的是方便呀的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如若轉載,請注明出處: 如若內容造成侵權/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經查實,立即刪除!

領支付寶紅包贊助服務器費用

相關文章

  • Linux centOS 7部署ELK(elasticSearch、logstash、kibana)

    Linux centOS 7部署ELK(elasticSearch、logstash、kibana)

    Linux centOS 7部署ELK(elasticSearch、logstash、kibana) 目錄 1【yum模式安裝】 1.1【安裝ElasticSearch】 1.2【安裝Kibana】 1.3【安裝Logstash】 1.4【安裝Filebeat】 2【壓縮包方式安裝elk】 原文鏈接: How To Install Elasticsearch, Logstash, and Kibana (Elastic Stack) on Ubuntu 16.04 | DigitalOcean 十分鐘搞定CentOS

    2024年02月07日
    瀏覽(49)
  • centos7.6部署ELK集群(一)之elasticsearch7.7.0集群部署

    centos7.6部署ELK集群(一)之elasticsearch7.7.0集群部署

    32.3. 部署es7.7.0 32.3.1. 下載es(各節(jié)點都做) wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.7.0-linux-x86_64.tar.gz 32.3.2. 解壓至安裝目錄(各節(jié)點都做) tar -xvf elasticsearch-7.7.0-linux-x86_64.tar.gz -C /vmdata/ 32.3.3. 創(chuàng)建es用戶并設置密碼(各節(jié)點都做) ES 7.x 開始不再允許以任何方

    2023年04月17日
    瀏覽(22)
  • 【AI人工智能】 最強大的語言模型鏡像 使用起來真的太方便了! 真的要解放代碼思維了嗎?

    【AI人工智能】 最強大的語言模型鏡像 使用起來真的太方便了! 真的要解放代碼思維了嗎?

    ?? 個人主頁 極客小俊 ??? 作者簡介:web開發(fā)者、設計師、技術分享博主 ?? 希望大家多多支持一下, 我們一起進步!?? ?? 如果文章對你有幫助的話,歡迎評論 ??點贊???? 收藏 ??加關注 前言 ?? AI 在某些基礎應用領域可以幫助你減少很多工作量,很強大哦! 嘿嘿 優(yōu)

    2024年02月10日
    瀏覽(27)
  • 虛擬機CentOS7.5編譯安裝Qt4.8.7

    虛擬機CentOS7.5編譯安裝Qt4.8.7

    官網下載鏈接:Qt4.8.7 官網下載速度可能會非常慢,本人已上傳至CSDN,點此下載,下載后需要先用7z軟件解壓成zip包。 環(huán)境安裝 解壓qt-everywhere-opensource-src-4.8.7.zip 不能在Windows解壓zip包,后續(xù)會出錯 將zip包拷貝至centos虛擬機中,用以下命令解壓 編譯安裝 注 :添加 -fontconfig

    2024年01月18日
    瀏覽(28)
  • rhel 8.7 部署 keepalived+haproxy 實現 mysql 雙主高可用場景

    話不多說,直接開搞 ip 服務 172.72.0.116 keepalived+haproxy+mysql 172.72.0.137 keepalived+haproxy+mysql 172.72.0.100 VIP 部署前,大家先要確認集群之間的時間是否一致,集群類的服務,最怕時間不一致 Mysql 二進制文件下載地址 部署相關的操作,兩臺機器都需要執(zhí)行,需要執(zhí)行指定機器時,會額

    2024年02月11日
    瀏覽(39)
  • Ubantu安裝教程(其實和之前CentOS差不多)

    Ubantu安裝教程(其實和之前CentOS差不多)

    VMware下載安裝 所有分享提取碼都會是1152,永久有效 官網下載 阿里云 圖形到DOS:Ctrl+alt+f2 (呀我Ubuntu上好像不行,CentOS是可以的) DOS到圖形:輸入startx 或者 在命令上輸入 init 3 切換到DOS界面 輸入init 5 切換到圖形界面

    2024年02月06日
    瀏覽(48)
  • 記一次線上問題 → 偶爾的熱情真的難頂呀!

    記一次線上問題 → 偶爾的熱情真的難頂呀!

    昨晚和媳婦坐在沙發(fā)上刷視頻 我用手肘輕輕推了推媳婦:你看這渣男,玩完女的都不娶人家 媳婦:哎喲我天,哎呀媽,我這也沒好哪去呀 我疑惑的看向媳婦:啥意思啊 媳婦看向自己的手機:啥意思啊,特么有些人,娶完了也不玩呀 我負責的系統(tǒng)需要同步上游系統(tǒng)的數據 同

    2024年02月03日
    瀏覽(21)
  • kindle安卓更新固件(已經裝過安卓系統(tǒng))

    《kindle.xxxxxx.zip》入門版499 《kpw2.xxxxxx.zip》Paperwhite二代 《kpw3.xxxxxx.zip》Paperwhite三代及漫畫版 《voyage.xxxxxx.zip》Kindle Voyage 《oasis.xxxxxx.zip》Kindle Oasis 安卓固件下載(包含原生系統(tǒng)):http://182.254.232.41/download/android 安卓固件下載(不含原生系統(tǒng)):http://182.254.232.41/download/update 32位系

    2024年02月09日
    瀏覽(16)
  • docker-compose重新部署之前的環(huán)境和項目

    docker-compose重新部署之前的環(huán)境和項目

    因為目前工作中項目大部分都是使用的docker環(huán)境,使用docker-compose編排部署的,所以這段時間就自己嘗試使用docker部署一下之前自己寫的練手項目,其中的環(huán)境有 mysql8 、 php7.4 、 redis3 、 rabbitmq 、 nginx 、 elasticsearch ,當然這些技術有一些我都只是了解,平時工作用不到,自己

    2023年04月26日
    瀏覽(18)
  • centos7 搭建ELK(elasticsearch、logstash、kibana)

    centos7 搭建ELK(elasticsearch、logstash、kibana)

    1、下載安裝包 使用華為鏡像站下載速度很快,華為鏡像站: https://mirrors.huaweicloud.com/home ,下載時需要保證版本一致 2、安裝elasticsearch 解壓到當前目錄 安裝,將Elasticsearch移動到/opt目錄之中 創(chuàng)建Elasticsearch用戶 es 規(guī)定 root 用戶不能啟動 es,所以需要新建一個其他用戶來啟動

    2024年02月13日
    瀏覽(60)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領取紅包,優(yōu)惠每天領

二維碼1

領取紅包

二維碼2

領紅包