nginx学习(3)

Nginx 负载均衡 实战案例

实现效果
浏览器地址栏输入地址 http://172.31.0.99/oa/a.html,负载均衡效果,平均 8083 和 8084 端口中

一、配置

1、先创建2个文件夹,并将apache-tomcat-8.5.87解压到tomcat8083和tomcat8084中

(或者复制一份tomcat8081中的/apache-tomcat-8.5.87到这两个文件中)

[root@oa tools]# mkdir tomcat8083
[root@oa tools]# mkdir tomcat8084

在这里插入图片描述

[root@oa tools]# cp -r /tools/tomcat8081/apache-tomcat-8.5.87 tomcat8083
[root@oa tools]# cp -r /tools/tomcat8081/apache-tomcat-8.5.87 tomcat8084

2、修改Tomcat配置文件

tomcat8083

2、将tomcat8083中的server.xml内容修改后如下:
在这里插入图片描述

2.1、修改server 的默认端口,由默认8005->8093
在这里插入图片描述

2.2、修改http协议的默认端口,由默认的8080->8083
在这里插入图片描述

2.3修改默认ajp协议的默认端口,由默认的8009->9003
在这里插入图片描述

最终修改文件:

<?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="8093" 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 8083
    -->
    <Connector port="8083" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8445" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8083" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8445" />
    -->
    <!-- Define an SSL/TLS HTTP/1.1 Connector on port 8445
         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="8445" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define an SSL/TLS HTTP/1.1 Connector on port 8445 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="8445" 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 9003 -->
    <!--
    <Connector protocol="AJP/1.3"
               address="::1"
               port="9003"
               redirectPort="8445" />
    -->

    <!-- 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>

tomcat8084

tomcat4也是和tomcat3,修改相同的文职,变成不同的端口就行,可以看我最终修改的一下文件,就是修改成别的端口就行。

<?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="8094" 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 8084
    -->
    <Connector port="8084" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8445" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8084" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8445" />
    -->
    <!-- Define an SSL/TLS HTTP/1.1 Connector on port 8445
         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="8445" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define an SSL/TLS HTTP/1.1 Connector on port 8445 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="8445" 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 9004 -->
    <!--
    <Connector protocol="AJP/1.3"
               address="::1"
               port="9004"
               redirectPort="8445" />
    -->

    <!-- 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>

二、创建项目文件夹

tomcat8083

1、在/tools/tomcat8083/apache-tomcat-8.5.87/webapps,创建一个oa的文件夹
在这里插入图片描述
2、并在oa 的文件夹中,建立一个a.html文件,内容如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>NGINX 负载均衡Tomcat3</h1>
</body>
</html>

tomcat8084

1、在/tools/tomcat8084/apache-tomcat-8.5.87/webapps,创建一个oa的文件夹
在这里插入图片描述
2、并在oa 的文件夹中,建立一个a.html文件,内容如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>NGINX 负载均衡Tomcat4</h1>
</body>
</html>

三、启动Tomcatcat

1、启动tomcat8083

[root@oa tomcat8083]# cd /tools/tomcat8083/apache-tomcat-8.5.87/bin
[root@oa bin]# ./startup.sh 

在这里插入图片描述

2、启动tomcat8084

[root@oa tomcat8083]# cd /tools/tomcat8084/apache-tomcat-8.5.87/bin
[root@oa bin]# ./startup.sh

在这里插入图片描述

三、配置NGINX

/usr/local/nginx/sbin

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

这8个Wireshark使用技巧,一看就会!

今天就给你分享8个常用的Wireshark使用技巧&#xff0c;一看就会。如果是处理 HTTP&#xff0c;HTTPS 大家还是用还是用 Fiddler&#xff0c;但如果是其他协议比如 TCP&#xff0c;UDP&#xff0c;还是用wireshark。 今天给你准备了wireshark和Fiddler的安装包给你&#xff0c…

湖科大计网:传输层

一、传输层概述 一、基本概念 传输层是端到端的协议。 因特网的两种不同的传输层协议&#xff1a; TCP&#xff1a;面向连接 UDP&#xff1a;无连接 我们在学习的过程中&#xff0c;只需要关注传输层之间的通信&#xff0c;不需要关注传输层协议数据是经过路由器转发至目的网络…

Python中用requests时遇到的错误警告解决方案

最近&#xff0c;我在Python 2.7.6&#xff08;Ubuntu 14.04.2 LTS&#xff09;环境中将requests库的版本从2.5.3升级到2.6.0&#xff0c;却遇到了’A true SSLContext object is not available’警告。每当我在Python 2.7.6环境中尝试使用requests库访问’github’时&#xff…

UDS寻址:物理寻址和功能寻址

ISO 15765-2中定义&#xff1a; 0x7DF通常是功能寻址请求。还有另外一组物理寻址的请求和响应。 ID 29bit的 低16 bit是TA和SA。高bit是车厂定义的。 功能寻址一般是18DBFFxx。物理寻址一般18DAxxxx。过滤还可以设置严格一点。

中小企业怎么实现数字化转型?有什么实用的工单管理系统?

当前&#xff0c;世界经济数字化转型已是大势所趋。在这个数字化转型的大潮中&#xff0c;如果企业仍然逆水而行&#xff0c;不随大流&#xff0c;那么&#xff0c;企业将有可能会被抛弃&#xff0c;被对手超越&#xff0c;甚至被市场边缘化&#xff0c;导致最终的结果是&#…

npm install 下载不下来依赖解决方案

背景 最近在构建 前端自动化部署 的方案中发现了一个问题&#xff0c;就是我在npm install的时候&#xff0c;有时候成功&#xff0c;有时候不成功&#xff0c;而且什么代码也没发生更改&#xff0c;报错也就是那么几个错&#xff0c;所以在此也整理了一下遇到这种情况&#xf…

Springcloud可视化物联网智慧工地云SaaS平台源码 支持二开和私有化部署

智慧工地平台围绕建筑施工人、物、事的安全管理为核心&#xff0c;对应研发了劳务实名制、视频监控、扬尘监测、起重机械安全监测、安全帽监测等功能一体化管理的解决方案。 智慧工地是聚焦工程施工现场&#xff0c;紧紧围绕人、机、料、法、环等关键要素&#xff0c;综合运用物…

这5款好用的app,能让你生活质量和效率飙升

随着科技的进步和智能手机的普及&#xff0c;不少好用的手机APP出现让我们的生活更加便捷&#xff0c;也提升了我们的生活质量&#xff0c;带给我们不少惊喜。接下来&#xff0c;让我们一起探索这5款实用APP&#xff0c;看看有没有适合你的&#xff01; 1、粉笔 一款专门备考…

外贸自建站什么意思?自建独立网站的好处?

外贸自建站的含义是什么&#xff1f;如何区分自建站和独立站&#xff1f; 随着全球贸易的不断发展&#xff0c;越来越多的企业开始关注外贸自建站。那么&#xff0c;“外贸自建站”到底是什么意思呢&#xff1f;海洋建站将为您详细解析这个问题&#xff0c;带您深入了解这一新…

如何简单挖掘公益SRC?

目录 1、寻找漏洞 1)谷歌语法 2)fofa 2、挖掘漏洞 3、提交报告 第一步&#xff1a;“标题”和“厂商信息”和“所属域名” 第二步&#xff1a;其它内容 第三步&#xff1a;复现步骤 0、IP域名归属证明 1、漏洞页 2、该干啥 3、注入的结果 4、上榜吉时 时间&#x…

优步让一切人工智能化

优步(Uber)的商业模式建立在对数据的颠覆性使用上--通过将双方智能手机的位置数据关联起来&#xff0c;将出租车司机与乘客配对。这意味着&#xff0c;它可以比传统出租车公司更快地安排司机去接乘客&#xff0c;极大地冲击了传统出租车公司的业务。 优步自成立以来&#xff0…

Linux中安装部署环境(JAVA)

目录 在Linux中安装jdk 包管理器yum安装jdk JDK安装过程中的问题 验证安装jdk 在Linux中安装tomcat 安装mysql 在Linux中安装jdk jdk在Linux中的安装方式有很多种, 这里介绍最简单的方法, 也就是包管理器方法: 包管理器yum安装jdk Linux中常见的包管理器有: yumaptp…

国外客户发开发信怎么发?写外贸邮件方法?

如何给国外客户发开发信&#xff1f;给老外发外贸开发信的技巧&#xff1f; 与国外客户保持联系并积极开展业务合作变得至关重要。一种有效的方式是通过发展信件&#xff0c;这可以帮助建立关系、传递信息和促成商机。蜂邮将介绍如何向国外客户发开发信&#xff0c;以确保您的…

全屋智能:鱼很大,但水更深

1990年&#xff0c;作为世界首富的比尔盖茨&#xff0c;已经对智能家居生活有了明确畅想。他花了7年时间&#xff0c;耗资1亿多美元&#xff0c;在美国西雅图的华盛顿湖东岸&#xff0c;建了一座占地6600平方米的湖滨别墅。在这座被命名为“未来之屋”的豪宅里&#xff0c;到处…

超全毛玻璃图标教程,不看你就OUT了!

相比热衷于UI设计的朋友们&#xff0c;都曾经听说过玻璃拟态图标这个名词。玻璃拟态图标以其吸引人的外观和易于上手的特性&#xff0c;赢得了大家的青睐。在这篇文章中&#xff0c;将使用一款免费的在线图标设计工具Pixso&#xff0c;为你详解通过四个步骤&#xff0c;让你快速…

HTTP(Hypertext Transfer Protocol)协议

文章目录&#xff1a; 什么是HTTP&#xff1f;认识URLurlencode 和 urldecodeHTTP 协议请求和响应格式HTTP 请求&#xff08;Request&#xff09;HTTP 响应&#xff08;Response&#xff09; HTTP 请求方法HTTP 的状态码常见的Header 什么是HTTP&#xff1f; HTTP&#xff08;…

文件编码、转换、乱码问题

文件编码 用来表示文本内容的字符集和字符编码方式&#xff0c;决定了在文本文件中使用的字符集和字符的二进制表示方式。常见的文件编码包括 UTF-8、UTF-16、ASCII、ISO-8859-1 等。选择文件编码时&#xff0c;需要考虑到所支持的字符集范围、编码方式对特定语言的支持程度以…

Redis--字符串

基础概念 字符串、数字&#xff0c;都会转化为字符串来进行存储 以二进制的方式存储在内存中 key的命名规范 key不宜过长&#xff0c;消耗内存&#xff0c;且在数据查找的这类键值的计算成本高&#xff08;通过hash计算来查找&#xff09;不宜过短&#xff0c;可读性查值一…

多视图聚类的论文阅读(一)

当聚类的方式使用的是某一类预定义好的相似性度量时&#xff0c; 会出现如下情况&#xff1a; 数据聚类方面取得了成功&#xff0c;但它们通常依赖于预定义的相似性度量&#xff0c;而这些度量受原始方法的影响:当输入维数相对较高时&#xff0c;往往是无效的。 1. Deep Mult…

【数据结构初阶】单链表SLlist

描述 不同于顺序表&#xff0c;顺序表的数据是存储在一个连续的空间里的 而链表它是链接起来的结构体地址。 所以我们不用像顺序表一样先创建一块空间出来&#xff0c;而是创建一个能存数据节点和节点与下一个节点之间的连接&#xff1b; 所以&#xff1a;“一个能存数据节点…