Java服务器-resin

安装jdk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[-----] #cd /home/qinbin/tools/
[-----] #chmod +x jdk-6u34-linux-x64.bin
[-----] #./jdk-6u34-linux-x64.bin
[-----] #mv jdk1.6.0_34/ /application/.
[-----] #cd /application/
[-----] #ll
[-----] #ln -s jdk1.6.0_34/ jdk
[-----] #cd
[-----] #vim /etc/profile
JAVA_HOME= /application/jdk
CLASSPATH=$CLASSPATH:$JAVA_HOME /lib :$JAVA_HOME /jre/lib
PATH=$JAVA_HOME /bin :$JAVA_HOME /jre/bin :$PATH:$HOME /bin
RESIN_HOME= /application/resin
[-----] #source /etc/profile
[-----] #java
[-----] #javac

安装resin

01)安装resin并启动

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
[-----] #cd /home/qinbin/tools/
[-----] #tar xf resin-3.1.13.tar.gz
[-----] #ll
[-----] #mv  resin-3.1.13  /application/.
[-----] #cd  /application/
[-----] #ls
[-----] #ln -s resin-3.1.13/  resin
[-----] #ls
[-----] #mkdir -p /app/resinlog
[-----] #cd resin/conf
[-----] #ls
[-----] #vim resin.conf
<server-default>
       <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 >
       <watchdog-jvm-arg>-Dcom.sun.management.jmxremote< /watchdog-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-default >
     <!-- define the servers  in  the cluster -->
     <server  id = "qinbin"  address= "192.168.83.103"  port= "6911"  watchdog-port= "6921" />
     <server  id = "min"  address= "192.168.83.103"  port= "6931"  watchdog-port= "6941" />
[-----] #killall java
[-----] #/application/resin/bin/httpd.sh -server qinbin/min start
[-----] # netstat -ntlup |egrep "8080|6911|6921"


02)resin和apache的整合

    01.安装好apache

    02.为apache编译resinmod_caucho模块

1
2
3
4
5
6
7
8
[-----] #cd /application/resin
[-----] #./configure --with-apxs=/application/apache/bin/apxs
[-----] #cd /application/resin/modules/c/src/
[-----] #make
[-----] #make install
[root@qbPC conf] # ll /application/apache/modules/
httpd.exp      mod_caucho.so
(可以看见有mod_caucho.so,apache就是通过这个模块调用resin解析Java程序)


    03.启动apache测试

/application/apache/bin/apachectl graceful

(可能会报错:error:httpd:arp_socked v_infor_get() faild from qb

解决:在/etc/hosts(127.0.0.1 localhost.localhost MYHOST)

或者:将httpd.conf中的ServerName IP:80

访问:curl 192.168.83.103

(报错:Service Temporarily Unavailable

解决:

1
2
3
4
5
6
7
8
[root@qbPC conf] # vim httpd.conf
 
     LoadModule caucho_module  /application/apache2 .2.27 /modules/mod_caucho .so
     
     ResinConfigServer 192.168.83.103 6911
     SetHandler caucho-request
     #CauchoConfigCacheDirectory /tmp
     #CauchoStatus yes

)


    04.有关Java服务定时任务无法执行变量的问题


问题描述:

1
2
3
4
5
6
#crontab -e -n username
     50 17 * * 1-5 root  /usr/local/bin/resin_restart .sh
#resin_restart.sh
     #!/bin/bash
     /usr/local/bin/xxresin_stop .sh
     /usr/local/bin/xxresin_start .sh


出现问题:服务器定时起来了,但是报错(Resin can't load com.sun.tools.java.Main);


原因:由于export变量问题导致,crontab执行shell时只能执行为数不多的系统环境变量;


解决:在resin_restart.sh脚本中加入环境变量(JAVA_HOME/CLASSPATH/PATH/),然后再export这些环境变量。



本文转自 叫我北北 51CTO博客,原文链接:http://blog.51cto.com/qinbin/1934411


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值