resin4.0配置運(yùn)行總結(jié)

安裝

Install JDK 6 or later and link /usr/java to the Java home or define the environment variable JAVA_HOME.
tar -vzxf resin-4.0.x.tar.gz
cd resin-4.0.x #修改文件名貌似會出問題
./configure --prefix=`pwd`
some details on the ./configure options.
make
sudo make install
Execute sudo resinctl start
or run java -jar lib/resin.jar start
Browse to http://localhost:8080

啟動

resinctl

  1. Start resin with resinctl start
  2. Stop resin with resinctl stop
  3. Restart resin with resinctl restar

resin.sh

bin/resin.sh start|restart|stop -server <server-id>

配置

概念和命名約定

  • cluster - a collection of identically-configured servers.
  • environment - isolated class-loader contexts with shared resources: server, host and web-app are the main environments.
  • host - a HTTP virtual host.
  • proxy cache - HTTP proxy cache.
  • resource - drivers or services available to the application though JNDI or CDI like databases, JMS queues, custom CDI-configured service. Resin-specific resources include security, authenticators, health-checks and the rewrite/dispatch system.
  • rewrite/dispatch - the configuration for dispatching HTTP URLs to servlets and response codes like Apache's mod_rewrite.
  • server - a Resin JVM instance. There may be multiple servers on a machine.
  • watchdog - a JVM instance which watches over the Resin server and restarts the server if necessary.
  • web-app - a HTTP web-application which runs servlets.

resin.xml

刪除社區(qū)版不支持的功能

health

<!--
    - health configuration
-->
<resin:import path="${__DIR__}/health.xml"/>

loadbalance

<web-app id="">
    <resin:LoadBalance regexp="" cluster="app"/>
</web-app>

刪除不需要的cluster

<cluster id="proxycache">
    ...
</cluster>
<cluster id="memcached" xmlns:memcache="urn:java:com.caucho.memcached">
    ...
</cluster>
<cluster id="web">
    ...
</cluster>

只保留<cluster id="app">即可

server

端口

resin server涉及的端口

  • WatchDog 的端口饲趋,默認(rèn)6600
  • Server 監(jiān)控端口煞赢,默認(rèn)6800
  • 應(yīng)用的HTTP端口,默認(rèn)8080

單個server

<server id="k12yuwen" address="127.0.0.1" port="6801" > 
    <watchdog-port>6601</watchdog-port> 
    <http address="*" port="31001"/> 
</server>

多個server

<server-multi id-prefix="app-" address-list="127.0.0.1" port="6801">  
    <watchdog-port>6601</watchdog-port>  
    <http address="*" port="8081"/>  
</server-multi>

jvm參數(shù)

<cluster id="app">
    <server-default>
        <jvm-arg>-Xms32m</jvm-arg>
        <jvm-arg>-Xmx512m</jvm-arg>
        <jvm-arg>-Xss1m</jvm-arg>
        <jvm-arg>-verbosegc</jvm-arg>
        <jvm-arg>-Dfoo=bar</jvm-arg>
        <jvm-arg>-Dcaucho.smallmem</jvm-arg>
        <jvm-arg>-agentlib:resin</jvm-arg>
        <jvm-arg>-Xdebug</jvm-arg>
            
        <http port="8080"/>
    </server-default>
    <server id="a" address="192.168.2.1" port="6800"/>
    ...
</cluster>

參考

http://www.caucho.com/resin-4.0/admin/starting-resin-command-line.xtp

刪除doc

<resin:if test="${resin_doc}">
    <host id="${resin_doc_host}" root-directory="${resin_doc_host}">
        <web-app id="/resin-doc" root-directory="${resin.root}/doc/resin-doc"/>
    </host>
</resin:if>

添加自定義應(yīng)用

<web-app id="/" root-directory="/data/www/cms">  
</web-app> 

應(yīng)用參數(shù)

防止避免hash collision dos攻擊聂喇、日志

<web-app id="/k12yuwen" root-directory="webapps/k12yuwen-base">
    <form-parameter-max>100</form-parameter-max>
    <stderr-log path="${resin.root}/logs/k12yuwen/stderr.log" timestamp="[%Y-%m-%d %H:%M:%S]" rollover-period="1D"/>  
    <stdout-log path="${resin.root}/logs/k12yuwen/stdout.log" timestamp="[%Y-%m-%d %H:%M:%S]" rollover-period="1D"/>  
</web-app>

host 配置舉例

同一個域名下多個子app

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

    <host-default>
      <!-- creates the webapps directory for .war expansion -->
      <web-app-deploy path="webapps"
                      expand-preserve-fileset="WEB-INF/work/**"
                      multiversion-routing="${webapp_multiversion_routing}"
                      path-suffix="${elastic_webapp?resin.id:''}"/>
    </host-default>

    <!-- auto virtual host deployment in hosts/foo.example.com/webapps -->
    <host-deploy path="hosts">
      <host-default>
        <resin:import path="host.xml" optional="true"/>
      </host-default>
    </host-deploy>

    <!-- 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"/>
      <web-app id="/demo" root-directory="webapps/demo"/>
    </host>

 </cluster>


多個域名,虛擬主機(jī)(virtual host)

<cluster id="app">
    <!-- define the servers in the cluster -->
    <server-multi id-prefix="app-" address-list="${app_servers}" port="6801"/>
    <host-default>
      <!-- creates the webapps directory for .war expansion -->
      <web-app-deploy path="webapps"
                      expand-preserve-fileset="WEB-INF/work/**"
                      multiversion-routing="${webapp_multiversion_routing}"
                      path-suffix="${elastic_webapp?resin.id:''}"/>
    </host-default>

    <!-- auto virtual host deployment in hosts/foo.example.com/webapps -->
    <host-deploy path="hosts">
      <host-default>
        <resin:import path="host.xml" optional="true"/>
      </host-default>
    </host-deploy>

    <!--每個host id下也可以包含多個web-app窝剖,參考第一種的配置方法-->
    <host id="www.test1.com" root-directory=".">
      <web-app id="/" root-directory="webapps/test1/ROOT"/>
    </host>

    <host id="www.test2.com" root-directory=".">
      <web-app id="/" root-directory="webapps/test2/ROOT"/>
    </host>

 </cluster>

resin.xml舉例

<!--
   - Resin 4.0 configuration file.
  -->
<resin xmlns="http://caucho.com/ns/resin"
       xmlns:resin="urn:java:com.caucho.resin">

  <!-- property-based Resin configuration -->
  <resin:properties path="${__DIR__}/resin.properties" optional="true"/>

  <resin:if test="${properties_import_url}">
     <resin:properties path="${properties_import_url}"
                    optional="true" recover="true"/>
  </resin:if>


  <!-- Logging configuration for the JDK logging API -->
  <log-handler name="" level="all" path="stdout:"
               timestamp="[%y-%m-%d %H:%M:%S.%s]"
               format=" {${thread}} ${log.message}"/>
               
  <!-- 
     - Alternative pseudo-TTCC log format
     -
     - <log-handler name="" level="all" path="stdout:"
     -           timestamp="%y-%m-%d %H:%M:%S.%s"
     -           format=" [${thread}] ${log.level} ${log.shortName} - ${log.message}"/>
    -->
   
  <!--
     - level='info' for production
     - 'fine' or 'finer' for development and troubleshooting
    -->
  <logger name="" level="${log_level?:'info'}"/>

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

  <!--
     - Default configuration applied to all clusters, including
     - HTTP, HTTPS, and /resin-admin configuration.
    -->
  <resin:import path="${__DIR__}/cluster-default.xml"/>
  
  <!--
     - 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 cluster_system_key
    -->
  <cluster-system-key>${cluster_system_key}</cluster-system-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>

  <!-- For resin.properties dynamic cluster joining -->
  <home-cluster>${home_cluster}</home-cluster>
  <home-server>${home_server}</home-server>
  <elastic-server>${elastic_server}</elastic-server>
  <elastic-dns>${elastic_dns}</elastic-dns>

  <!--
     - Configures the main application cluster.  Load-balancing configurations
     - will also have a web cluster.
    -->
  <cluster id="app">
    <!-- define the servers in the cluster -->
    <!-- <server-multi id-prefix="app-" address-list="${app_servers}" port="6800"/> -->
    <server id="k12yuwen" address="127.0.0.1" port="6801" > 
        <watchdog-port>6601</watchdog-port> 
        <http address="*" port="31001"/> 
    </server>

    <host-default>
      <!-- creates the webapps directory for .war expansion -->
      <web-app-deploy path="webapps"
                      expand-preserve-fileset="WEB-INF/work/**"
                      multiversion-routing="${webapp_multiversion_routing}"
                      path-suffix="${elastic_webapp?resin.id:''}"/>
    </host-default>

    <!-- auto virtual host deployment in hosts/foo.example.com/webapps -->
    <host-deploy path="hosts">
      <host-default>
        <resin:import path="host.xml" optional="true"/>
      </host-default>
    </host-deploy>

    <host id="" root-directory=".">  
      <web-app id="/k12yuwen" root-directory="webapps/k12yuwen-base">
        <form-parameter-max>100</form-parameter-max>
        <stderr-log path="${resin.root}/logs/k12yuwen/stderr.log" timestamp="[%Y-%m-%d %H:%M:%S]" rollover-period="1D"/>  
        <stdout-log path="${resin.root}/logs/k12yuwen/stdout.log" timestamp="[%Y-%m-%d %H:%M:%S]" rollover-period="1D"/>  
      </web-app>
      <web-app id="/k12yuwen-ocr" root-directory="webapps/k12yuwen-ocr">
        <form-parameter-max>100</form-parameter-max>
        <stderr-log path="${resin.root}/logs/k12yuwen-ocr/stderr.log" timestamp="[%Y-%m-%d %H:%M:%S]" rollover-period="1D"/>  
        <stdout-log path="${resin.root}/logs/k12yuwen-ocr/stdout.log" timestamp="[%Y-%m-%d %H:%M:%S]" rollover-period="1D"/>  
      </web-app>
    </host>
  </cluster>


</resin>

resin.properties

web_admin_enable : false  
session_store : false  
resin_doc : false  
dev_mode:false
# 集群端口
app.http: 8080
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末欠拾,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子治泥,更是在濱河造成了極大的恐慌,老刑警劉巖泡孩,帶你破解...
    沈念sama閱讀 212,686評論 6 492
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件车摄,死亡現(xiàn)場離奇詭異,居然都是意外死亡仑鸥,警方通過查閱死者的電腦和手機(jī)吮播,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,668評論 3 385
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來眼俊,“玉大人意狠,你說我怎么就攤上這事〈郑” “怎么了环戈?”我有些...
    開封第一講書人閱讀 158,160評論 0 348
  • 文/不壞的土叔 我叫張陵,是天一觀的道長澎灸。 經(jīng)常有香客問我院塞,道長,這世上最難降的妖魔是什么性昭? 我笑而不...
    開封第一講書人閱讀 56,736評論 1 284
  • 正文 為了忘掉前任拦止,我火速辦了婚禮,結(jié)果婚禮上糜颠,老公的妹妹穿的比我還像新娘汹族。我一直安慰自己,他們只是感情好其兴,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,847評論 6 386
  • 文/花漫 我一把揭開白布顶瞒。 她就那樣靜靜地躺著,像睡著了一般元旬。 火紅的嫁衣襯著肌膚如雪榴徐。 梳的紋絲不亂的頭發(fā)上守问,一...
    開封第一講書人閱讀 50,043評論 1 291
  • 那天,我揣著相機(jī)與錄音箕速,去河邊找鬼酪碘。 笑死朋譬,一個胖子當(dāng)著我的面吹牛盐茎,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播徙赢,決...
    沈念sama閱讀 39,129評論 3 410
  • 文/蒼蘭香墨 我猛地睜開眼字柠,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了狡赐?” 一聲冷哼從身側(cè)響起窑业,我...
    開封第一講書人閱讀 37,872評論 0 268
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎枕屉,沒想到半個月后常柄,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,318評論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡搀擂,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,645評論 2 327
  • 正文 我和宋清朗相戀三年西潘,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片哨颂。...
    茶點(diǎn)故事閱讀 38,777評論 1 341
  • 序言:一個原本活蹦亂跳的男人離奇死亡喷市,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出威恼,到底是詐尸還是另有隱情品姓,我是刑警寧澤,帶...
    沈念sama閱讀 34,470評論 4 333
  • 正文 年R本政府宣布箫措,位于F島的核電站腹备,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏斤蔓。R本人自食惡果不足惜植酥,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 40,126評論 3 317
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望附迷。 院中可真熱鬧惧互,春花似錦、人聲如沸喇伯。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,861評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽稻据。三九已至艾猜,卻和暖如春买喧,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背匆赃。 一陣腳步聲響...
    開封第一講書人閱讀 32,095評論 1 267
  • 我被黑心中介騙來泰國打工淤毛, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人算柳。 一個月前我還...
    沈念sama閱讀 46,589評論 2 362
  • 正文 我出身青樓低淡,卻偏偏與公主長得像,于是被迫代替她去往敵國和親瞬项。 傳聞我的和親對象是個殘疾皇子蔗蹋,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,687評論 2 351

推薦閱讀更多精彩內(nèi)容

  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn)囱淋,斷路器猪杭,智...
    卡卡羅2017閱讀 134,637評論 18 139
  • 烏鴉有一頭不算黑的短發(fā) 穿著粉紅色的袈裟 她喜歡說話 張嘴吐出一口花 她教我們畫過幾幅畫 拿筆的時候像個啞巴 烏鴉...
    曉曉博士閱讀 456評論 0 0
  • 三月份一過皂吮,各大地方教育局和學(xué)校就著手準(zhǔn)備招聘教師行動了,有甚者去年底就有先下手早的税手,搶購優(yōu)秀的老師蜂筹,往往都是一些...
    Ruru鳳閱讀 778評論 0 11
  • 看了電影《從你的全世界路過》,忽然想去重慶逛逛冈止,那就走吧 熱辣辣的 名不虛傳 聚眾圍觀 在一個連GPS都要認(rèn)輸?shù)某?..
    陸小九兒閱讀 275評論 0 0