jboss+mysql配置手册
时间:2006-07-06 来源:brave_script
自助建站运营/运维系统(jboss)安装维护手册
1.软件概述
1.1自助建站运营/运维系统是基于ASP运营模式的企业运营管理平台系统,由独立的应用服务器分别提供统一运营管理功能、
各产品运营系统的功能。
1.2开发语言
本系统采用J2EE技术架构,使用到java, xml, xsl,javascript,html等各项技术,数据库使用MySQL
2.运行环境及安装说明
2.1硬件说明所需硬件设备列表
硬盘空间:80GB
CPU:双至强2GHZ
RAM:2GB
2.2 软件系统说明
操作系统: 版本
redhat AS4
JAVA(J2SDK) 版本
SUN J2SDK For Linux 1.4.2_06
应用服务器 版本
jboss Application Server 4.0.1
数据库服务器 版本
MySQL 5.0.21
客户端浏览器 版本
Internet Explorer 5.0(版本:5.00.3700.1000)或以上 2.3 Linux环境安装步骤说明
分区 大小
/boot 100m
/ 5G
/usr 10G
/var 30G
/tmp 2G
swap 4G 选择默认系统语言:简体中文
2.4 jdk安装
chmod +x j2sdk-1_4_2_06-linux-i586.bin
。/j2sdk-1_4_2_06-linux-i586.bin
mv j2sdk-1_4_2_06 /var/local/
配置环境变量
vi /etc/profile
JAVA_HOME=/var/local/j2sdk1.4.2_06
CLASSPATH=/var/local/j2sdk1.4.2_06/lib/dt.jar:/var/local/j2sdk1.4.2_06/lib/htmlconverter.jar \
:/var/local/j2sdk1.4.2_06/lib/tools.jar
PATH=/var/local/j2sdk1.4.2_06/bin:/var/local/j2sdk1.4.2_06/jre/bin:$PATH
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME CLASSPATH
# sh /etc/profile
如果默认安装了java则:mv /usr/bin/java /usr/bin/java.bak
mv /usr/bin/javac /usr/bin/javac.bak
测试java环境 which java
出现 /var/local/j2sdk1.4.2_06/bin/java
2.5 mysql数据库安装
安装位置/var/local/mysql
groupadd mysql
useradd -g mysql -d /var/local/mysql mysql
tar zxvf mysql-5.0.21.tar.gz
cd mysql-5.0.21
./configure --prefix=/var/local/mysql
make && make install
/var/local/mysql/bin/mysql_install_db --user=mysql(建立数据库)
chmod +777 -R /var/local/mysql
chown -R mysql.mysql /var/local/mysql
建立开机启动
cp /var/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on
将配置文件放到/etc/
cp /var/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
启动mysql
/var/local/mysql/bin/mysqld_safe & 建立数据库
/var/local/mysql/bin/mysql -u root -p mysql> create database weblogic ;
mysql>alter database weblogic collate utf8_bin;
mysql>grant all on weblogic.* to weblogic@'%' identified by "weblogic"
登陆数据库
/var/local/mysql/bin/mysql weblogic -u weblogic -p 2.6 jboss Application Server 4.0.1
建立用户
mkdir /var/local/jboss
guoupadd jboss
useradd -g jboss -d /var/local/jboss/ jboss
passwd jboss
chown -R jboss.jboss /var/local/jboss/
将jboss-4.0.1.tar.gz解压
tar -xzvf tar -xzvf jboss-4.0.1.tar.gz
chown -R jboss.jboss jboss-4.0.1
登陆到jboss用户
su - jboss
拷贝jboss-4.0.1下的所有文件到jboss主目录
cp -rf jboss-4.0.1/* /var/local/jboss/
$jboss安装路径/server下创建目录EAOper;
mkdir -p /var/local/jboss/server/EAOper
$jboss安装路径/server/default中的目录和文件全部copy到$jboss安装路径/server/EAOper;
cp -rf /var/local/jboss/server/default/* /var/local/jboss/server/EAOper/
删除/var/local/jboss/lib/commons-httpclient.jar
mv /var/local/jboss/lib/commons-httpclient.jar /var/local/jboss/lib/commons-httpclient.jar.bak
解压EAOper.ear
cp 解压后APP-INF/lib/下的mysql-connector-java-3.1.11-bin.jar SetCharacterEncodingFilter.jar 到
cp mysql-connector-java-3.1.11-bin.jar /var/local/jboss/server/EAOper/lib/
cp SetCharacterEncodingFilter.jar /var/local/jboss/server/EAOper/lib/
修改如下配置文件
1.vi /var/local/jboss/server/EAOper/deploy/jbossweb-tomcat50.sar/META-INF/jboss-service.xml
把属性UseJBossWebLoader的值由true改成false;
2.vi /var/local/jboss/server/EAOper/deploy/jbossweb-tomcat50.sar/server.xml 配置默认的8080端口改为8000端口:
把<Connector port="8080" address="${jboss.bind.address}"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>
改为:
"<Connector port="8000" address="${jboss.bind.address}"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>" 配置语言
把:
<Connector port="8000" address="${jboss.bind.address}"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>
改为:
<Connector port="8000" address="${jboss.bind.address}"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/> 3. vi /var/local/jboss/server/EAOper/deploy/jbossweb-tomcat50.sar/conf/web.xml
在web-app节点中增加节点如下:
<filter>
<filter-name>SetCharacterEncoding</filter-name>
<filter-class>filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SetCharacterEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> 4. vi /var/local/jboss/bin/run.sh
export LANG=zh_CN.UTF-8
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Ddefault.client.encoding=UTF-8 -Duser.language=en -Duser.region=CN" 5.vi /var/local/jboss/bin/run.conf JAVA_OPTS="-server -Xms128m -Xmx128m"
修改为:
JAVA_OPTS="-server -Xms1024m -Xmx1024m"
启动创建的jboss服务 (注用jboss用户启动)
cd
cd bin
nohup ./run.sh -c EAOper & 配置jboss的数据源
touch /var/local/jboss/server/EAOper/deploy/mysql-ds.xml
编辑内容如下
<?xml version="1.0" encoding="UTF-8"?>
<!-- The Hypersonic embedded database JCA connection factory config
$Id: hsqldb-ds.xml,v 1.15 2004/09/15 14:37:40 loubyansky Exp $ -->
<datasources>
<local-tx-datasource>
<jndi-name>DataSource</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:mysql://mysql数据库所在ip:3306/weblogic</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<!-- 最小连接数 -->
<min-pool-size>30</min-pool-size>
<!-- 最大连接数 -->
<max-pool-size>30</max-pool-size>
<!--对于数据库事务,应选择较低成本的事务等级,避免造成坏数据。递增成本的事务等级包括:
TRANSACTION_READ_UNCOMMITED,
TRANSACTION_READ_COMMITED,
TRANSACTION_REPEATABLE_READ,
TRANSACTION_SERIALIZABLE
-->
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<!-- 抛出异常前最大的等待连接时间 -->
<blocking-timeout-millis>30000</blocking-timeout-millis>
<!--关闭连接前连接空闲的最大时间 -->
<idel-timeout-minutes>10</idel-timeout-minutes>
<!--有ByContainerAndApplication、ByContainer、ByApplication和ByNothing等值 -->
<criteria>ByContainer</criteria>
<user-name>weblogic</user-name>
<password>weblogic</password>
<connection-property name="SendStringParametersAsUnicode">false</connection-property>
<metadata>
<type-mapping>Mysql</type-mapping>
</metadata>
</local-tx-datasource>
<local-tx-datasource>
<jndi-name>logtest</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:mysql://mysql数据库所在ip/logtest</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<!-- 最小连接数 -->
<min-pool-size>30</min-pool-size>
<!-- 最大连接数 -->
<max-pool-size>30</max-pool-size>
<!--对于数据库事务,应选择较低成本的事务等级,避免造成坏数据。递增成本的事务等级包括:
TRANSACTION_READ_UNCOMMITED,
TRANSACTION_READ_COMMITED,
TRANSACTION_REPEATABLE_READ,
TRANSACTION_SERIALIZABLE
-->
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<!-- 抛出异常前最大的等待连接时间 -->
<blocking-timeout-millis>10000</blocking-timeout-millis>
<!--关闭连接前连接空闲的最大时间 -->
<idel-timeout-minutes>10</idel-timeout-minutes>
<!--有ByContainerAndApplication、ByContainer、ByApplication和ByNothing等值 -->
<criteria>ByContainer</criteria>
<user-name>logtest</user-name>
<password>logtest</password>
<connection-property name="SendStringParametersAsUnicode">false</connection-property>
<metadata>
<type-mapping>Mysql</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
配置运行日志
cp /var/local/jboss/server/EAOper/conf/log4j.xml /var/local/jboss/server/EAOper/conf/log4j.xml.bak
echo "" > /var/local/jboss/server/EAOper/conf/log4j.xml
vi /var/local/jboss/server/EAOper/conf/log4j.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration SYSTEM "log4j.dtd">
<configuration xmlns="http://jakarta.apache.org/log4j/" debug="true">
<!--
EA重发消息日志配置
-->
<appender class="org.apache.log4j.FileAppender" name="msgToResend">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m%n"/>
</layout>
<param name="File" value="msgQueue.info" />
<param name="Append" value="true" />
</appender>
<!--
EA总体日志配置
-->
<appender name="dailyLog" class="org.jboss.logging.appender.DailyRollingFileAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="File" value="${jboss.server.home.dir}/log/server.log"/>
<param name="Append" value="true"/> <!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd"/> <layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>
<!--
EA重发消息日志
-->
<logger name="com.sitechasia.ea.eamessage.app.SendMessageThread">
<level value="info"/>
<appender-ref ref="msgToResend" />
</logger>
<!--
EA总体日志
-->
<root>
<level value="info"/>
<appender-ref ref="dailyLog" />
</root>
</configuration> 将jboss的启动脚本加入到linux的启动脚本
su - root vi /etc/rc.local su - jboss -c 'nohup /var/local/jboss/bin/run.sh -c EAOper & '
1.软件概述
1.1自助建站运营/运维系统是基于ASP运营模式的企业运营管理平台系统,由独立的应用服务器分别提供统一运营管理功能、
各产品运营系统的功能。
1.2开发语言
本系统采用J2EE技术架构,使用到java, xml, xsl,javascript,html等各项技术,数据库使用MySQL
2.运行环境及安装说明
2.1硬件说明所需硬件设备列表
硬盘空间:80GB
CPU:双至强2GHZ
RAM:2GB
2.2 软件系统说明
操作系统: 版本
redhat AS4
JAVA(J2SDK) 版本
SUN J2SDK For Linux 1.4.2_06
应用服务器 版本
jboss Application Server 4.0.1
数据库服务器 版本
MySQL 5.0.21
客户端浏览器 版本
Internet Explorer 5.0(版本:5.00.3700.1000)或以上 2.3 Linux环境安装步骤说明
分区 大小
/boot 100m
/ 5G
/usr 10G
/var 30G
/tmp 2G
swap 4G 选择默认系统语言:简体中文
2.4 jdk安装
chmod +x j2sdk-1_4_2_06-linux-i586.bin
。/j2sdk-1_4_2_06-linux-i586.bin
mv j2sdk-1_4_2_06 /var/local/
配置环境变量
vi /etc/profile
JAVA_HOME=/var/local/j2sdk1.4.2_06
CLASSPATH=/var/local/j2sdk1.4.2_06/lib/dt.jar:/var/local/j2sdk1.4.2_06/lib/htmlconverter.jar \
:/var/local/j2sdk1.4.2_06/lib/tools.jar
PATH=/var/local/j2sdk1.4.2_06/bin:/var/local/j2sdk1.4.2_06/jre/bin:$PATH
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME CLASSPATH
# sh /etc/profile
如果默认安装了java则:mv /usr/bin/java /usr/bin/java.bak
mv /usr/bin/javac /usr/bin/javac.bak
测试java环境 which java
出现 /var/local/j2sdk1.4.2_06/bin/java
2.5 mysql数据库安装
安装位置/var/local/mysql
groupadd mysql
useradd -g mysql -d /var/local/mysql mysql
tar zxvf mysql-5.0.21.tar.gz
cd mysql-5.0.21
./configure --prefix=/var/local/mysql
make && make install
/var/local/mysql/bin/mysql_install_db --user=mysql(建立数据库)
chmod +777 -R /var/local/mysql
chown -R mysql.mysql /var/local/mysql
建立开机启动
cp /var/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on
将配置文件放到/etc/
cp /var/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
启动mysql
/var/local/mysql/bin/mysqld_safe & 建立数据库
/var/local/mysql/bin/mysql -u root -p mysql> create database weblogic ;
mysql>alter database weblogic collate utf8_bin;
mysql>grant all on weblogic.* to weblogic@'%' identified by "weblogic"
登陆数据库
/var/local/mysql/bin/mysql weblogic -u weblogic -p 2.6 jboss Application Server 4.0.1
建立用户
mkdir /var/local/jboss
guoupadd jboss
useradd -g jboss -d /var/local/jboss/ jboss
passwd jboss
chown -R jboss.jboss /var/local/jboss/
将jboss-4.0.1.tar.gz解压
tar -xzvf tar -xzvf jboss-4.0.1.tar.gz
chown -R jboss.jboss jboss-4.0.1
登陆到jboss用户
su - jboss
拷贝jboss-4.0.1下的所有文件到jboss主目录
cp -rf jboss-4.0.1/* /var/local/jboss/
$jboss安装路径/server下创建目录EAOper;
mkdir -p /var/local/jboss/server/EAOper
$jboss安装路径/server/default中的目录和文件全部copy到$jboss安装路径/server/EAOper;
cp -rf /var/local/jboss/server/default/* /var/local/jboss/server/EAOper/
删除/var/local/jboss/lib/commons-httpclient.jar
mv /var/local/jboss/lib/commons-httpclient.jar /var/local/jboss/lib/commons-httpclient.jar.bak
解压EAOper.ear
cp 解压后APP-INF/lib/下的mysql-connector-java-3.1.11-bin.jar SetCharacterEncodingFilter.jar 到
cp mysql-connector-java-3.1.11-bin.jar /var/local/jboss/server/EAOper/lib/
cp SetCharacterEncodingFilter.jar /var/local/jboss/server/EAOper/lib/
修改如下配置文件
1.vi /var/local/jboss/server/EAOper/deploy/jbossweb-tomcat50.sar/META-INF/jboss-service.xml
把属性UseJBossWebLoader的值由true改成false;
2.vi /var/local/jboss/server/EAOper/deploy/jbossweb-tomcat50.sar/server.xml 配置默认的8080端口改为8000端口:
把<Connector port="8080" address="${jboss.bind.address}"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>
改为:
"<Connector port="8000" address="${jboss.bind.address}"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>" 配置语言
把:
<Connector port="8000" address="${jboss.bind.address}"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>
改为:
<Connector port="8000" address="${jboss.bind.address}"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/> 3. vi /var/local/jboss/server/EAOper/deploy/jbossweb-tomcat50.sar/conf/web.xml
在web-app节点中增加节点如下:
<filter>
<filter-name>SetCharacterEncoding</filter-name>
<filter-class>filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SetCharacterEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> 4. vi /var/local/jboss/bin/run.sh
export LANG=zh_CN.UTF-8
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Ddefault.client.encoding=UTF-8 -Duser.language=en -Duser.region=CN" 5.vi /var/local/jboss/bin/run.conf JAVA_OPTS="-server -Xms128m -Xmx128m"
修改为:
JAVA_OPTS="-server -Xms1024m -Xmx1024m"
启动创建的jboss服务 (注用jboss用户启动)
cd
cd bin
nohup ./run.sh -c EAOper & 配置jboss的数据源
touch /var/local/jboss/server/EAOper/deploy/mysql-ds.xml
编辑内容如下
<?xml version="1.0" encoding="UTF-8"?>
<!-- The Hypersonic embedded database JCA connection factory config
$Id: hsqldb-ds.xml,v 1.15 2004/09/15 14:37:40 loubyansky Exp $ -->
<datasources>
<local-tx-datasource>
<jndi-name>DataSource</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:mysql://mysql数据库所在ip:3306/weblogic</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<!-- 最小连接数 -->
<min-pool-size>30</min-pool-size>
<!-- 最大连接数 -->
<max-pool-size>30</max-pool-size>
<!--对于数据库事务,应选择较低成本的事务等级,避免造成坏数据。递增成本的事务等级包括:
TRANSACTION_READ_UNCOMMITED,
TRANSACTION_READ_COMMITED,
TRANSACTION_REPEATABLE_READ,
TRANSACTION_SERIALIZABLE
-->
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<!-- 抛出异常前最大的等待连接时间 -->
<blocking-timeout-millis>30000</blocking-timeout-millis>
<!--关闭连接前连接空闲的最大时间 -->
<idel-timeout-minutes>10</idel-timeout-minutes>
<!--有ByContainerAndApplication、ByContainer、ByApplication和ByNothing等值 -->
<criteria>ByContainer</criteria>
<user-name>weblogic</user-name>
<password>weblogic</password>
<connection-property name="SendStringParametersAsUnicode">false</connection-property>
<metadata>
<type-mapping>Mysql</type-mapping>
</metadata>
</local-tx-datasource>
<local-tx-datasource>
<jndi-name>logtest</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:mysql://mysql数据库所在ip/logtest</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<!-- 最小连接数 -->
<min-pool-size>30</min-pool-size>
<!-- 最大连接数 -->
<max-pool-size>30</max-pool-size>
<!--对于数据库事务,应选择较低成本的事务等级,避免造成坏数据。递增成本的事务等级包括:
TRANSACTION_READ_UNCOMMITED,
TRANSACTION_READ_COMMITED,
TRANSACTION_REPEATABLE_READ,
TRANSACTION_SERIALIZABLE
-->
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<!-- 抛出异常前最大的等待连接时间 -->
<blocking-timeout-millis>10000</blocking-timeout-millis>
<!--关闭连接前连接空闲的最大时间 -->
<idel-timeout-minutes>10</idel-timeout-minutes>
<!--有ByContainerAndApplication、ByContainer、ByApplication和ByNothing等值 -->
<criteria>ByContainer</criteria>
<user-name>logtest</user-name>
<password>logtest</password>
<connection-property name="SendStringParametersAsUnicode">false</connection-property>
<metadata>
<type-mapping>Mysql</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
配置运行日志
cp /var/local/jboss/server/EAOper/conf/log4j.xml /var/local/jboss/server/EAOper/conf/log4j.xml.bak
echo "" > /var/local/jboss/server/EAOper/conf/log4j.xml
vi /var/local/jboss/server/EAOper/conf/log4j.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration SYSTEM "log4j.dtd">
<configuration xmlns="http://jakarta.apache.org/log4j/" debug="true">
<!--
EA重发消息日志配置
-->
<appender class="org.apache.log4j.FileAppender" name="msgToResend">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m%n"/>
</layout>
<param name="File" value="msgQueue.info" />
<param name="Append" value="true" />
</appender>
<!--
EA总体日志配置
-->
<appender name="dailyLog" class="org.jboss.logging.appender.DailyRollingFileAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="File" value="${jboss.server.home.dir}/log/server.log"/>
<param name="Append" value="true"/> <!-- Rollover at midnight each day -->
<param name="DatePattern" value="'.'yyyy-MM-dd"/> <layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>
<!--
EA重发消息日志
-->
<logger name="com.sitechasia.ea.eamessage.app.SendMessageThread">
<level value="info"/>
<appender-ref ref="msgToResend" />
</logger>
<!--
EA总体日志
-->
<root>
<level value="info"/>
<appender-ref ref="dailyLog" />
</root>
</configuration> 将jboss的启动脚本加入到linux的启动脚本
su - root vi /etc/rc.local su - jboss -c 'nohup /var/local/jboss/bin/run.sh -c EAOper & '
相关阅读 更多 +