’ $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 {
网关的地址
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 启/停服务
启动服务: /app/openresty/nginx/sbin/nginx
停止服务:/app/openresty/nginx/sbin/nginx -s stop
1.5 配置VeryNginx
打开浏览器访问 http://127.0.0.1/VeryNginx/dashboard/index.html
。
默认用户名和密码:verynginx / verynginx 。
登录之后就可以查看状态,并对配置进行修改了。修改配置后,记得到 「配置 > 系统 > 全部配置」去保存.
提示
-
通过 VeryNginx 控制面板保存新配置之后,会立刻生效,并不需要 restart/reload Nginx。
-
VeryNginx 把配置保存在 /app/openresty/nginx/waf/verynginx/configs/config.json 里面。
-
如果因为配错了什么选项,导致无法登录,可以手动删除 config.json 来清空配置。
已安装成功openresty
可以用网盘的覆盖/app/openresty/nginx/waf目录
链接:https://pan.baidu.com/s/1nt2SfrDtk83Q4gvwIlpBfQ 提取码:g5hs
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为内存的一半大小
vi config/jvm.options
-Xms512m
-Xmx512m
修改 max file 和 max virtual memory 参数
用root 或 sudo 用户
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
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,在对应的位置加上 hostname:’*’ 配置项。
- 在 ~\elasticsearch-6.6.2\elasticsearch-head-master 下执行 npm install 开始安装,完成后可执行 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 即可连接成功。
推荐博客: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”,“log.file.path”]
3.1 启用模块nginx
cd /usr/local/filebeat-6.5.4/modules.d
vi nginx.yml
执行以下配置
- 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”: {
“lang”: “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”,
“target_field”: “read_timestamp”
}
}, {
“date”: {
“field”: “nginx.access.time”,
“target_field”: “@timestamp”,
“formats”: [“dd/MMM/YYYY:HⓂ️s Z”]
}
},{
“remove”: {
“field”: “nginx.access.time”
}
}, {
“user_agent”: {
“field”: “nginx.access.agent”,
“target_field”: “nginx.access.user_agent”
}
}, {
“rename”: {
“field”: “nginx.access.agent”,
“target_field”: “nginx.access.user_agent.original”
}
}, {
“geoip”: {
“field”: “nginx.access.remote_ip”,
“target_field”: “nginx.access.geoip”
}
}, {
“script”: {
“lang”: “painless”,
“inline”: “String tmp=ctx.nginx.access.upstream_response_time; if (tmp==‘-’){ctx.nginx.access.upstream_response_time=-1.0}else{ctx.nginx.access.upstream_response_time=Float.parseFloat(tmp)}”
}
}],
“on_failure” : [{
“set” : {
“field” : “error.message”,
“value” : “{{ _ingest.on_failure_message }}”
}
}]
}
cd /usr/local/filebeat-6.5.4
nohup ./filebeat -e -c filebeat.yml >&/dev/null &
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数Java工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Java开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Java开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注Java获取)
结局:总结+分享
看完美团、字节、腾讯这三家的一二三面试问题,是不是感觉问的特别多,可能咱们真的又得开启面试造火箭、工作拧螺丝的模式去准备下一次的面试了。
开篇有提及我可是足足背下了Java互联网工程师面试1000题,多少还是有点用的呢,换汤不换药,不管面试官怎么问你,抓住本质即可!能读到此处的都是真爱
- Java互联网工程师面试1000题
而且从上面三家来看,算法与数据结构是必备不可少的呀,因此我建议大家可以去刷刷这本左程云大佬著作的 《程序员代码面试指南 IT名企算法与数据结构题目最优解》,里面近200道真实出现过的经典代码面试题。
- 程序员代码面试指南–IT名企算法与数据结构题目最优解
- 其余像设计模式,建议可以看看下面这4份PDF(已经整理)
- 更多的Java面试学习笔记如下,关于面试这一块,我额外细分出Java基础-中级-高级开发的面试+解析,以及调优笔记等等等。。。
以上所提及的全部Java面试学习的PDF及笔记,如若皆是你所需要的,那么都可发送给你!
《一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码》,点击传送门即可获取!
面试问题,是不是感觉问的特别多,可能咱们真的又得开启面试造火箭、工作拧螺丝的模式去准备下一次的面试了。
开篇有提及我可是足足背下了Java互联网工程师面试1000题,多少还是有点用的呢,换汤不换药,不管面试官怎么问你,抓住本质即可!能读到此处的都是真爱
- Java互联网工程师面试1000题
[外链图片转存中…(img-Ybpn7JZ5-1712181236806)]
而且从上面三家来看,算法与数据结构是必备不可少的呀,因此我建议大家可以去刷刷这本左程云大佬著作的 《程序员代码面试指南 IT名企算法与数据结构题目最优解》,里面近200道真实出现过的经典代码面试题。
- 程序员代码面试指南–IT名企算法与数据结构题目最优解
[外链图片转存中…(img-45gM6OXI-1712181236806)]
- 其余像设计模式,建议可以看看下面这4份PDF(已经整理)
[外链图片转存中…(img-YJOjoN79-1712181236806)]
- 更多的Java面试学习笔记如下,关于面试这一块,我额外细分出Java基础-中级-高级开发的面试+解析,以及调优笔记等等等。。。
[外链图片转存中…(img-b4asKxoi-1712181236807)]
以上所提及的全部Java面试学习的PDF及笔记,如若皆是你所需要的,那么都可发送给你!
《一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码》,点击传送门即可获取!