消息队列中间件是分布式系统中重要的组件,主要解决应用解耦,异步消息,流量削锋等问题,实现高性能,高可用,可伸缩和最终一致性架构。目前使用较多的消息队列有ActiveMQ,RabbitMQ,ZeroMQ,Kafka,MetaMQ,RocketMQ
异步处理,应用解耦,流量削锋和消息通讯四个场景。
Nginx 是一个web服务器、用来做代理、转发,以及处理静态资源文件 Tomcat 是一个应用服务器、处理java开发文件
动态请求、交给Tomcat处理:
location / {
proxy_next_upstream http_502 http_504 error timeout invalid_header;
proxy_pass http://localhost:8080;
# 真实的客户端IP
proxy_set_header X-Real-IP $remote_addr;
# 请求头中Host信息
proxy_set_header Host $host;
# 代理路由信息,此处取IP有安全隐患
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 真实的用户访问协议
proxy_set_header X-Forwarded-Proto $scheme;
}
spring task 是一个定时任务、和Linux 的Crontab 相同
命令基本格式:
Java(Spring)
* * * * * * *
- - - - - - -
| | | | | | |
| | | | | | + year [optional]
| | | | | +----- day of week (0 - 7) (Sunday=0 or 7)
| | | | +---------- month (1 - 12)
| | | +--------------- day of month (1 - 31)
| | +-------------------- hour (0 - 23)
| +------------------------- min (0 - 59)
+------------------------------ second (0 - 59)
linux 的 Crontab 定时任务命令 可以 在 linux 规定的时间做出相应的操作
命令基本格式:
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
linux 的 scp 命令 可以 在 linux 之间复制/下载 文件 和 目录;
命令基本格式:
scp [可选参数] file_source file_target
两台服务器:
192.168.0.3
> 当前登录的服务器
192.168.0.4