开发者社区> 问答> 正文

Resin4.0.24|配置多个应用各自启动独立 配置报错 

@红薯 你好,想跟你请教个问题:您好Resin4.0.24|配置多个应用各自启动独立,看了你在resin3.0的配置,学着配置,在4.0中配置不起来,想请你帮我看看

<!--
   - Resin 4.0 configuration file.
   -
   - See conf/full.xml for more sample configuration, including load
   - balancing and database configuration.
  -->
<resin xmlns="http://caucho.com/ns/resin"
       xmlns:resin="urn:java:com.caucho.resin"
       xmlns:memcache="urn:java:com.caucho.memcache"
       xmlns:health="urn:java:com.caucho.health">

  <!-- property-based Resin configuration -->
  <resin:properties path="${__DIR__}/resin.properties" optional="true"/>
  
  <!-- Logging configuration for the JDK logging API. -->
  <log-handler name="" level="all" path="stdout:"
               timestamp="[%y-%m-%d %H:%M:%S.%s] {%{thread}} "/>

  <!--
     - level='info' for production
     - 'fine' or 'finer' for development and troubleshooting
    -->
  <logger name="" level="${rvar('log_level')?:'info'}"/>

  <logger name="com.caucho.java" level="config"/>
  <logger name="com.caucho.loader" level="config"/>

  <!-- local configuration files -->
  <resin:import fileset="${__DIR__}/local.d/*.xml"/>

  <!--
     - driver .jar files can be placed in ${resin.root}/ext-lib
     -->
  <class-loader>
    <tree-loader path="${resin.root}/ext-lib"/>
  </class-loader>
  
  <!--
     - Remote management requires at least one enabled admin user.
    -->
  <resin:AdminAuthenticator>
    <user name="${admin_user}" password="${admin_password}"/>
    
    <resin:import path="${__DIR__}/admin-users.xml" optional="true"/>
  </resin:AdminAuthenticator>

  <!--
     - For clustered systems, create a password in as system_key
    -->
  <resin-system-auth-key>${system_key}</resin-system-auth-key>

  <!--
     - For production sites, change dependency-check-interval to something
     - like 600s, so it only checks for updates every 10 minutes.
    -->
  <dependency-check-interval>${dependency_check_interval?:'2s'}</dependency-check-interval>

  <!-- Java system-properties -->
  <system-property mail.smtp.host="${smtp_host?:'127.0.0.1'}"/>
  <system-property mail.smtp.port="${smtp_port?:25}"/>
  <system-property mail.smtp.from="${smtp_from}"/>

  <!-- For resin.properties dynamic cluster joining -->
  <join-cluster>${join_cluster}</join-cluster>

  <!--
     - default configuration applied to all clusters
    -->
  <cluster-default>
    <!-- shared webapp jars for non-classloader-aware libraries -->
    <web-app-default>
      <class-loader>
        <library-loader path="${resin.home}/webapp-jars"/>
      </class-loader>
    </web-app-default>

    <!-- standard servlet behavior, including .jsp, .php, and WEB-INF -->
    <resin:import path="classpath:META-INF/caucho/app-default.xml"/>

    <!-- enables development error pages -->
    <resin:if test="${rvar('dev_mode')}">
      <development-mode-error-page/>
    </resin:if>

    <!--
       - Enables the proxy cache (available in Resin Professional) 
      -->
    <proxy-cache memory-size="${rvar('proxy_cache_size')?:'64M'}">
     <!-- Vary header rewriting for IE -->
      <rewrite-vary-as-private/>
    </proxy-cache>
    
    <!--
       - Admin services
      -->

    <resin:if test="${admin_remote_enable}">
      <resin:RemoteAdminService/>
    </resin:if>
    
    <resin:AdminServices/>

    <!-- defaults for each server, i.e. JVM -->
    <server-default>
      <!--jvm-arg-line>${rvar('jvm_args')}</jvm-arg-line-->

       <jvm-arg>-Xms1024m</jvm-arg>

       <jvm-arg>-Xmx1024m</jvm-arg>

       <jvm-arg>-Xmn256m</jvm-arg>

       <jvm-arg>-XX:PermSize=128m</jvm-arg>

       <jvm-arg>-XX:MaxPermSize=256m</jvm-arg>

       <thread-max>2500</thread-max>

       <socket-timeout>60s</socket-timeout>

       <keepalive-max>512</keepalive-max>

       <keepalive-timeout>60s</keepalive-timeout>

      <!--
         - If starting Resin as root on Unix, specify the user name
         - and group name for the web server user.
       -->
      <user-name>${rvar('setuid_user')}</user-name>
      <group-name>${rvar('setuid_group')}</group-name>

      <!-- The http port -->
      <http address="*" port="${rvar('http')}"/>

      <!-- SSL port configuration: -->
      <resin:choose>
      <resin:when test="${rvar('openssl_file') != null}">
        <http port="${rvar('https')}">
          <openssl>
            <certificate-file>${rvar('openssl_file')}</certificate-file>
            <certificate-key-file>${rvar('openssl_key')}</certificate-key-file>
            <password>${rvar('openssl_password')}</password>
          </openssl>
        </http>
      </resin:when>
      <resin:when test="${class_exists('sun.security.x509.CertAndKeyGen')}">
        <http address="*" port="${rvar('https')}">
          <jsse-ssl self-signed-certificate-name="resin@localhost"/>
        </http>
      </resin:when>
      </resin:choose>
    </server-default>

    <!--
       - Default host configuration applied to all virtual hosts.
      -->
    <host-default>
      <access-log path="log/access.log" 
                 format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
                 rollover-period="1W"/>

      <!--
         - Defaults applied to each web-app.
        -->
      <web-app-default>
        <prologue>
          <allow-servlet-el/>
        </prologue>
     
        <!--
           - Sets max-age for cacheable pages, e.g. static pages.
          -->
        <resin:if test="${resin.professional}">
          <cache-mapping url-pattern="/" max-age="5s"/>
          <cache-mapping url-pattern="*.gif" max-age="60s"/>
          <cache-mapping url-pattern="*.jpg" max-age="60s"/>
          <cache-mapping url-pattern="*.png" max-age="60s"/>
          <cache-mapping url-pattern="*.css" max-age="60s"/>
          <cache-mapping url-pattern="*.js" max-age="60s"/>
         </resin:if>
      </web-app-default>
      
      <!--
         - Administration application /resin-admin
        -->
      <resin:if test="${rvar('admin_enable')}">
        <web-app id="/resin-admin" root-directory="${resin.root}/doc/admin">
          <prologue>
            <!-- only allow access from internal IP (10.*,192.168.*,127.*) -->
            <resin:set var="resin_admin_external"
                       value="${rvar('admin_external')}"/>
            <resin:set var="resin_admin_insecure"
                       value="${! rvar('admin_ssl')}"/>
          </prologue>
        </web-app>
      </resin:if>
    </host-default>
  </cluster-default>

  <!--
     - Configures the main application cluster.  Load-balancing configurations
     - will also have a load-balance-tier cluster.
    -->
  <cluster id="app_tiera">
    <!-- sets the content root for the cluster, relative to resin.root -->
    <root-directory>.</root-directory>

    <!-- define the servers in the cluster -->
    <server-multi id-prefix="app-a" address-list="${app_tier}" port="6801">
    	<http id="" port="8081"/>
    </server-multi>

    <!-- include resources config files in resources/ -->
    <resin:import fileset="${__DIR__}/app.d/**/*.xml"/>
    
    <!--配置JVM-->
    <server-default>
      <jvm-arg>-Xmx1024m</jvm-arg>
      <jvm-arg>-Xss1m</jvm-arg>
      <jvm-arg>-server</jvm-arg>
    </server-default>

    <!--
       - Default host configuration applied to all virtual hosts.
      -->
    <host-default>
      <access-log path="log/access.log" 
                 format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
                 rollover-period="1W"/>

      <!-- creates the webapps directory for .war expansion -->
      <web-app-deploy path="webapps"
                      expand-preserve-fileset="WEB-INF/work/**"/>

      <!--
         - Defaults applied to each web-app.
        -->
      <web-app-default>
        <prologue>
          <allow-servlet-el/>
        </prologue>

        <session-config>
          <use-persistent-store>${rvar('session_store')}</use-persistent-store>
          
          <enable-url-rewriting>false</enable-url-rewriting>
        </session-config>
      </web-app-default>
    </host-default>

    <!-- the default host, matching any host name -->
    <host id="" root-directory=".">
      <!--
         - webapps can be overridden/extended in the resin.xml
      -->
         <web-app id="/" root-directory="webapps/ROOT"/>
        
      
      <!--
	 - Resin documentation - remove for a live site
	-->
      <resin:if test="${rvar('resin_doc')}">
        <web-app id="/resin-doc" root-directory="${resin.root}/doc/resin-doc"/>
      </resin:if>
    </host>
  </cluster>
  
    <!--
     - Configures the main application cluster.  Load-balancing configurations
     - will also have a load-balance-tier cluster.
    -->
  <cluster id="app_tierb">
    <!-- sets the content root for the cluster, relative to resin.root -->
    <root-directory>.</root-directory>

    <!-- define the servers in the cluster -->
    <server-multi id-prefix="app-b" address-list="${app_tier}" port="6802">
    	<http id="" port="8082"/>
    </server-multi>

    <!-- include resources config files in resources/ -->
    <resin:import fileset="${__DIR__}/app.d/**/*.xml"/>
    
    <!--配置JVM-->
    <server-default>
      <jvm-arg>-Xmx1024m</jvm-arg>
      <jvm-arg>-Xss1m</jvm-arg>
      <jvm-arg>-server</jvm-arg>
    </server-default>

    <!--
       - Default host configuration applied to all virtual hosts.
      -->
    <host-default>
      <access-log path="log/access.log" 
                 format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
                 rollover-period="1W"/>

      <!-- creates the webapps directory for .war expansion -->
      <web-app-deploy path="webapps"
                      expand-preserve-fileset="WEB-INF/work/**"/>

      <!--
         - Defaults applied to each web-app.
        -->
      <web-app-default>
        <prologue>
          <allow-servlet-el/>
        </prologue>

        <session-config>
          <use-persistent-store>${rvar('session_store')}</use-persistent-store>
          
          <enable-url-rewriting>false</enable-url-rewriting>
        </session-config>
      </web-app-default>
    </host-default>

    <!-- the default host, matching any host name -->
    <host id="" root-directory=".">
      <!--
         - webapps can be overridden/extended in the resin.xml
      -->
         <web-app id="/" root-directory="webapps/ccms_integration"/>
        
      
      <!--
	 - Resin documentation - remove for a live site
	-->
      <resin:if test="${rvar('resin_doc')}">
        <web-app id="/resin-doc" root-directory="${resin.root}/doc/resin-doc"/>
      </resin:if>
    </host>
  </cluster>

  <cluster id="web_tier">
    <!-- define the servers in the cluster -->
    <server-multi id-prefix="web-" address-list="${web_tier}" port="6810"/>

    <host id="" root-directory="web-tier">
      <web-app id="">
        <resin:LoadBalance regexp="" cluster="app_tier"/>
      </web-app>
    </host>
  </cluster>

  <cluster id="cache_tier">
    <!-- define the servers in the cluster -->
    <server-multi id-prefix="cache-"
                  address-list="${cache_tier}"
                  port="6820">
      <!-- listen for the memcache protocol -->
      <listen port="${rvar('memcache_port')?:11212}"
              keepalive-timeout="600s" socket-timeout="600s">
        <memcache:MemcacheProtocol/>
      </listen>
    </server-multi>
  </cluster>
</resin>

展开
收起
kun坤 2020-05-31 17:33:08 933 0
1 条回答
写回答
取消 提交回答
  • 能只贴出你自己的配置吗,这里多数是 Resin 自带的默认配置

    ######

      <cluster id="app_tierb"> <root-directory>.</root-directory> <server-multi id-prefix="app-b" address-list="${app_tier}" port="6802"> <http id="" port="8082"/> </server-multi> <resin:import fileset="${DIR}/app.d/**/*.xml"/>

    <!--配置JVM-->
    <server-default>
      <jvm-arg>-Xmx1024m</jvm-arg>
      <jvm-arg>-Xss1m</jvm-arg>
      <jvm-arg>-server</jvm-arg>
    </server-default>
    
    <host-default>
      <access-log path="log/access.log" 
                 format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
                 rollover-period="1W"/>
      <web-app-deploy path="webapps"
                      expand-preserve-fileset="WEB-INF/work/**"/>
    
      <web-app-default>
        <prologue>
          <allow-servlet-el/>
        </prologue>
    
        <session-config>
          <use-persistent-store>${rvar('session_store')}</use-persistent-store>
          
          <enable-url-rewriting>false</enable-url-rewriting>
        </session-config>
      </web-app-default>
    </host-default>
    
    <host id="" root-directory=".">
        <web-app id="/" root-directory="webapps/ccms_integration"/>
      <resin:if test="${rvar('resin_doc')}">
        <web-app id="/resin-doc" root-directory="${resin.root}/doc/resin-doc"/>
      </resin:if>
    </host>
    

    </cluster>

    确实有些乱,这样看看######启动有什么错误日志吗?resin 3 和 4 配置有点不同,很久不用了,不太看得出来,要看异常

    ######我也遇到的相似问题,怎么解决的######错误  

    #../bin/resin.sh start -server app-a Resin/4.0.24: default server cannot find a unique <server> or <server-multi> in /usr/local/resin/conf/resin.xml.
    ######我博客里有写,请参考######你这样只是实现了,域名的跳转,并没有实现多个app独立启动与部署,不影响其他app运行。######楼主, 最后搞定没?

    2020-05-31 17:34:09
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
《Nginx 代理系统常用手册》 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载

相关实验场景

更多