安装jdk
[-----]#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并启动
[-----]#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编译resin的mod_caucho模块
[-----]#cd /application/resin [-----]#./configure --with-apxs=/application/apache/bin/apxs [-----]#cd /application/resin/modules/c/src/ [-----]#make [-----]#make install [[email protected] 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
解决:
[[email protected] 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服务定时任务无法执行变量的问题
问题描述:
#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这些环境变量。
时间: 2024-11-05 14:52:50