Linux之Nignx及负载均衡动静分离

news2024/10/6 15:25:49

 


🎉🎉欢迎来到我的CSDN主页!🎉🎉

🏅我是君易--鑨,一个在CSDN分享笔记的博主。📚📚

🌟推荐给大家我的博客专栏《LInux实战开发》。🎯🎯

🎁如果感觉还不错的话请给我关注加三连吧!🎁🎁

💖期待你的加入,一起学习,一起进步!💖💖

前言

        在上一期的博客中我与各位老铁带来了有关Linux系统安装配置项目环境,内容有:jdk、tomcat服务器、mysql数据库等等,以及如何去部署我们的会议OA项目和前后端分离项目的后端接口,最后还和大家分享了该如何去使用两个不同的端口号去访问不同的项目。今天的这期博客基于上期的博客,完成前后端项目的部署,以及Nignx的知识了解及使用。


一、Nignx的简介

1. 基本概述

        Nginx(发音为"engine x")是一个开源的高性能Web服务器反向代理服务器。它具有轻量级和高并发处理能力,被广泛用于构建高性能的网站和应用程序。

        Nginx通常用作HTTP服务器,可以处理静态文件、索引文件和自动索引。它也可以作为反向代理服务器,用于负载均衡、HTTP缓存、访问控制和安全防护等功能。

        与传统的Web服务器相比,Nginx的设计重点在于高并发连接的处理能力,以及低内存使用和高响应速度。这使得Nginx成为处理大量并发请求的理想选择,特别适合用于性能要求较高的网站和应用程序。

        Nginx还支持各种功能扩展和模块化,可以通过第三方模块来实现额外的功能,如HTTP缓存、SSL/TLS加密、反向代理、日志处理等。这种灵活性使得Nginx广泛应用于不同的场景,包括高负载的网站、内容分发网络(CDN)、应用程序服务器和微服务架构等。

2.  Nignx的应用场景

常见的应用场景
应用场景说明
静态文件服务Nginx能够高效地提供静态文件(如HTML、CSS、JavaScript、图像等)的传输,适用于搭建文件服务器或静态网站。
反向代理服务器Nginx经常被用作反向代理服务器,将客户端请求转发给后端的应用服务器处理。它可以实现负载均衡、缓存静态内容、提供SSL/TLS加密等功能,提升服务性能和安全性。
负载均衡Nginx作为负载均衡器可以将客户端请求分发到多个后端服务器,平均分担服务器负载,提高系统的可用性和可扩展性。
后端应用服务器Nginx可以作为应用服务器,处理动态请求(如PHP、Node.js)或者与后端服务(如数据库、缓存服务器)进行交互,提供高性能的动态内容服务。
内容分发网络(CDN)Nginx可以与CDN配合使用,加速静态内容的分发,降低带宽压力,提高用户访问速度。
WebSocket应用Nginx可以代理和负载均衡WebSocket请求,适用于实时通信和即时通讯应用。
安全防护Nginx具备一些安全防护功能,如反爬虫限制、请求频率限制、黑白名单过滤等,可以增强Web应用的安全性。

        Nginx实际上非常灵活,可以根据需求进行定制配置和扩展。无论是中小型网站、高流量网站,还是复杂的微服务架构,Nginx都是一个强大的工具

 3. 代理服务器的原理

        Nginx代理服务器的原理主要是基于反向代理。反向代理服务器位于客户端和目标服务器之间,代替目标服务器接收客户端的请求,并向目标服务器转发请求,从而使得客户端能够访问目标服务器的资源。

        具体来说,当客户端发送一个HTTP请求到反向代理服务器时,反向代理服务器会先解析这个请求,然后根据请求中的目标地址和端口号,将请求转发到目标服务器。目标服务器处理请求并返回响应给反向代理服务器,反向代理服务器再将响应转发给客户端。在整个过程中,客户端与反向代理服务器之间的通信是透明的,客户端不需要知道目标服务器的存在。

        Nginx作为反向代理服务器,可以配置多个监听地址和端口,以便为不同的客户端提供代理服务。同时,Nginx还支持负载均衡、安全防护等高级功能,可以有效地提高系统的性能和安全性。

简易图解 

二、安装Nignx

        在之前的博客中我们已经将Nignx的安装包导入到了我们的文件夹中

 1. 下载Nignx所需的依赖

指令:yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

2. 解压安装包

指令:tar -xvf nginx-1.13.7.tar.gz

解压之后会对应的生成一个文件夹

3.配置及安装Nignx

相关指令:

  1. ./configure --with-http_stub_status_module --with-http_ssl_module  --->编译,执行配置: 考虑到后续安装ssl证书 添加两个模块(需要进到nignx的文件夹中运行)
  2. make && make install    ---->安装Nignx  (需要进到nignx的文件夹中运行)

 配置

 安装

三、Nignx的使用

1. 基础使用

        启动Nignx服务需要我们进入到nignx安装好的 /usr/local/nginx/sbin目录下输入相关的指令。

指令:

  1. ./nginx    ------>启动
  2. ./nginx -s reload      -------->重新启动
  3. ./nginx -s stop      --------->关闭
  4. ./nginx -c /usr/local/nginx/conf/nginx.conf    ------->或者,指定配置文件启动

2. 其他指令的使用

2.1 验证Nignx是否启动

        首先我们先要安装lsof的相关指令文件,方便我们后续调用使用。

指令:

  1. yum install -y lsof    ----->下载lsof指令文件

        当我们下载完lsof后我们在输入指定的指令去检验是否运行Nginx

指令:lsof -i:80    ---->查看Nginx的当前状态

         此时我们的主机网页时访问不到我们的Nginx,因为在防火墙那我们并没有去开设一个端口供我们的Nginx去使用,因此区开设一个防火墙端口号。

指令:

  1.  firewall-cmd --zone=public --add-port=80/tcp --permanent   ---->开设端口号
  2. firewall-cmd --reload && firewall-cmd --list-port ----->刷新并查看防火墙状态和端口信息
  3. systemctl start nginx.service   ---->设置开机自启动Nignx
  4. systemctl enable nginx.service  ----->设置开机不自启动Nignx

        然后再在我们主机的网页去访问Nignx。 (以下是访问成功的案例)

2.2 实现负载均衡

图示

        实现负载均衡首先我们要在创建一个文件夹存放tomcat服务器,或者赋值一个原有的tomcat服务器文件夹取一个别名,将复制后的文件中的项目文件删除掉保证是一个全新的服务器。然后还要在防火墙开设一个端口提供给新服务器使用访问。(我采取的是重新导入一个新的tomcat安装包进行解压)        

        首先将压缩包进行压缩配置。

涉及指令:

  1.  tar -xvf apache-tomcat-8.5.20-nignx.tar.gz  ----->解压压缩包
  2. 整理服务器的内容,修改server.xml的端口号

  3.  

 新建服务器

 修改server.xml中的端口号

        在server.xml文件中修改端口号,每一个端口号都修改一下,防止重复。

 server.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8006" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8081" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation. The default
         SSLImplementation will depend on the presence of the APR/native
         library and the useOpenSSL attribute of the
         AprLifecycleListener.
         Either JSSE or OpenSSL style configuration may be used regardless of
         the SSLImplementation selected. JSSE style configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
         This connector uses the APR/native implementation which always uses
         OpenSSL for TLS.
         Either JSSE or OpenSSL style configuration may be used. OpenSSL style
         configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                         certificateFile="conf/localhost-rsa-cert.pem"
                         certificateChainFile="conf/localhost-rsa-chain.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>

 开设防火墙端口并主机成功访问

四、Nginx配置

        在nginx文件下conf文件的nginx.conf中进行配置,将下述代码添加到文件里面

#服务器的集群
    upstream  tomcat_list {  #服务器集群名字
        server    127.0.0.1:8080  weight=1;   #服务器1   weight是权重的意思,权重越大,分配的概率越大。
        server    172.17.0.4:8080  weight=2; #服务器2   weight是权重的意思,权重越大,分配的概率越大
    } 

         配置完Nginx的nginx.conf文件后需要重新启动Nginx服务方可生效。

指令:./nginx -s reload ------>重启Nginx服务

五、 前端部署

1. 准备工作

前端项目打包之前需要增加以下的设置

在前端项目中 config文件下的index.js中要增加以下代码 : 

 assetsPublicPath: './',//修改后

如图: 

在前端项目中 build文件下的 utils.js 中增加以下代码 : 


 // 解决icon路径加载错误
        publicPath:'../../'

如图: 

在前端项目的跟目录中,cmd打开命令窗口

输入命令 : npm run build   ( 进行前端项目打包 )

如图 : 

2.部署

在 /usr/local/ 目录下创建一个文件夹,为mypor ,并且进入文件夹,之后将dist文件拖入mypor文件夹中,因为我们的项目文件的的后缀名为.zip所以不能为使用tar进行解压,需要下载unzip进行项目解压

指令:yum install -y unzip

将该文件进行解压 

输入命令 : unzip dist.zip,然后在配置nginx.conf文件


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


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"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;


    #服务器的集群
    upstream  tomcat_list {  #服务器集群名字
        server    127.0.0.1:8080  weight=1;   #服务器1   weight是权重的意思,权重越大,分配的概率越大。
        #server    172.17.0.4:8080  weight=2; #服务器2   weight是权重的意思,权重越大,分配的概率越大
    } 

    server {
        listen       80;            #监听80端口,可以改成其他端口
        #server_name  localhost;    #当前服务的域名
	server_name  www.zking.com; #当前服务的域名(虚拟域名也可以)
	root         html/crm;      #将要访问的网站的根目录,nginx节点会自动继承父节点的配置

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

	location / {
	        #该句代码是为解决history路由不能跳转的问题,在vue-router官网有介绍 
		try_files $uri $uri/  /index.html;
	}
	location  ^~/api/ {
		#^~/api/表示匹配前缀是api的请求,proxy_pass的结尾有/, 则会把/api/*后面的路径直接拼接到后面,即移除api
		proxy_pass http://tomcat_list/;
	}
        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

输入命令 : cd /usr/local/nginx/sbin/  进入到文件目录下,然后输入命令 :./nginx -s reload   重启nginx服务,在将后端的war包 传入tomcat服务器中。并且输入命令 :   ./startup.sh    (开启访问)

 

在浏览器中进行访问 使用虚拟机的IP加tomcat的端口进行访问项目

 

 这里会考虑到网址域名的问题,需要在到文件资源管理器中进入到 以下本地目录

C:\Windows\System32\drivers\etc找到 hosts 文件进行修改IP的请求修改对应的端口号的域名即可。

本期的博客分享到此结束,三连加关注支持博客一下呗 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1178601.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

这可能是全网最晚的低代码技术总结

低代码的发展一向结伴着质疑前行&#xff0c;一些人认为低代码平台限制了开发人员的创新能力&#xff0c;使得开发过程变得过于简单&#xff0c;缺乏深度的定制和灵活性。他们担心&#xff0c;低代码平台可能只适合于简单的应用程序&#xff0c;无法满足复杂业务需求。另一面&a…

Android codec2 视频框架 之应用

文章目录 应用流程外部主动获取输入和输出buffer外部设置回调 内部流程 应用流程 外部主动获取输入和输出buffer 解码的调用流程&#xff0c;以android原生的一个bin来说明 android 原生代码位置&#xff1a; frameworks/av/cmds/stagefright/codec.cpp frameworks/av/cmds/st…

在Windows 10中共享打印机,以便其他用户可以访问,发挥打印机的最大作用

知道如何在Windows 10中共享打印机是非常宝贵的。如果没有打印机共享&#xff0c;多个用户从单个设备进行所有打印的唯一方法就是手动连接自己的计算机。在本指南中&#xff0c;我们将向你展示一种更简单的方法。 通过网络共享打印机&#xff0c;只需连接一台PC或笔记本电脑。…

svn使用图形化界面从trunk目录下创建下的分支

1、svn目录 要从trunk目录右键创建一个新的目录出来。Branch/tag下创建&#xff1a; 然后源目录和提交目录的编写&#xff1a; 这样新的分支目录chuanqi_4就创建好了。要注意:这样创建要确保目标目录在svn目录下不存在。

ROS中MPC局部路径规划器使用方法及源码流程解读

本文主要介绍ROS中Navigation导航框架中MPC局部路径规划器mpc_local_planner的使用方法&#xff0c;并对源码进行解读&#xff0c;梳理其规划流程等&#xff0c;具体包含MPC模型预测控制算法简介、mpc_local_planner使用方法、mpc_local_planner源码解读与规划流程梳理三部分内…

微信小游戏软件开发手机微信休闲游戏

当今&#xff0c;微信已经成为了中国最受欢迎的社交媒体平台之一&#xff0c;拥有数亿活跃用户。随着微信的不断发展&#xff0c;微信小游戏成为了一个热门的应用领域&#xff0c;吸引了许多开发者和玩家。微信小游戏是一种小型游戏&#xff0c;可以直接在微信内嵌入和玩&#…

【JavaEE初阶】 TCP服务器与客户端的搭建

文章目录 &#x1f332;前言&#x1f334;ServerSocket API&#x1f384;Socket API&#x1f340;TCP中的长短连接&#x1f38d;建立TCP回显客户端与服务器&#x1f6a9;TCP搭建服务器&#x1f6a9;TCP搭建客户端&#x1f6a9;通信过程展示&#xff1a; &#x1f333;多个客户端…

offsetof宏的使用、模拟实现及 (size_t)(((struct_type*)0)->mem_name)的解释

宏原型&#xff1a;offsetof(type,member) 作用&#xff1a;返回数据结构或联合体类型中成员的偏移量&#xff0c;以字节为单位 返回值&#xff1a;size_t类型的无符号整数 使用案例&#xff1a; #include <stdio.h> #include <stddef.h> struct foo {ch…

爬取东方财富股票信息

爬取股票信息 爬虫爬取信息&#xff0c;一般有两种大的思路&#xff0c;分别是&#xff1a; 模拟header信息&#xff0c;发送请求&#xff0c;得到相应的数据&#xff08;html文件 或者 json数据&#xff09;使用selenium模拟打开浏览器&#xff0c;然后利用selenium提供的函…

高防CDN:企业网络安全的坚强后盾

随着互联网的快速发展&#xff0c;企业的网络面临着越来越多的安全威胁。在这种背景下&#xff0c;高防CDN&#xff08;Content Delivery Network&#xff09;已经成为了企业网络安全的坚强后盾。本文将理性分析高防CDN对于企业发展的影响&#xff0c;强调其在维护网络稳定性、…

内核态内存映射

内核态的内存映射机制&#xff0c;主要包含以下几个部分&#xff1a; 内核态内存映射函数 vmalloc、kmap_atomic 是如何工作的&#xff1b;内核态页表是放在哪里的&#xff0c;如何工作的&#xff1f;swapper_pg_dir 是怎么回事&#xff1b;出现了内核态缺页异常应该怎么办&am…

MySQL(10):创建和管理表

基础知识 在 MySQL 中&#xff0c;一个完整的数据存储过程总共有 4 步&#xff0c;分别是&#xff1a;创建数据库、确认字段、创建数据表、插入数据。 要先创建一个数据库&#xff0c;而不是直接创建数据表&#xff1a;从系统架构的层次上看&#xff0c;MySQL 数据库系统从大到…

Android 10.0 SystemUI启动流程

1、手机开机后&#xff0c;Android系统首先会创建一个Zygote&#xff08;核心进程&#xff09;。 2、由Zygote启动SystemServer。 3、SystemServer会启动系统运行所需的众多核心服务和普通服务、以及一些应用及数据。例如&#xff1a;SystemUI 启动就是从 SystemServer 里启动的…

浅谈前端自定义VectorGrid矢量瓦片样式

目录 前言 一、VectorGrid相关API介绍 1、VectorGrid 2、 LayerStyles样式详解 二、样式自动配置 1、页面定义 2、地图及PBF瓦片引入 3、矢量瓦片样式定义 4、鼠标事件交互 三、最终效果 1、自定义样式展示 2、鼠标交互 总结 前言 在上一篇博客中&#xff0c;详细讲…

`rest-client`库

rest-client是一个在Ruby编程语言中用于发送HTTP请求的库。它提供了简单且易于使用的接口&#xff0c;用于发送GET、POST、PUT、DELETE等各种类型的HTTP请求&#xff0c;并处理响应。 以下是rest-client库的一些常见用法示例&#xff1a; 发送GET请求&#xff1a; require ‘…

《算法通关村—轻松搞定合并二叉树》

《算法通关村—轻松搞定合并二叉树》 描述 leetcode 617 给你两棵二叉树&#xff1a; root1 和 root2 。 想象一下&#xff0c;当你将其中一棵覆盖到另一棵之上时&#xff0c;两棵树上的一些节点将会重叠&#xff08;而另一些不会&#xff09;。你需要将这两棵树合并成一棵…

【网络知识必知必会】聊聊数据链路层以太网

文章目录 前言1. 认识以太网2. 以太网帧格式已经有了ip地址, 为什么还要有 mac 地址呢?认识MTUMTU对IP协议的影响MTU对UDP协议的影响MTU对于TCP协议的影响 总结 前言 本文继续来聊聊网络传输中数据链路层中的一个代表协议, 以太网. 以太这个词其实最早出现在物理学当中, 在早…

前端工程化(vue2)

一、环境准备 1.依赖环境&#xff1a;NodeJS 官网&#xff1a;Node.js 2.脚手架&#xff1a;Vue-cli 参考网址&#xff1a;安装 | Vue CLI 介绍&#xff1a;Vue-cli用于快速的生成一个Vue的项目模板。主要功能有&#xff1a;统一的目录结构&#xff0c;本地调试&#xff0…

麒麟系统查看磁盘UUID方法

通过查看 /dev/disk/by-uuid/ 目录下的软连接确定磁盘UUID ls -l /dev/disk/by-uuid/ 命令输出入下图所示&#xff0c;红框中即为磁盘UUID号 通过 blkid 命令查看系统中某块磁盘的uuid 号 blkid 命令输出如下图所示&#xff0c;UUID”” 中即为磁盘UUID号 开机自动…

五:ffmpe主要参数的使用

目录 一&#xff1a;回顾一下主要参数 二&#xff1a;使用主要参数操作视频 1、-i 输入流的使用 2、-i 配合 输出流-f使用 三、使用-ss开始时间进行转换 四、使用-t参数&#xff0c;设置转换的时长 一&#xff1a;回顾一下主要参数 -i 设定输入流。 支持本地和网络流 -f …