...
代码块 | ||
---|---|---|
| ||
upstream smartbi-static {
server 10.10.204.101:18080;
}
upstream smartbi-dynamic {
server 10.10.204.100:18080;
##会话保持配置,nginx默认不带这个功能,需要自行编译才能使用。
##不同的sticky模块,配置可能不同。需要参考具体的sticky模块配置说明。
##以下是tengine的会话保持配置示例
session_sticky cookie=smartbi_dynamic_cookie fallback=on path=/smartbi mode=insert option=indirect;
##健康检测配置。nginx默认不带这个功能,需要自行编译才能使用。
##不同的check模块,配置可能不同。需要参考具体的check模块的配置说明。
##以下是tengine的健康检测配置示例
check interval=3000 rise=2 fall=5 timeout=1000 type=http;
## customizeName 是在完全版部署的黑白名单规则配置文件 defenderConfig.json中定义的,具体可以查看 Smartbi前后端分离部署_完全版 里面的说明
check_http_send "HEAD /smartbi/vision/healthcheck.jsp HTTP/1.0\r\ncustomizeName: smartbi_header\r\n\r\n";
## 如果没有配置黑白名单规则,可以使用以下的配置进行smartbi的健康检测。其中xxxx需要换为访问的smartbi的ip或域名。
## check_http_send "HEAD /smartbi/vision/healthcheck.jsp HTTP/1.0\r\nHost: xxxx\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
server {
listen 8088;
server_name 10.10.204.150;
location = /smartbi/vision/gbk.jsp {
proxy_pass http://smartbi-static;
}
location ~ /smartbi/app/.* {
proxy_pass http://smartbi-static;
}
location ~ /smartbi/vision/ssreport/htmls/.* {
proxy_pass http://smartbi-dynamic;
}
location ~ /smartbi/vision/officehtmls/.* {
proxy_pass http://smartbi-dynamic;
}
location ~ /smartbi/vision/.*(\.bmp|\.css|\.cur|\.db|\.eot|\.gif|\.GIF|\.htm|\.html|\.ico|\.jpg|\.JPG|\.js|\.json|\.map|\.otf|\.patch|\.png|\.PNG|\.svg|\.swf|\.template|\.ts|\.ttf|\.ttfx|\.txt|\.woff|\.woff2|\.xls|\.xml|\.yml)$ {
proxy_pass http://smartbi-static;
}
location ~ /smartbi/smartbix/min/.* {
proxy_pass http://smartbi-static;
}
location ~ /smartbi/smartbix/static/.* {
proxy_pass http://smartbi-static;
}
location ~ /smartbi/.* {
proxy_pass http://smartbi-dynamic;
}
} |
测试验证
部署完成后,可以查看前端跟后端服务器的tomcat/logs/localhost_access_log的文件,查看请求分发是否正常。
请求类型 | 请求接口 |
---|---|
静态请求 | /smartbi/vision/gbk.jsp /smartbi/app/.* /smartbi/vision/.*(\.bmp|\.css|\.cur|\.db|\.eot|\.gif|\.GIF|\.htm|\.html|\.ico|\.jpg|\.JPG|\.js|\.json|\.map|\.otf|\.patch|\.png|\.PNG|\.svg|\.swf|\.template|\.ts|\.ttf|\.ttfx|\.txt|\.woff|\.woff2|\.xls|\.xml|\.yml) /smartbi/smartbix/min/.* /smartbi/smartbix/static/.* |
动态请求 | 除去以上的静态请求,剩下的都是动态请求。 |
Smartbi V11版本支持前后端分离部署。
如果需要安装介质,需要单独申请。简化模式部署,只需要动态,静态两个war包。
前后端分离部署简化模式架构图
如上图,部署前后端分离架构,需要用到nginx。通过nginx,把静态请求转发到smartbi的前端服务器(静态请求服务器),把动态请求转发到内网的后端服务器(动态请求服务器)。
部署说明
后端服务器部署
后端smartbi服务器部署,可以参考通用的smartbi部署文档操作。安装Smartbi(tomcat中间件)
需要配置知识库连接,license文件等。
如果项目有扩展包,也要在后端服务器部署。
其他的数据库的驱动,字体文件等,都只在后端服务器上更新。
前端服务器部署
只需要把static目录下的smartbi.war 部署到tomcat/webapps目录,然后启动tomcat即可。
前端的smartbi服务器,没有config页面,不需要配置license,知识库等信息。
前端服务器如果有独立扩展包,可以直接上传扩展包到tomcat/bin/exts目录。
nginx配置
前后端服务器部署成功后,需要配置nginx,对前后端的请求进行分发。
注意 | ||
---|---|---|
| ||
1、nginx的匹配规则是从上到下的,所以以下规则顺序不能颠倒。 2、如果动态服务器有多个smartbi节点,则动态请求的upstream需要配置会话保持功能。 3、如果使用nginx的check模块进行健康检测,必须使用/smartbi/vision/healthcheck.jsp 接口,不能使用静态资源接口做健康检测。 4、如果配置了黑白名单规则,健康检测的接口,必须在白名单中,不能在黑名单里面。 |
代码块 | ||
---|---|---|
| ||
upstream smartbi-static {
server 10.10.204.101:18080;
}
upstream smartbi-dynamic {
server 10.10.204.100:18080;
##会话保持配置,nginx默认不带这个功能,需要自行编译才能使用。
##不同的sticky模块,配置可能不同。需要参考具体的sticky模块配置说明。
##以下是tengine的会话保持配置示例
session_sticky cookie=smartbi_dynamic_cookie fallback=on path=/smartbi mode=insert option=indirect;
##健康检测配置。nginx默认不带这个功能,需要自行编译才能使用。
##不同的check模块,配置可能不同。需要参考具体的check模块的配置说明。
##以下是tengine的健康检测配置示例
check interval=3000 rise=2 fall=5 timeout=1000 type=http;
## customizeName 是在完全版部署的黑白名单规则配置文件 defenderConfig.json中定义的,具体可以查看 Smartbi前后端分离部署_完全版 里面的说明
check_http_send "HEAD /smartbi/vision/healthcheck.jsp HTTP/1.0\r\ncustomizeName: smartbi_header\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
server {
listen 8088;
server_name 10.10.204.150;
location = /smartbi/vision/gbk.jsp {
proxy_pass http://smartbi-static;
}
location ~ /smartbi/app/.* {
proxy_pass http://smartbi-static;
}
location ~ /smartbi/vision/ssreport/htmls/.* {
proxy_pass http://smartbi-dynamic;
}
location ~ /smartbi/vision/officehtmls/.* {
proxy_pass http://smartbi-dynamic;
}
location ~ /smartbi/vision/.*(\.bmp|\.css|\.cur|\.db|\.eot|\.gif|\.GIF|\.htm|\.html|\.ico|\.jpg|\.JPG|\.js|\.json|\.map|\.otf|\.patch|\.png|\.PNG|\.svg|\.swf|\.template|\.ts|\.ttf|\.ttfx|\.txt|\.woff|\.woff2|\.xls|\.xml|\.yml)$ {
proxy_pass http://smartbi-static;
}
location ~ /smartbi/smartbix/min/.* {
proxy_pass http://smartbi-static;
}
location ~ /smartbi/smartbix/static/.* {
proxy_pass http://smartbi-static;
}
location ~ /smartbi/.* {
proxy_pass http://smartbi-dynamic;
}
} |
测试验证
部署完成后,可以查看前端跟后端服务器的tomcat/logs/localhost_access_log的文件,查看请求分发是否正常。
...