参考网站:

http://caucho.com/

http://www.oschina.net/p/resin

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

一、resin产生背景

Resin是CAUCHO公司(http://www.caucho.com/)的产品,是一个非常流行的支持servlets 和jsp的引擎,速度非常快。Resin本身包含了一个支持HTTP/1.1的WEB服务器。虽然它可以显示动态内容,但是它显示静态内容的能力也非常强,速度直逼APACHE SERVER。许多站点都是使用该WEB服务器构建的。

Resin也可以和许多其他的WEB服务器一起工作,比如Apache server和IIS等。Resin支持Servlets 2.3标准和JSP 1.2标准。熟悉ASP和PHP的用户可以发现用Resin来进行JSP编程是件很容易的事情。

Resin支持负载平衡(Load balancing),可以增加WEB站点的可靠性。方法是增加服务器的数量。比如一台SERVER的错误率是1%的话,那么支持负载平衡的两个Resin服务器就可以使错误率降到0.01%。

二、resin环境准备及安装

resin环境安装准备

1)系统环境

2)软件需求

系统:centos5.8(x86_64)

   centos6.4(x86_64)

软件: jdk-6u34-fcs-bin-b04-linux-amd64-19_jul_2012.bin 或者 jdk-6u34-linux-x64.bin

版本需求:

Resin 3.1 needs Java before it can run.It needs JDK 1.5 or a later JDK.

Resin 3.1 needs Java before it can run.Resin requires JDK 6.0 or later.

http://www.caucho.com/resin-3.1/doc/starting.xtp

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

http://www.caucho.com/download/resin-3.1.13.tar.gz  ------》下载resin-3.1.13.tar.gz版本

httpd-2.2.23.tar.gz

地址:

http://www.caucho.com/download/

http://httpd.apache.org/download.cgi

http://java.sun.com/javase/downloads/index.jsp

http://www.oracle.com/technetwork/java/javase/archive-139210.html ---下载jdk-6u34-linux-x64.bin

安装JDK环境

1)下载JDK

登陆http://www.oracle.com/technetwork/java/javase/archive-139210.html 下载对应的jdk版本。

或者上传jdk-6u34-linux-x64.bin到/home/peng/tools

 

[root@data-1-1 tools]# ll jdk-6u34-linux-x64.bin

-rwxr-xr-x 1 root root 72036348 Jan  8  2016 jdk-6u34-linux-x64.bin

 

2)增加权限并安装

[root@data-1-1 tools]# chmod +x jdk-6u34-linux-x64.bin

[root@data-1-1 tools]# ./jdk-6u34-linux-x64.bin

[root@data-1-1 tools]# ls -ld jdk1.6.0_34/

drwxr-xr-x 8 root root 4096 Nov 29 00:48 jdk1.6.0_34/

安装完成后,会在当前目录下建立jdk1.6.0_34/的目录。

提示:JDK全称Java(TM) SE Development Kit 6 successfully installed.

 

3)配置JDK的安装路径

mkdir -p /application

cd  /home/peng/tools

mv jdk1.6.0_34/ /application/

ln -s /application/jdk1.6.0_34/  /application/jdk

ls -l /application/ |grep jdk

/application/jdk/bin/java –version

 

查看版本信息:

[root@data-1-1 tools]# /application/jdk/bin/java -version

java version "1.6.0_34"

Java(TM) SE Runtime Environment (build 1.6.0_34-b04)

Java HotSpot(TM) 64-Bit Server VM (build 20.9-b04, mixed mode)

4)设置JAVA变量

echo "#java start_config at 2016-1-7" >>/etc/profile

echo 'export JAVA_HOME=/application/jdk' >>/etc/profile

echo 'export PATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib'>>/etc/profile

echo 'export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin'>>/etc/profile

echo 'RESIN_HOME=/application/resin' >>/etc/profile

echo "#java env end config at 2016-1-7" >>/etc/profile

 

生效:

source /etc/profile

 

查看:

echo $JAVA_HOME

echo $CLASSPATH

echo $RESIN_HOME

echo $PATH

 

5)安装resin

[root@data-1-1 ~]# cd /home/peng/tools/

[root@data-1-1 tools]# wget http://www.caucho.com/download/resin-3.1.13.tar.gz

[root@data-1-1 tools]# tar -zxf resin-3.1.13.tar.gz

[root@data-1-1 tools]# mv resin-3.1.13  /application/

[root@data-1-1 tools]# ln -s /application/resin-3.1.13/ /application/resin

[root@data-1-1 tools]# ls -l /application/

lrwxrwxrwx  1 root root   26 Nov 29 01:39 resin -> /application/resin-3.1.13/

resin配置文件说明及修改

[root@data-1-1 ~]# cd /application/resin/conf

[root@data-1-1 conf]# diff resin.conf  resin.conf.orig

[root@data-1-1 ~]# vim +88 /application/resin/conf/resin.conf   -->删除默认配置文件的88-146行。加入如下内容

 

<!-- resin Configure at 2016-1-11 -->

<server id='peng' address='192.168.1.140' port='6911' watchdog-port="6921">

    <http address="*" port="8080"/>

    <jvm-arg>-Xmx256m</jvm-arg>

    <jvm-arg>-Xss1m</jvm-arg>

    <jvm-arg>-Xdebug</jvm-arg>

    <jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>

    <memory-free-min>1M</memory-free-min>

    <thread-max>256</thread-max>

    <socket-timeout>65s</socket-timeout>

    <keepalive-max>128</keepalive-max>

    <keepalive-timeout>15s</keepalive-timeout>

    </server>

 

 

要删除的内容:

88        <server-default>

    89        <!-- The http port -->

    90        <http address="*" port="8080"/>

    91

    92        <!--

    93           - SSL port configuration:

    94           -

    95           - <http address="*" port="8443">

    96           -   <openssl>

    97           -     <certificate-file>keys/gryffindor.crt</certificate-file>

    98           -     <certificate-key-file>keys/gryffindor.key</certificate-key-file>

    99           -     <password>test123</password>

   100           -   </openssl>

   101           - </http>

   102          -->

   103

   104        <!--

   105           - The JVM arguments

   106          -->

   107        <jvm-arg>-Xmx256m</jvm-arg>

   108        <jvm-arg>-Xss1m</jvm-arg>

   109        <jvm-arg>-Xdebug</jvm-arg>

   110        <jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>

   111

   112        <!--

   113           - Uncomment to enable admin heap dumps

   114           - <jvm-arg>-agentlib:resin</jvm-arg>

   115          -->

   116

   117        <!--

   118           - arguments for the watchdog process

   119          -->

   120        <watchdog-jvm-arg>-Dcom.sun.management.jmxremote</watchdog-jvm-arg>

   121        <watchdog-port>6600</watchdog-port>

   122

   123        <!--

   124           - Configures the minimum free memory allowed before Resin

   125           - will force a restart.

   126          -->

   127        <memory-free-min>1M</memory-free-min>

   128

   129        <!-- Maximum number of threads. -->

   130        <thread-max>256</thread-max>

   131

   132        <!-- Configures the socket timeout -->

   133        <socket-timeout>65s</socket-timeout>

   134

   135        <!-- Configures the keepalive -->

   136        <keepalive-max>128</keepalive-max>

   137        <keepalive-timeout>15s</keepalive-timeout>

   138

   139        <!--

   140           - If starting bin/resin as root on Unix, specify the user name

   141           - and group name for the web server user.

   142           -

   143           - <user-name>resin</user-name>

   144           - <group-name>resin</group-name>

   145          -->

   146      </server-default>

 

以上参数说明如下:

!-- resin Configure at 2016-1-11 -->

<server id='peng' address='192.168.1.140' port='6911' watchdog-port="6921">

<http address="*" port="8080"/>

 

<!--最大堆大小>

     <jvm-arg>-Xmx1024M</jvm-arg>

 

<!—初始堆大小,在用户生产环境上一般将这Xmx和Xms设为相同,以减少运行期间系统在内存申请上所花的开销。-->

<jvm-arg>-Xms1024M</jvm-arg>

 

<!--Newsize和MaxNewSize在用户生产环境上一般设为相同,以减少运行期间系统在内存申请上所花的开销。-->

<jvm-arg>-XX:NewSize=512M</jvm-arg>

<jvm-arg>-XX:MaxNewSize=512M</jvm-arg>

 

<!—设置每个线程的stack大小-->

<jvm-arg>-Xss1024k</jvm-arg>

 

<!--年轻代和年老代的比值-->

     <jvm-arg>-XX:NewRatio=2</jvm-arg>

 

<!--设置最大永久区大小,永久保存区用于存放Class信息和元信息-->

     <jvm-arg>-XX:MaxPermSize=100M</jvm-arg>

 

<!--客户端连接rmi服务端,数据返回的超时时间,单位为毫秒-->

     <jvm-arg>-Dsun.rmi.transport.tcp.responseTimeout=5000</jvm-arg>

 

<!--当jvm的内存小于这个指定值,resin服务会gracefully重启,来释放泄露的内存空间-->

     <memory-free-min>1M</memory-free-min>

     <thread-max>800</thread-max>

 

<!--读写socket最大超时时间-->

     <socket-timeout>15s</socket-timeout>

 

<!--最大长连接数量-->

      <keepalive-max>256</keepalive-max>

 

<!--长连接超时时间-->

    <keepalive-timeout>5s</keepalive-timeout>

 

提示:可以把<http address="*" port="8080"/>里的8080改成80,把resin配置成独立的web server,就是可以不使用Apache,直接使用resin做为web服务器。官方宣称:resin web server性能很牛。

启动resin

[root@data-1-1 ~]# /application/resin/bin/httpd.sh -server peng start

[root@data-1-1 ~]# netstat -tunlp |egrep "6911|6921|8080"           

tcp        0      0 ::ffff:192.168.1.140:6911   :::*                        LISTEN      10298/java         

tcp        0      0 ::ffff:127.0.0.1:6921       :::*                        LISTEN      10269/java          

tcp        0      0 :::8080                     :::*                        LISTEN      10298/java    

提示:

8080 --->resin web server的端口,如果不需要resin做web server,可以关掉这个配置。

6921 --->watchdog的端口

6911 --->真正的resin端口,这个必须要起来,将来在Apache里就是把请求抛给这个端口解析的。

命令帮助:

[root@data-1-1 ~]# /application/resin/bin/httpd.sh -h

unknown argument '-h'

 

usage: java -jar resin.jar [-options] [status | start | stop | restart | kill | shutdown]

 

where options include:

   -conf <file>          : select a configuration file

   -log-directory <dir>  : select a logging directory

   -resin-home <dir>     : select a resin home directory

   -root-directory <dir> : select a root directory

   -server <id>          : select a <server> to run

   -watchdog-port <port> : override the watchdog-port

   -verbose              : print verbose starting information

浏览器查看页面

用http://hostip:8080访问resin的默认页面

192.168.1.140:8080/

http://192.168.1.140:8080/

查看的结果如下:

出现上面的页面显示,则说明resin服务配置OK了!

jsp文件默认路径存放在

[root@data-1-1 ~]# ll /application/resin/webapps/ROOT/

total 8

-rw-r--r-- 1 root root 1507 Nov  9  2012 index.jsp

drwxr-xr-x 5 root root 4096 Nov 29 04:30 WEB-INF

 

[root@data-1-1 ~]# echo '99+1=<%=99+1%>' >/application/resin/webapps/ROOT/test.jsp

[root@data-1-1 ~]# cat /application/resin/webapps/ROOT/test.jsp

99+1=<%=99+1%>

[root@data-1-1 ~]# curl http://192.168.1.140:8080/test.jsp

99+1=100

 

开发启动脚本

[root@data-1-1 ~]# cat /etc/init.d/resin-peng

#!/bin/bash

. /etc/init.d/functions

StartPath='/application/resin/bin/httpd.sh'

ResinLog=/app/logs/resinlog

[ ! -d $ResinLog ] && mkdir -p $ResinLog

resind () {

  #如果是多进程增加上面的配置段即可。

  for id in peng

   do

     $StartPath -server $id $1 >>$ResinLog/resin_startup.log

     if [ $? -eq 0 ];then

       action "$1 $id resin..." /bin/true

     else

       action "$1 $id resin..." /bin/false

     fi

done

}

case "$1" in

   start)

        resind $1

        echo "--------checking------"

        sleep 10

        netstat -lnt |egrep "80|69"

        echo "--------checkover-----"

        ;;

  stop)

        resind $1

        ;;

  restart)

         resind stop

         resind start

        ;;

    *)

       echo "Usage: $0 {start|stop|restart}"

       exit 1

  esac

   exit 0

赋予权限:

[root@data-1-1 ~]# chmod +x /etc/init.d/resin-peng

 

测试结果:

[root@data-1-1 ~]# /etc/init.d/resin-peng restart

stop peng resin...                                         [  OK  ]

start peng resin...                                        [  OK  ]

配置resin开机自启动说明

脚本如下:

[root@data-1-1 ~]# cat /etc/init.d/resin-peng

#!/bin/bash

#author at 20160111

#linux startup script for Resin

# chkconfig: 345 85 15

# description: Resin is a Java Web server.

#              

#To install,configure this file as needed and copy init.resin

#to /etc/rc.d/init.d as resin. Then use "# /sbin/chkconfig resin reset"

#

. /etc/init.d/functions

StartPath='/application/resin/bin/httpd.sh'

ResinLog=/app/logs/resinlog

[ ! -d $ResinLog ] && mkdir -p $ResinLog

resind () {

  #如果是多进程增加上面的配置段即可。

  for id in peng

   do

     $StartPath -server $id $1 >>$ResinLog/resin_startup.log

     if [ $? -eq 0 ];then

       action "$1 $id resin..." /bin/true

     else

       action "$1 $id resin..." /bin/false

     fi

done

}

case "$1" in

   start)

        resind $1

        echo "--------checking------"

        sleep 10

        netstat -lnt |egrep "80|69"

        echo "--------checkover-----"

        ;;

  stop)

        resind $1

        ;;

  restart)

         resind stop

         resind start

        ;;

    *)

       echo "Usage: $0 {start|stop|restart}"

       exit 1

  esac

   exit 0

 

加入到chkconfig中:

[root@data-1-1 ~]# chkconfig --add /etc/init.d/resin-peng

[root@data-1-1 ~]# chkconfig --list resin-peng

resin-peng      0:off   1:off   2:off   3:on    4:on    5:on    6:off

启动resin服务异常解决办法

[root@data-1-1 ~]# cat /app/logs/resinlog/resin_startup.log

Resin/3.1.13 started -server 'peng' for watchdog at 127.0.0.1:6921

Resin/3.1.13 stopped -server 'peng' for watchdog at 127.0.0.1:6921

Resin/3.1.13 started -server 'peng' for watchdog at 127.0.0.1:6921

提示:/app/logs/resinlog/resin_startup.log这个日志路径是启动脚本里定义的。

 

resin服务之一---安装及部署的更多相关文章

  1. C#(VS2008)服务编写-安装和部署

    1.创建一个空白解决方案. 2.在解决方案下面添加两个Windows服务:WXSmsGuardNew(保护服务),WXSmsMainNew(主服务). 3.第一个服务作为保护服务,服务上添加两个控件: ...

  2. 阿里云服务器Linux CentOS安装配置(六)resin多端口配置、安装、部署

    阿里云服务器Linux CentOS安装配置(六)resin多端口配置.安装.部署 1.下载resin包 http://125.39.66.162/files/2183000003E08525/cau ...

  3. 高性能web服务器(热死你)Resin Linux的安装、配置、部署,性能远超Nginx支持Java、PHP等

    高性能web服务器(热死你)Resin Linux的安装.配置.部署,性能远超Nginx支持Java.PHP等 一.    安装resin 1.  下载resin: 下载地址:http://cauch ...

  4. Zabbix 3.4 服务端安装部署

    关于zabbix的安装部署官方也提供了详细的安装文档,链接如下: https://www.zabbix.com/download 选择zabbix的版本,服务器平台及使用的数据库 安装和配置zabbi ...

  5. Burrow 服务的安装部署

    Burrow 服务的安装部署 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 最近协助开发的同时帮忙把10个topic的数据使用5个topic的来工作.结果发现数据flume在手机数 ...

  6. Windows Server 2012 虚拟化实战:SCVMM的安装和部署

    本篇大概介绍一下在Windows Server 2012 R2上安装和部署SCVMM的过程及其注意事项.下图是我们数据中心SCVMM的基本架构,其中 SCVMM Database 是用于存储了所有配置 ...

  7. Linux下Redis的安装和部署

    一.Redis介绍 Redis是当前比较热门的NOSQL系统之一,它是一个key-value存储系统.和Memcache类似,但很大程度补偿了Memcache的不足,它支持存储的value类型相对更多 ...

  8. Redis的安装与部署

    为了解决公司产品数据增长过快,初始化太耗费时间的问题,决定使用redis作为缓存服务器. Windows下的安装与部署: 可以直接参考这个文章,我也是实验了一遍:http://www.runoob.c ...

  9. Office web app server2013详细的安装和部署

    转自:http://blog.csdn.net/u011355311/article/details/9360293 SharePoint 2013集成Office web apps server20 ...

随机推荐

  1. 如何在Excel里安装excel插件?

    随着科技的发展,人们对数据分析的要求越来越多, Excel也存在一些问题,长期困扰一线业务用户:首先是性能问题.对于大数据量,Excel处理起来很慢.数据获取的过程麻烦,特别是周期性的数据获取,每次都 ...

  2. MySQL创建表、更改表和删除表

    1.创建表 mysql> create table t_address( -> id int primary key auto_increment, // 设置id为主键,自动增值 -&g ...

  3. vue项目npm run dev 报错error in ./src/main.js Module build failed: ReferenceError: Unknown plugin "transform-vue-jsx" specified in......

    问题: vue项目npm run dev运行时报错,如下图:  原因: 缺少组件 解决办法: 安装相应的组件:  npm install babel-plugin-transform-vue-jsx ...

  4. 千万级 PV是什么意思?

    首先介绍下pv的概念: PV(访问量):即Page View,页面刷新一次算一次. UV(独立访客):即Unique Visitor,00:00-24:00内相同的客户端只被计算一次. IP(独立IP ...

  5. 通过IP访问公司公共资源库(共享文件)

    今天,公司发通知说公司内部共享资源库已搭建完成,给了一个IP地址说可以访问了,那么如何去查看其他电脑的共享文件,下面以Windows7为例进行说明: 1:点击开始-运行(如图),或者快捷键(Win+R ...

  6. 转 Autofac怎么依赖注入ASP.NET MVC5类的静态方法

    之前我有介绍过怎么在ASP.NET mvc5中实现的Controller的依赖注入.一般是通过Contrller的构造函数的参数或者属性来注入,但是这有一个共同点就是调用这个类的方法一般都是实例方法, ...

  7. Python第一讲以及计算机基础

    本周课程安排 python基础(五天) 下周课程安排 tableau图形化表制作 下下周课程安排 spss 今日内容概要 计算机发展史 计算机主要硬件 编程与编程语言 python解释器及IDE编辑器 ...

  8. 革命性创新,动画杀手锏 @scroll-timeline

    在 CSS 规范 Scroll-linked Animations 中,推出了一个划时代的 CSS 功能.也就是 -- The @scroll-timeline at-rule,直译过来就是滚动时间线 ...

  9. SAPD:FSAF升级版,合理的损失值加权以及金字塔特征选择 | ECCV 2020

    针对anchor-point检测算法的优化问题,论文提出了SAPD方法,对不同位置的anchor point使用不同的损失权重,并且对不同的特征金字塔层进行加权共同训练,去除了大部分人为制定的规则,更 ...

  10. Wordpress Calendar Event Multi View < 1.4.01 反射型xss漏洞(CVE-2021-24498)

    简介 WordPress是Wordpress基金会的一套使用PHP语言开发的博客平台.该平台支持在PHP和MySQL的服务器上架设个人博客网站.WordPress 插件是WordPress开源的一个应 ...