首页 > 系统相关 >dremio nginx proxy 问题简单说明

dremio nginx proxy 问题简单说明

时间:2024-05-24 17:07:30浏览次数:18  
标签:dremio http nginx html proxy 9047 location

dremio ui 处理上部分直接依赖了location pathname 对于使用默认的/ 的proxy 是没有问题的,但是很多时候我们需要自己配置一个proxy path ,以下简单说明下问题,以及解决方法

环境准备

  • docker-compose
version: "3"
services:
  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
  dremio:
    image: dremio/dremio-oss:25.0
    volumes:
      - ./ui/dremio-dac-ui-25.0.0-202404051521110861-ed9515a8.jar:/opt/dremio/jars/dremio-dac-ui-25.0.0-202404051521110861-ed9515a8.jar
    ports:
      - 9047:9047
  • nginx.conf
    简单说明: 添加了vlake 路径,因为dremio 对于资源的处理使用了绝对路径,所以还配置了资源的proxy,还有api 接口的,因为重写了location 对于login 部分也进行了处理,确保使用的资源是dremio 的页面
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    gzip  on;
    real_ip_header     X-Forwarded-For;
    real_ip_recursive on;
    server {
        listen       80;
        server_name  localhost;
        charset utf-8;
        root /usr/share/nginx/html;
        location = /vlake/ {
           proxy_pass http://dremio:9047/index.html;
        }
         location = /vlake/index.html {
            proxy_pass http://dremio:9047;
        }
        location /login {
            proxy_pass http://dremio:9047/index.html;
        }
        location  ^~ /static/ {
             proxy_pass http://dremio:9047;
        }
        location /manifest.webmanifest  {
            return 200;
        }
        location /apiv2/ {
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection upgrade;
            proxy_pass http://dremio:9047/apiv2/;
        }
        location /api/v3/ {
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection upgrade;
            proxy_pass http://dremio:9047/api/v3/;
        }
 
        location ^~ /jobs/ {
            proxy_pass http://dremio:9047/index.html;
        }
 
        # location ^~ /vlake/new_query/ {
        #     rewrite ^/(.*)/$ /vlake/$1/index.html break;
        #     proxy_pass http://dremio:9047;
        # }
 
        # location ^~ /new_query/ {
        #     rewrite ^/(.*)/$ /vlake/$1/index.html break;
        #     proxy_pass http://dremio:9047;
        # }
        location ^~ /vs/ {
            proxy_pass http://dremio:9047/vs/;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}
  • ui 部分处理
    修改了index.html 进行history.pushState 处理改写location
 <script >
      history.pushState({}, 'default', '/');
    </script>
  </body>
</html>

内部说明

以上设计已经简单说明了下,dremio 在处理部分ui 查询的时候直接使用了location (实际上不是很好,应该是基于参数)造成自定义path 就会有路径处理上的问题

  • performLoadDataset 中loadDataset 的处理
    此处就依赖了path,如果添加了其他路径解析上就不对了
const loc = rmProjectBase(location.pathname);
    const pathnameParts = loc.split("/");
    const parentFullPath = decodeURIComponent(
      constructFullPath([pathnameParts[2]]) + "." + pathnameParts[3]
    );
 
    let customReference = {};
  • 临时解决方法
    可以通过修改index.html 对于history.pushState 进行重写,这样url 地址会变为dremio 默认的root 模式,同时不会进行页面刷新(实际上是触发页面的请求)
    参考修改,可以结合ui 部分,为了方便使用了jar 修改工具,而不是重新编译

访问效果

  • 打开

    http://localhost/vlake/
    会有进行一次登陆的重定向操作,后续的操作都是基于静态资源的以及proxy 的接口的处理,实际可以自己参考我github 的部署进行体验

说明

以上方案,比较适合的标准版的dremio,对于其他进行了ui修改的不能保障

参考资料

dac/ui/src/sagas/performLoadDataset.js
https://github.com/rongfengliang/nginx-dremio-proxy

标签:dremio,http,nginx,html,proxy,9047,location
From: https://www.cnblogs.com/rongfengliang/p/18211309

相关文章

  • Nginx的配置文件
    Nginx的配置文件是其核心组件之一,它决定了Nginx服务器的行为和功能。以下是关于Nginx配置文件的重点解说:1.配置文件的位置和名称Nginx的配置文件通常命名为nginx.conf,并且位于Nginx安装目录的conf或config文件夹中。在Linux系统上,常见的位置是/etc/nginx/nginx.conf或/usr/l......
  • nginx常用操作
    安装nginxsudoaptupdatesudoaptinstallnginxwhereisnginxsudosystemctlstartnginx(新版Ubuntu20.**)sudoservicenginxstart(旧版Ubuntu16.**)克隆工程后buildnpminstall安装所有包npmrunbuild打包/usr/share/nginx/html#网站的工程文件存在此目......
  • 编译安装nginx 1.26.0、openssl 3.0.13 常见报错
    报错1[[email protected]]#./config--prefix=/usr/local/openssl--openssldir=/usr/local/opensslsharedCan'tlocateIPC/Cmd.pmin@INC(@INCcontains:/root/nginx-install/openssl-3.0.13/util/perl/usr/local/lib64/perl5/usr/lo......
  • 新版本的禅道在使用 nginx 做 https 反向代理时,无法正常安装、升级以及登录
    是想从docker的12.5.3版本升级到16.0版本,但是按步骤升级完成后,发现会卡在一个“禅道开源版15版本升级”的介绍页面无限循环直接部署全新的系统,也会卡在配置数据库连接的页面无限循环而且在容器的日志中,会有一条ERROR1045(28000):Accessdeniedforuser'root'@'loca......
  • Nginx中root和alias的区别
    nginx中的root的使用方式定义: root 指令用于设置服务器上的根目录,从这个根目录开始,Nginx会根据请求的URI拼接路径来寻找文件。使用方式:root 指令通常在 server 块或 location 块中使用。路径:root 所指定的路径会与 location 块中的URI一起构成文件系统路径。......
  • Nginx限制单独iP单位时间内请求次数
    http{#限速区域设置,一个IP1次请求/每秒limit_req_zone$binary_remote_addrzone=dynamic:10mrate=1r/s;server{#动态请求的限速规则location/{#动态请求的限速规则,突发请求最高5个limit_reqzone=dynamicburst=5nodelay......
  • CentOS 7 安装 nginx-rtmp
    一、安装依赖库1.gcc$gcc-vUsingbuilt-inspecs.COLLECT_GCC=gcc......Threadmodel:posixgccversion4.8.520150623(RedHat4.8.5-44)(GCC)#未安装:yuminstall-ygccgcc-c++2.pcre$rpm-qapcrepcre-8.32-17.el7.x86_64#未安装:yuminstall-y......
  • nginx打印所有配置内容
    nginx-T#打印输出所有的配置内容,含配置文件名称这些是NGINX命令行工具的选项及其说明-?,-h:显示帮助信息-v:显示版本信息并退出-V:显示版本信息和配置选项,然后退出-t:测试配置并退出-T:测试配置,将其打印出来,然后退出-q:在配置测试期间抑制非错误消息-ssignal:向主进程发送......
  • nginx配置
    #默认的服务器块,用于阻止未匹配的HTTPS请求本地生成证书opensslreq-x509-nodes-days365-newkeyrsa:2048-keyout/etc/nginx/ssl/default.key-out/etc/nginx/ssl/default.crt#防止别人输入其他没有配置ssl的域名,跳到其他server上server{listen443default_s......
  • Nginx location配置
    Nginxlocation配置参考:Nginx配置文件中location介绍https://blog.csdn.net/m0_74412260/article/details/131030731Nginxlocation配置https://zhuanlan.zhihu.com/p/377954223Nginx之location详解https://cloud.tencent.com/developer/article/1562432路径匹配=开......