server_names_hash_bucket_size 128;
large_client_header_buffers 4 32k;
fastcgi_intercept_errors on;
proxy_intercept_errors on;
underscores_in_headers on;
client_header_timeout 15s;
client_body_timeout 15s;
client_max_body_size 100m;
client_body_buffer_size 2m;
client_header_buffer_size 256k;
#keepalive_timeout 0;
keepalive_timeout 90s;
keepalive_requests 2000;
MIME
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - r e m o t e u s e r [ remote_user [ remoteu?ser[time_local] “$request” ’
'$status b o d y b y t e s s e n t " body_bytes_sent " bodyb?ytess?ent"http_referer" ’
‘“ h t t p u s e r a g e n t " " http_user_agent" " httpu?sera?gent""http_x_forwarded_for”’;
#access_log logs/access.log main;
#tcp_nopush on;
#keepalive_timeout 0;
gzip
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_types text/plain text/css application/javascript application/x-javascript application/xml application/json;
gzip_vary on;
proxy_connect_timeout 5s;
proxy_read_timeout 1800s;
proxy_send_timeout 1800s;
proxy_buffer_size 128k;
proxy_buffers 100 128k;
#proxy_busy_buffers_size 1m;
#proxy_temp_file_write_size 512k;
#this line shoud be include in every http block
include /app/openresty/nginx/waf/verynginx/verynginx/nginx_conf/in_http_block.conf;
log_format main ‘$remote_addr -’
’ $remote_user’
’ [$time_local]’
’ “$request”’
’ $status’
’ $body_bytes_sent’
’ “$http_referer”’
’ “$http_user_agent”’
’ “$http_x_forwarded_for”’
’ $upstream_response_time’
’ $upstream_addr’;
access_log logs/access.log main;
upstream gateway_pool {
網(wǎng)關(guān)的地址
server 106.12.129.14:9200;
}
server {
listen 80;
#this line shoud be include in every server block
include /app/openresty/nginx/waf/verynginx/verynginx/nginx_conf/in_server_block.conf;
#include /app/openresty/nginx/waf/verynginx/nginx_conf/in_http_block.conf;
location / {
proxy_http_version 1.1;
proxy_set_header Connection “”;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header Host $host;
proxy_pass http://gateway_pool;
}
}
}
#---------------VeryNginx config code end-----------------
如果不使用 VeryNginx 提供的配置模版,你也可以手動把這部分加入到自己的 Nginx 配置文件中. (如果安裝路徑不是/app/openresty ,需要對 lua_package_cpath 和 lua_package_path 的值進行修改)
1.4 啟/停服務(wù)
啟動服務(wù): /app/openresty/nginx/sbin/nginx
停止服務(wù):/app/openresty/nginx/sbin/nginx -s stop
1.5 配置VeryNginx
打開瀏覽器訪問 http://127.0.0.1/VeryNginx/dashboard/index.html
。
默認用戶名和密碼:verynginx / verynginx 。
登錄之后就可以查看狀態(tài),并對配置進行修改了。修改配置后,記得到 「配置 > 系統(tǒng) > 全部配置」去保存.
提示
-
通過 VeryNginx 控制面板保存新配置之后,會立刻生效,并不需要 restart/reload Nginx。
-
VeryNginx 把配置保存在 /app/openresty/nginx/waf/verynginx/configs/config.json 里面。
-
如果因為配錯了什么選項,導(dǎo)致無法登錄,可以手動刪除 config.json 來清空配置。
已安裝成功openresty
可以用網(wǎng)盤的覆蓋/app/openresty/nginx/waf目錄
鏈接:https://pan.baidu.com/s/1nt2SfrDtk83Q4gvwIlpBfQ 提取碼:g5hs
2. 安裝elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.4.tar.gz
tar -zxvf elasticsearch-6.5.4.tar.gz -C /usr/local/
useradd es
chown -R es:es /usr/local/elasticsearch-6.5.4/
cd /usr/local/elasticsearch-6.5.4
修改config/jvm.options為內(nèi)存的一半大小
vi config/jvm.options
-Xms512m
-Xmx512m
修改 max file 和 max virtual memory 參數(shù)
用root 或 sudo 用戶
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并執(zhí)行命令:
sysctl -p
配置端口 跨域
vi /usr/local/elasticsearch-6.5.4/config/elasticsearch.yml
cluster.name: elasticsearch
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
node.max_local_storage_nodes: 2
http.cors.enabled: true
http.cors.allow-origin: “*”
切換es用戶
su - es
在Elasticsearch主目錄下運行下列命令來安裝這些插件:
bin/elasticsearch-plugin install ingest-geoip
bin/elasticsearch-plugin install ingest-user-agent
es用戶啟動
/usr/local/elasticsearch-6.5.4/bin/elasticsearch -d
root用戶啟動
su - es -c ‘/usr/local/elasticsearch-6.5.4/bin/elasticsearch -d’
2.1 windows 安裝elasticseach-head
- 訪問 https://github.com/mobz/elasticsearch-head 下載 head 插件(選擇 zip 壓縮包下載方式)。
- 修改 ~\elasticsearch-6.6.2\elasticsearch-head-master\Gruntfile.js,在對應(yīng)的位置加上 hostname:’*’ 配置項。
- 在 ~\elasticsearch-6.6.2\elasticsearch-head-master 下執(zhí)行 npm install 開始安裝,完成后可執(zhí)行 grunt server 或者 npm run start 運行 head 插件。
- 安裝成功,訪問 http://localhost:9100/。
2.2 注意事項
- 在 head 中連接 ES 失敗。
對于 Access-Control-Allow-Origin 的問題,可以在 ElasticSearch 6.x 的 ~\config\elasticsearch.yml 文件的末尾加入以下代碼:
http.cors.enabled: true
http.cors.allow-origin: “*”
node.master: true node.data: true
配置更新后,重啟 ES 即可連接成功。
3. 安裝Filebeat
推薦博客:https://www.cnblogs.com/cjsblog/p/9495024.html
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.5.4-linux-x86_64.tar.gz
tar -zxvf filebeat-6.5.4-linux-x86_64.tar.gz -C /usr/local/
cd /usr/local/
mv filebeat-6.5.4-linux-x86_64 filebeat-6.5.4
cd /usr/local/filebeat-6.5.4
vi filebeat.yml
filebeat.inputs:
- type: log
enabled: false
paths:
- /app/openresty/nginx/logs/access.log
#============================= Filebeat modules ===============================
filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
setup.template.settings:
index.number_of_shards: 3
setup.template.name: “nginx-log-”
setup.template.pattern: “nginx-log-*”
setup.template.overwrite: true
output.elasticsearch:
enabled: true
hosts: [“106.13.3.200:9200”]
index: “nginx-log-%{+yyyy-MM-dd}”
#================================ Processors =====================================
Configure processors to enhance or manipulate events generated by the beat.
processors:
#- add_host_metadata: ~
#- add_cloud_metadata: ~
- drop_fields:
fields: [“beat.name”, “beat.version”, “host.architecture”,“host.architecture”,“host.name”,“beat.hostname”,“l(fā)og.file.path”]
3.1 啟用模塊nginx
cd /usr/local/filebeat-6.5.4/modules.d
vi nginx.yml
執(zhí)行以下配置
- module: nginx
Access logs
access:
enabled: true
Set custom paths for the log files. If left empty,
Filebeat will choose the paths depending on your OS.
var.paths: [“/app/openresty/nginx/logs/access.log”]
Error logs
error:
enabled: true
Set custom paths for the log files. If left empty,
Filebeat will choose the paths depending on your OS.
var.paths: [“/app/openresty/nginx/logs/error.log”]
3.2 配置 default.json
cd /usr/local/filebeat-6.5.4/module/nginx/access/ingest
vi default.json
{
“description”: “Pipeline for parsing Nginx access logs. Requires the geoip and user_agent plugins.”,
“processors”: [{
“grok”: {
“field”: “message”,
“patterns”:[
“”?%{IP_LIST:nginx.access.remote_ip_list} - %{DATA:nginx.access.user_name} \[%{HTTPDATE:nginx.access.time}\] “%{GREEDYDATA:nginx.access.info}” %{NUMBER:nginx.access.response_code} %{NUMBER:nginx.access.body_sent.bytes} “%{DATA:nginx.access.referrer}” “%{DATA:nginx.access.agent}” “%{GREEDYDATA:nginx.access.xforwardedfor}” %{GREEDYDATA:nginx.access.upstream_response_time} %{GREEDYDATA:nginx.access.upstream_addr}"
],
“pattern_definitions”: {
“IP_LIST”: “%{IP}(”?,?\s*%{IP})*"
},
“ignore_missing”: true
}
}, {
“grok”: {
“field”: “nginx.access.info”,
“patterns”: [
“%{WORD:nginx.access.method} %{DATA:nginx.access.url} HTTP/%{NUMBER:nginx.access.http_version}”,
“”
],
“ignore_missing”: true
}
}, {
“remove”: {
“field”: “nginx.access.info”
}
}, {
“split”: {
“field”: “nginx.access.remote_ip_list”,
“separator”: “”?,?\s+"
}
}, {
“script”: {
“l(fā)ang”: “painless”,
“inline”: “boolean isPrivate(def ip) { try { StringTokenizer tok = new StringTokenizer(ip, ‘.’); int firstByte = Integer.parseInt(tok.nextToken()); int secondByte = Integer.parseInt(tok.nextToken()); if (firstByte == 10) { return true; } if (firstByte == 192 && secondByte == 168) { return true; } if (firstByte == 172 && secondByte >= 16 && secondByte <= 31) { return true; } if (firstByte == 127) { return true; } return false; } catch (Exception e) { return false; } } def found = false; for (def item : ctx.nginx.access.remote_ip_list) { if (!isPrivate(item)) { ctx.nginx.access.remote_ip = item; found = true; break; } } if (!found) { ctx.nginx.access.remote_ip = ctx.nginx.access.remote_ip_list[0]; }”
}
}, {
“remove”:{
“field”: “message”
}
}, {
“rename”: {
“field”: “@timestamp”,
自我介紹一下,小編13年上海交大畢業(yè),曾經(jīng)在小公司待過,也去過華為、OPPO等大廠,18年進入阿里一直到現(xiàn)在。
深知大多數(shù)Java工程師,想要提升技能,往往是自己摸索成長或者是報班學(xué)習(xí),但對于培訓(xùn)機構(gòu)動則幾千的學(xué)費,著實壓力不小。自己不成體系的自學(xué)效果低效又漫長,而且極易碰到天花板技術(shù)停滯不前!
因此收集整理了一份《2024年Java開發(fā)全套學(xué)習(xí)資料》,初衷也很簡單,就是希望能夠幫助到想自學(xué)提升又不知道該從何學(xué)起的朋友,同時減輕大家的負擔(dān)。
既有適合小白學(xué)習(xí)的零基礎(chǔ)資料,也有適合3年以上經(jīng)驗的小伙伴深入學(xué)習(xí)提升的進階課程,基本涵蓋了95%以上Java開發(fā)知識點,真正體系化!
由于文件比較大,這里只是將部分目錄大綱截圖出來,每個節(jié)點里面都包含大廠面經(jīng)、學(xué)習(xí)筆記、源碼講義、實戰(zhàn)項目、講解視頻,并且后續(xù)會持續(xù)更新
如果你覺得這些內(nèi)容對你有幫助,可以添加V獲?。簐ip1024b (備注Java)
最后
文章中涉及到的知識點我都已經(jīng)整理成了資料,錄制了視頻供大家下載學(xué)習(xí),誠意滿滿,希望可以幫助在這個行業(yè)發(fā)展的朋友,在論壇博客等地方少花些時間找資料,把有限的時間,真正花在學(xué)習(xí)上,所以我把這些資料,分享出來。相信對于已經(jīng)工作和遇到技術(shù)瓶頸的朋友們,在這份資料中一定都有你需要的內(nèi)容。
一個人可以走的很快,但一群人才能走的更遠。如果你從事以下工作或?qū)σ韵赂信d趣,歡迎戳這里加入程序員的圈子,讓我們一起學(xué)習(xí)成長!文章來源:http://www.zghlxwxcb.cn/news/detail-860750.html
AI人工智能、Android移動開發(fā)、AIGC大模型、C C#、Go語言、Java、Linux運維、云計算、MySQL、PMP、網(wǎng)絡(luò)安全、Python爬蟲、UE5、UI設(shè)計、Unity3D、Web前端開發(fā)、產(chǎn)品經(jīng)理、車載開發(fā)、大數(shù)據(jù)、鴻蒙、計算機網(wǎng)絡(luò)、嵌入式物聯(lián)網(wǎng)、軟件測試、數(shù)據(jù)結(jié)構(gòu)與算法、音視頻開發(fā)、Flutter、IOS開發(fā)、PHP開發(fā)、.NET、安卓逆向、云計算文章來源地址http://www.zghlxwxcb.cn/news/detail-860750.html
有適合小白學(xué)習(xí)的零基礎(chǔ)資料,也有適合3年以上經(jīng)驗的小伙伴深入學(xué)習(xí)提升的進階課程,基本涵蓋了95%以上Java開發(fā)知識點,真正體系化!**
由于文件比較大,這里只是將部分目錄大綱截圖出來,每個節(jié)點里面都包含大廠面經(jīng)、學(xué)習(xí)筆記、源碼講義、實戰(zhàn)項目、講解視頻,并且后續(xù)會持續(xù)更新
如果你覺得這些內(nèi)容對你有幫助,可以添加V獲?。簐ip1024b (備注Java)
[外鏈圖片轉(zhuǎn)存中…(img-iyXvwiET-1712177290951)]
最后
文章中涉及到的知識點我都已經(jīng)整理成了資料,錄制了視頻供大家下載學(xué)習(xí),誠意滿滿,希望可以幫助在這個行業(yè)發(fā)展的朋友,在論壇博客等地方少花些時間找資料,把有限的時間,真正花在學(xué)習(xí)上,所以我把這些資料,分享出來。相信對于已經(jīng)工作和遇到技術(shù)瓶頸的朋友們,在這份資料中一定都有你需要的內(nèi)容。
一個人可以走的很快,但一群人才能走的更遠。如果你從事以下工作或?qū)σ韵赂信d趣,歡迎戳這里加入程序員的圈子,讓我們一起學(xué)習(xí)成長!
AI人工智能、Android移動開發(fā)、AIGC大模型、C C#、Go語言、Java、Linux運維、云計算、MySQL、PMP、網(wǎng)絡(luò)安全、Python爬蟲、UE5、UI設(shè)計、Unity3D、Web前端開發(fā)、產(chǎn)品經(jīng)理、車載開發(fā)、大數(shù)據(jù)、鴻蒙、計算機網(wǎng)絡(luò)、嵌入式物聯(lián)網(wǎng)、軟件測試、數(shù)據(jù)結(jié)構(gòu)與算法、音視頻開發(fā)、Flutter、IOS開發(fā)、PHP開發(fā)、.NET、安卓逆向、云計算
到了這里,關(guān)于Nginx監(jiān)控安裝:Filebeat+ES+Grafana,阿里創(chuàng)新發(fā)布《新高并發(fā)寶典》的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!