1. 概述编辑
1.1 功能介绍
从 2020-01-15 的版本起,FineBI 推出了 Web 集群 &BI 单节点的应用方案,该方案不需要 Spider 多节点支持,仅需部署 BI 的 Web 集群,并规定好主节点,BI 的数据更新和所有 BI 相关请求都会在这个主节点完成,其余 FR 或者管理系统的请求会随机转发到集群节点上面。
1.2 部署方案
该部署方案在部署好 Web 集群的基础上,在 BI 的配置文件中规定好主节点,并配置 Nginx 中的主次节点。
1.3 前提条件
已按照 Web集群 文档部署好集群环境;
2. 部署方案编辑
以集群两个节点,192.168.5.12 为主节点,192.168.5.11 为子节点,负载均衡地址是 192.168.5.11 的 Nginx 配置演示部署方案,可以根据实际场景进行修改。
2.1 配置主节点
1)关闭 Web 集群,在外置数据库中找到 FINE_CONF_ENTITY 表,并在其中增加一条 ID 记录:SystemOptimizationConfig.biClusterMasterNodeHostName,用来规定 Web 集群中的主节点,value 对应主节点服务器的 hostname。比如主节点服务器为 192.168.5.12 ,其对应 hostname 为 test02 ,则在表中增加的记录如下图所示:
2)此处主节点的服务器中,需要确保在/etc/hosts文件中,已经配置好 IP 和 hostname 的对应关系,如下图所示:
2.2 配置 Nginx
1)进入 Nginx 安装目录/usr/nginx/conf,打开 nginx.conf 文件,复制如下内容并修改其中的 IP 和端口,替换掉原文件内容。如下代码所示:
worker_processes auto;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" $upstream_addr';
access_log logs/access.log main;
sendfile on;
keepalive_timeout 65s;
types_hash_max_size 2048;
client_header_buffer_size 512k;
large_client_header_buffers 4 512k;
client_max_body_size 100M;
upstream BI.main.com {
server 192.168.5.12:9080 max_fails=15 fail_timeout=300s;
}
upstream BI.cluster.com {
server 192.168.5.11:9080 max_fails=15 fail_timeout=300s;
server 192.168.5.12:9080 max_fails=15 fail_timeout=300s;
}
upstream WBS.com {
server 192.168.5.11:48888 max_fails=15 fail_timeout=300s;
server 192.168.5.12:48888 max_fails=15 fail_timeout=300s;
ip_hash;
}
server {
listen 80;
server_name 192.168.5.11;
underscores_in_headers on;
location ~*/decision/v5/conf/ {
proxy_http_version 1.1;
proxy_pass http://BI.main.com;
proxy_next_upstream http_500 http_502 http_503 http_504 http_403 http_404 http_429 error timeout invalid_header non_idempotent;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "";
proxy_connect_timeout 20;
proxy_read_timeout 1000;
proxy_send_timeout 300;
proxy_buffer_size 64k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
}
location ~*/decision/v5/design/ {
proxy_http_version 1.1;
proxy_pass http://BI.main.com;
proxy_next_upstream http_500 http_502 http_503 http_504 http_403 http_404 http_429 error timeout invalid_header non_idempotent;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "";
proxy_connect_timeout 20;
proxy_read_timeout 1000;
proxy_send_timeout 300;
proxy_buffer_size 64k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
}
location ~*/decision/file {
proxy_http_version 1.1;
proxy_pass http://BI.cluster.com;
proxy_next_upstream http_500 http_502 http_503 http_504 http_403 http_404 http_429 error timeout invalid_header non_idempotent;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "";
proxy_connect_timeout 20;
proxy_read_timeout 1000;
proxy_send_timeout 300;
proxy_buffer_size 64k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
if ($query_string ~ "TextGenerator") {
proxy_pass http://BI.main.com;
}
}
location ~*/decision/v10/bi/package/field/ {
proxy_http_version 1.1;
proxy_pass http://BI.main.com;
proxy_next_upstream http_500 http_502 http_503 http_504 http_403 http_404 http_429 error timeout invalid_header non_idempotent;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "";
proxy_connect_timeout 20;
proxy_read_timeout 1000;
proxy_send_timeout 300;
}
location ~*/decision/v10/entry/access/ {
if ($arg_dashboardType=4){
}
proxy_http_version 1.1;
proxy_pass http://BI.main.com;
proxy_next_upstream http_500 http_502 http_503 http_504 http_403 http_404 http_429 error timeout invalid_header non_idempotent;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "";
proxy_connect_timeout 20;
proxy_read_timeout 1000;
proxy_send_timeout 300;
proxy_buffer_size 64k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
}
location / {
proxy_http_version 1.1;
proxy_pass http://BI.cluster.com;
proxy_next_upstream http_500 http_502 http_503 http_504 http_403 http_404 http_429 error timeout invalid_header non_idempotent;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Connection "";
proxy_connect_timeout 20;
proxy_read_timeout 1000;
proxy_send_timeout 300;
proxy_buffer_size 64k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
#FineReport:38889 FineBI:48889
listen 48889;
server_name 192.168.5.11;
location / {
proxy_http_version 1.1;
proxy_pass http://WBS.com;
proxy_connect_timeout 60;
proxy_read_timeout 120;
proxy_send_timeout 120;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
注:IP、port 需要修改为自身环境对应的 IP 和端口,详细的配置参数说明可参考 nginx.conf 配置手册 ,增加了集群主节点的配置。修改后保存该配置。
2)启动 Web 集群,即部署完成。
3. 注意事项编辑
3.1 问题描述
若同时使用 FineReport 和 FineBI ,且 Tomcat 版本为 8.0.23,FR 目录上挂出的 BI 模板打开显示空白。
3.2 解决方案
1)升级 Tomcat 版本到 8.5。
2)进入 Nginx 安装目录/usr/nginx/conf,打开 nginx.conf 文件,在以下位置加上proxy_http_version 1.1;,如下图所示: