出家如初,成佛有余

Jboss虚拟主机安装部署指南

Posted in Uncategorized by chuanliang on 2008/05/16
1. 环境说明:

x.x.x.137:应用服务器,内网地址:192.168.1.137

x.x.x.180:数据库服务器,内网地址:192.168.1.180

数据库服务器和应用服务器之间通信通过内网地址通信。

2. 操作系统

操作系统版本:Redhat AS 5

安装:操作系统按照缺省的安装方式安装,无特殊要求。

由于没有硬件防火墙,因此需要安装iptables,建议不要安装selinux。

相关应用安装到/opt目录下,包括jdk、应用等。

3. 防火墙配置

防火墙策略:

只允许应用服务器x.x.x.137(192.168.1.137)访问数据库服务器x.x.x.180(192.168.1.180)的3306端口,且允许数据库服务器 x.x.x.180(192.168.1.180)能够访问应用服务器的x.x.x.137(192.168.1.137)的[1024,65535]端口(socket连接的随机端口)。

配置方法:

在数据库服务器x.x.x.180上执行如下操作:

1) 直接修改iptables的配置文件/etc/sysconfig/iptables

在:RH-Firewall-1-INPUT – [0:0]增加如下内容:

-A INPUT -p tcp -s x.x.x.137 –sport 1024:65535 -d x.x.x.180 –dport 3306 -m state –state NEW,ESTABLISHED -j ACCEPT

-A OUTPUT -p tcp -s x.x.x.180 –sport 3306 -d x.x.x.137 –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT

-A INPUT -p tcp -s 192.168.1.137 –sport 1024:65535 -d 192.168.1.180 –dport 3306 -m state –state NEW,ESTABLISHED -j ACCEPT

-A OUTPUT -p tcp -s 192.168.1.180 –sport 3306 -d 192.168.1.137 –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT

2) 重启iptables

service iptables restart

注意还要确认应用服务器(x.x.x.137)上开通了80端口,允许从公网访问:

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

4. 在域名服务器上做域名地址映射

在域名服务器上做映射,将e.yeeach.com映射到x.x.x.137地址,没有做URL指向转发

为了简化代理商销售人员记忆,避免记忆ip及复杂域名,因此采用二级域名+虚拟主机方式来实现此目标。

5. 安装JDK

使用Java SE 6 Update 6版本

wget -O jdk-6u6-linux-i586.bin

http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u6-linux-i586.bin?BundledLineItemUUID=A_JIBe.mKjcAAAEZ.0gv8eBL&OrderID=dy5IBe.mH10AAAEZ70gv8eBL&ProductID=VXZIBe.ootIAAAEZTrBAkQve&FileName=/jdk-6u6-linux-i586.bin

chmod 755 jdk-6u6-linux-i586.bin

./jdk-6u6-linux-i586.bin  

mv  jdk1.6.0_06/ /opt/jdk

修改/etc/bashrc(或者也可以修改用户的bash配置文件:~/.bashrc_profile) ,在尾部增加如下内容:

export JAVA_HOME=/opt/jdk

export PATH=$JAVA_HOME/bin:$PATH

6. 安装Jboss 4.2.2

wget http://jaist.dl.sourceforge.net/sourceforge/jboss/jboss-4.2.2.GA.zip

unzip jboss-4.2.2.GA.zip

mv jboss-4.2.2.GA  /opt

7. 增加Jboss APR支持

参看使用APR( Apache Portable Runtime)来提升jboss性能

wget http://www.jboss.org/file-access/default/members/jbossweb/freezone/dist/2.0.4.GA/jboss-native-2.0.4-linux2-x86-ssl.tar.gz

mkdir jboss-native

mv  jboss-native-2.0.4-linux2-x86-ssl.tar.gz  jboss-native/

cd jboss-native/

tar zxvf jboss-native-2.0.4-linux2-x86-ssl.tar.gz

mv  bin/META-INF/bin/linux2/x86/*  /opt/jboss-4.2.2.GA/bin/

mkdir /opt/jboss-4.2.2.GA/bin/native

cp –r bin/META-INF/lib/linux2/x86/*   /opt/jboss-4.2.2.GA/bin/native

8. 修改Jboss 参数

1) 修改JVM参数

修改bin/run.conf,修改参数:

if [ "x$JAVA_OPTS" = "x" ]; then

         JAVA_OPTS="-Xms512m -Xmx1024m -server -XX:MaxPermSize=300m -XX:MaxNewSize=300m -server -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"

fi

2) 修改jboss-4.2.2.GA/server/default/deploy/jboss-web.deployer/server.xml,将

将8080修改为80

将${jboss.bind.address}修改为0.0.0.0,允许从eth0,eth1,lo都能够访问jboss 80端口

  也可以在启动参数中指定ip地址选项,指定绑定的ip地址:run.sh -b x.x.x.137
9. 去除jboss的冲突包

由于jboss自身带的hibernate-annotations.jar版本与项目使用的版本存在冲突,因此去除hibernate-annotations.jar包

mv /opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar /opt/jboss-4.2.2.GA/server/default/lib/hibernate-annotations.jar.bak

 
10. 部署esales.war到/opt/jboss-4.2.2.GA/server/default/deploy

修改数据库连接池等应用相关参数

11. 增加虚拟主机Host节点

在/opt/jboss-4.2.2.GA/server/default/deploy/jboss-web.deployer/server.xml 中的 Engine加一个 Host 节点,内容如下:

<Host name="esales" autoDeploy="false"         

      deployOnStartup="false" deployXML="false">

    <Alias>e.yeeach.com</Alias>

    <Valve className="org.apache.catalina.valves.AccessLogValve"

           prefix="esales" suffix=".log" pattern="common"         

           directory="${jboss.server.home.dir}/log"/>

    <DefaultContext cookies="true" crossContext="true" override="true"/>

</Host>

12. 在eSales应用中配置虚拟主机

在/opt/jboss-4.2.2.GA/server/default/deploy/esales.war/WEB-INF下创建文件jboss-web.xml,内容如下:

<jboss-web>

    <context-root>/</context-root>

    <virtual-host>e.yeeach.com</virtual-host>

</jboss-web>

 

 

2条回应

Subscribe to comments with RSS.

  1. Unknown said, on 2008/09/02 at 13:42

    wow gold
    wow power leveling
    World of Warcraft gold
    wow power leveling
    wow gold
    wow powerleveling
    wow powerleveling
    Rolex
    rolex replica
    replica rolex
    Runescape Gold
    RuneScape Money
    Watches Rolex
    Rolex Watches
    Watch Rolex
    Rolex Watch
    wow powerleveling
    wow powerleveling
    wow powerleveling
    wow powerleveling
    wow powerleveling
    wow powerleveling
    rs gold
    wow
    wowgold
    gold wow
    cheap wow gold
    buy wow gold
    lotro gold
    wow gold -203025168765076

  2. Unknown said, on 2008/09/10 at 13:50

    Hi,Do you need advertising displays, advertisement screens, LCD digital signage and LCD signages? Please go Here:www.amberdigital.com.hk(Amberdigital).we have explored and developed the international market with professionalism. We have built a widespread marketing network, and set up a capable management team dedicated to provide beyond-expectation services to our customers.
    amberdigital Contact Us
    E-mail:sstar@netvigator.com
    website:www.amberdigital.com.hk
    alibaba:amberdigital.en.alibaba.com[acc


发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: