您的位置:首页 > 运维架构 > Docker

主机安装部署TPC_W测试环境,以及在docker容器中安装部署TPC_W测试环境

2015-04-02 15:20 579 查看
依据文章:http://www.cppblog.com/LIULIANG/archive/2012/09/23/191710.aspx (辅,ubuntu环境)
http://blog.csdn.net/cybercode/article/details/6737415 (主,centos环境)

(1)下载TPC-W(java版):http://pharm.ece.wisc.edu/tpcw/tpcw.tar.gz

解压缩后就是一个文件夹tpcw1.0

#(/root)wget http://pharm.ece.wisc.edu/tpcw/tpcw.tar.gz (第二次安装用的amy用户sudo)

(2)jdk

参考博客链接:http://www.linuxidc.com/Linux/2010-11/29913.htm
http://www.cppblog.com/LIULIANG/archive/2012/09/23/191710.aspx http://blog.csdn.net/cybercode/article/details/6737415
尝试一:

#(/usr/local)mkdir java

#(java)wget http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64-rpm.bin
#chmod +x jdk-7-linux-x64-rpm.bin

#./jdk-7-linux-x64-rpm.bin

报错如下:./jdk-6u22-linux-x64-rpm.bin: line 1: html: No such file or directory

./jdk-6u22-linux-x64-rpm.bin: line 2: head: No such file or directory

./jdk-6u22-linux-x64-rpm.bin: line 3: title: No such file or directory

./jdk-6u22-linux-x64-rpm.bin: line 4: META: No such file or directory

./jdk-6u22-linux-x64-rpm.bin: line 5: link: No such file or directory

./jdk-6u22-linux-x64-rpm.bin: line 6: link: No such file or directory

./jdk-6u22-linux-x64-rpm.bin: line 7: $'\r': command not found

./jdk-6u22-linux-x64-rpm.bin: line 8: body: No such file or directory

./jdk-6u22-linux-x64-rpm.bin: line 9: div: No such file or directory

./jdk-6u22-linux-x64-rpm.bin: line 10: table: No such file or directory

./jdk-6u22-linux-x64-rpm.bin: line 11: tr: No such file or directory

./jdk-6u22-linux-x64-rpm.bin: line 12: syntax error near unexpected token `<'

./jdk-6u22-linux-x64-rpm.bin: line 12: ` <td rowspan="2" valign="middle" nowrap>

<a href="http://www.oracle.com"><img src="/errors/us/assets/oralogo-small.gif" width="154" height="19" hspa'e="10" vspace="25" border="0" >

</a></td>

尝试二:

采取在官网: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 使用win本机下载 jdk-8u40-linux-x64.rpm(rpm安装包)和jdk-8u40-linux-x64.tar.gz(进行编译安装)

将jdk-8u40-linux-x64.rpm传至/usr/local/

#(/usr/local)rpm -ivh jdk-8u40-linux-x64.rpm

安装完成后,默认将安装路径 /usr/java文件下,因此$JAVA_HOME=/usr/java/jdk1.8.0_40

(3)apache_tomcat安装

参考文件连接: http://blog.itpub.net/27099995/viewspace-1340689/ http://wanwentao.blog.51cto.com/2406488/548796 http://blog.csdn.net/cybercode/article/details/6737415
本机apache官网下载apache-tomcat-8.0.20.tar.gz:
http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.0.20/bin/apache-tomcat-8.0.20.tar.gz
将apache-tomcat-8.0.20.tar.gz传至/usr/local/

#(/usr/local)tar -xvf apache-tomcat-8.0.20.tar.gz (local下多一个apache-tomcat-8.0.20目录)

#(/usr/local)ln -s /usr/local/apache-tomcat-8.0.20/ /usr/local/tomcat

安装路径:/usr/local/apache-tomcat-8.0.20

(4)安装MySQL服务器端

#yum install mysql-server (centos6直接运行)

报错如下:Loaded plugins: fastestmirror, product-id, subscription-manager

This system is not registered with Subscription Management. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile

No package mysql-server available.

Error: Nothing to do

#yum search mysql (centos7中的情况)

返回结果如下:Loaded plugins: fastestmirror, product-id, subscription-manager

This system is not registered with Subscription Management. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile

====================================== N/S matched: mysql ======================================

MySQL-python.x86_64 : An interface to MySQL

akonadi-mysql.x86_64 : Akonadi MySQL backend support

apr-util-mysql.x86_64 : APR utility library MySQL DBD driver

dovecot-mysql.x86_64 : MySQL back end for dovecot

freeradius-mysql.x86_64 : MySQL support for freeradius

libdbi-dbd-mysql.x86_64 : MySQL plugin for libdbi

mysql-connector-java.noarch : Official JDBC driver for MySQL

mysql-connector-odbc.x86_64 : ODBC driver for MySQL

perl-DBD-MySQL.x86_64 : A MySQL interface for Perl

php-mysql.x86_64 : A module for PHP applications that use MySQL databases

php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases

qt-mysql.i686 : MySQL driver for Qt's SQL classes

qt-mysql.x86_64 : MySQL driver for Qt's SQL classes

qt3-MySQL.i686 : MySQL drivers for Qt 3's SQL classes

qt3-MySQL.x86_64 : MySQL drivers for Qt 3's SQL classes

redland-mysql.x86_64 : MySQL storage support for Redland

rsyslog-mysql.x86_64 : MySQL support for rsyslog

mariadb.x86_64 : A community developed branch of MySQL

mariadb-devel.i686 : Files for development of MariaDB/MySQL applications

mariadb-devel.x86_64 : Files for development of MariaDB/MySQL applications

mariadb-libs.i686 : The shared libraries required for MariaDB/MySQL clients

mariadb-libs.x86_64 : The shared libraries required for MariaDB/MySQL clients

Name and summary matches only, use "search all" for everything.

网上搜索关键字:centos7上mariadb与原有mysql区别

---------------------------------------------------------------

从最新版本的linux系统开始,默认的是 Mariadb而不是mysql!

使用系统自带的repos安装很简单:

yum install mariadb mariadb-server

systemctl start mariadb ==> 启动mariadb

systemctl enable mariadb ==> 开机自启动

mysql_secure_installation ==> 设置 root密码等相关

mysql -uroot -p123456 ==> 测试登录!

结束!

---------------------------------------------------------------

mysql官网 http://dev.mysql.com/downloads/mysql/ 下载

尝试一:

######手动安装mysql方法:(你需要到mysql官方下载rpm包或者源码包编译安装)
http://blog.chinaunix.net/xmlrpc.php?r=blog/article&uid=22655236&id=3161631
尝试二:

######换成安装mariadb:http://jingyan.baidu.com/album/ce436649fec8533773afd385.html?picindex=9
http://www.tuicool.com/articles/fIviqq
=================================================================================

最终选用方法: http://www.21ops.com/ops/30008.html http://my.oschina.net/u/919612/blog/310533(这个更靠谱!!)
找到mysql5.6的centos的repo源,终于解决mysql的安装问题:

#(/usr/local)wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm(下载mysql的repo源)
#(/usr/local)rpm -ivh mysql-community-release-el7-5.noarch.rpm (安装这个包后,会获得两个mysql的yum repo源)

结果如下:

Preparing... ################################# [100%]

Updating / installing...

1:mysql-community-release-el7-5 ################################# [100%]

[amy@localhost local]$ cd /etc/yum.repos.d

[amy@localhost yum.repos.d]$ ll

total 12

-rw-r--r--. 1 root root 615 Mar 27 07:01 CentOS7-Base-163.repo

-rw-r--r-- 1 root root 1209 Jan 29 2014 mysql-community.repo

-rw-r--r-- 1 root root 1060 Jan 29 2014 mysql-community-source.repo

# yum install mysql-community-server

结果如下:

Loaded plugins: fastestmirror, product-id, subscription-manager

This system is not registered with Subscription Management. You can use subscription-manager to register.

base | 3.6 kB 00:00:00

extras | 3.4 kB 00:00:00

mysql-connectors-community | 2.5 kB 00:00:00

mysql-tools-community | 2.5 kB 00:00:00

mysql56-community | 2.5 kB 00:00:00

...................

Installed:

mysql-community-libs.x86_64 0:5.6.23-3.el7 mysql-community-server.x86_64 0:5.6.23-3.el7

Dependency Installed:

mysql-community-client.x86_64 0:5.6.23-3.el7 mysql-community-common.x86_64 0:5.6.23-3.el7

Replaced:

mariadb-libs.x86_64 1:5.5.41-2.el7_0

Complete!

成功安装之后重启mysql服务

# service mysqld restart

查看mysql配置文件/etc/my.cnf

[amy@localhost etc]$ cat my.cnf

## For advice on how to change settings please see

..........

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

# Recommended in standard MySQL setup

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

查找mysql的安装路径

#[root@docker188 usr]# find /usr -name mysql

/usr/bin/mysql

/usr/lib64/mysql

/usr/share/mysql

根据步骤安装就可以了,不过安装完成后,没有密码,需要设置密码:

(法一)

#mysql_secure_installation

(MySQL安全配置向导mysql_secure_installation详解:http://www.jb51.net/article/47727.htm)

(法二)

初次安装mysql是root账户是没有密码的,置密码的方法 :

mysql -u root

根据mysql的命令行来更改:

mysql> use mysql;

mysql> update user set password=PASSWORD("GIVE-NEW-ROOT-PASSWORD") where User='root';

mysql> flush privileges;

mysql> quit

成功登陆:

[root@docker188 usr]# mysql -uroot -proot

=================================================================================

(5)下载并配置JDBC MySQL驱动

mysql-connector-java-5.1.26-bin.jar

#(/usr/local/apache-tomcat-8.0.20/webapps/servlet/WEB-INF/lib)rz(从桌面传jar包)

#

(6)环境变量设置:

根据自己安装软件的路径在/etc/profile文件末尾添加:

export JAVA_HOME=/usr/java/jdk1.8.0_40

export CATALINA_HOME=/usr/local/apache-tomcat-8.0.20

export PATH=$JAVA_HOME/bin:$CATALINA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/lib/servlet-api.jar:$CATALINA_HOME/webapps/servlet/WEB-INF/lib/mysql-connector-java-5.1.26-bin.jar:$CLASSPATH

!!!保存,关闭profile文件,然后使当前配置生效,使用命令如下:

#source /etc/profile (若提示命令找不到,则使用下面一行的命令)

#. /etc/profile (注意.和/etc/profile之间有空格)

然后再使用命令查看是否安装成功,命令如下

[amy@localhost etc]$ java -version

java version "1.8.0_40"

Java(TM) SE Runtime Environment (build 1.8.0_40-b26)

Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode) 说明安装成功了

7 修改部分源码

[amy@localhost populate]$ pwd

/home/amy/tpcw1.0/populate

[amy@localhost populate]$ cat populate_images

所有要修改的文件:tpcw1.0\populate\populate_images

tpcw1.0\populate\TPCW_Populate.java

tpcw1.0\servlets\TPCW_Database.java(其中“将Prepare SQL语句改成MySql语句”可以忽略)

tpcw1.0\servlets\TPCW_Util.java

tpcw1.0\rbe\RBE.java

tpcw1.0/rbe/util/Debug.java

tpcw1.0/rbe/EB.java

tpcw1.0/rbe/util/CharSetStrPattern.java

tpcw1.0/rbe/util/Histogram.java

${CATALINA_HOME}/webapps/servlet/WEB-INF/web.xml(复制粘贴就好了)

具体参照http://blog.csdn.net/cybercode/article/details/6737415)

8 在MySQL中创建数据库tpcw2

[amy@docker188 ~]$ mysql -uroot -proot

Warning: Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

......

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE tpcw2;

Query OK, 1 row affected (0.00 sec)

mysql> exit

9 开始安装TPC-W:

[amy@docker188 ~]$ sudo mkdir -p ${CATALINA_HOME}/webapps/tpcw/Images (成功)

[amy@docker188 ~]$ sudo mkdir -p ${CATALINA_HOME}/webapps/servlet/WEB-INF/classes (成功)

10 在数据库tpcw2中生成数据:(如下报错)

[amy@docker188 populate]$ pwd

/home/amy/tpcw1.0/populate

[amy@docker188 populate]$ sudo systemctl start mysqld.service

[amy@docker188 populate]$ javac TPCW_Populate.java

TPCW_Populate.java:266: error: unmappable character for encoding UTF8

//myql??????linux?????????д?Сд???, ???com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'tpcw2.ADDRESS'

^

(报错原因分析:在eclipse集成环境中修改代码eclipse编码为gbk . 其中的注释中一些非UTF-8的文字无法识别。重新修改代码,去掉注释行 或者 用记事本保存为UTF-8 或者 )

[amy@docker188 populate]$ javac -encoding gbk TPCW_Populate.java

[amy@docker188 populate]$ ll

total 72

-rwxr-xr-x 1 amy amy 141 Feb 25 2000 Makefile

-rwxr-xr-x 1 amy amy 1659 Mar 27 23:06 populate_images

-rw-rw-r-- 1 amy amy 26044 Mar 29 20:33 TPCW_Populate.class (说明编译成功)

-rwxr-xr-x 1 amy amy 35621 Mar 29 08:57 TPCW_Populate.java

(运行文件TPCW_Populate.class报错如下:)

[amy@docker188 populate]$ java TPCW_Populate

Beginning TPCW Database population.

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)

.........

解决方法:在188服务器搭建mysql时给了root用户密码root,代码中没有给密码.代码更改如下:

try {

Class.forName(driverName);

con = DriverManager.getConnection(dbName, "root", "root");//(dbName);此处添加密码root

con.setAutoCommit(false);//解决java.sql.SQLException: Can't call commit when autocommit=true

}

删除TPCW_Populate.class文件,重新编译运行。

[amy@docker188 populate]$ javac -encoding gbk TPCW_Populate.java

[amy@docker188 populate]$ java TPCW_Populate

Beginning TPCW Database population.

Already dropped table ADDRESS

Already dropped table AUTHOR

Already dropped table CC_XACTS

Already dropped table COUNTRY

Already dropped table CUSTOMER

Already dropped table ITEM

Already dropped table ORDER_LINE

Already dropped table ORDERS

Already dropped table SHOPPING_CART

Already dropped table SHOPPING_CART_LINE

Done deleting tables!

Created table ADDRESS

Created table AUTHOR

Created table CC_XACTS

Created table COUNTRY

Created table CUSTOMER

Created table ITEM

Created table ORDER_LINE

Created table ORDERS

Created table SHOPPING_CART

Created table SHOPPING_CART_LINE

Done creating tables!

Populating ADDRESS Table with 288000 addresses

Complete (in 10,000's): 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

Populating AUTHOR Table with 2500 authors

Unable to populate AUTHOR table

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'tpcw2.AUTHOR' doesn't exist

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:422)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

at com.mysql.jdbc.Util.getInstance(Util.java:386)

at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190)

at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122)

at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)

at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)

at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2818)

at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2157)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2460)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2377)

at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2361)

at TPCW_Populate.populateAuthorTable(TPCW_Populate.java:333)

at TPCW_Populate.main(TPCW_Populate.java:93)

出现报错:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'tpcw2.AUTHOR' doesn't exist

代码更改如下:try {

PreparedStatement statement = con.prepareStatement

("INSERT INTO author(A_ID,A_FNAME,A_LNAME,A_MNAME,A_DOB,A_BIO) VALUES (?, ?, ?, ?, ?, ?)");

依次同上,报错:Unable to populate COUNTRY table

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'tpcw2.COUNTRY' doesn't exist

成功执行的样子:

[amy@docker188 populate]$ javac -encoding gbk TPCW_Populate.java

[amy@docker188 populate]$ java TPCW_Populate

Beginning TPCW Database population.

Already dropped table ADDRESS

Already dropped table AUTHOR

Already dropped table CC_XACTS

Already dropped table COUNTRY

Already dropped table CUSTOMER

Already dropped table ITEM

Already dropped table ORDER_LINE

Already dropped table ORDERS

Already dropped table SHOPPING_CART

Already dropped table SHOPPING_CART_LINE

Done deleting tables!

Created table ADDRESS

Created table AUTHOR

Created table CC_XACTS

Created table COUNTRY

Created table CUSTOMER

Created table ITEM

Created table ORDER_LINE

Created table ORDERS

Created table SHOPPING_CART

Created table SHOPPING_CART_LINE

Done creating tables!

Populating ADDRESS Table with 288000 addresses

Complete (in 10,000's): 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

Populating AUTHOR Table with 2500 authors

Populating COUNTRY with 92 countries

Populating CUSTOMER Table with 144000 customers

Complete (in 10,000's): 1 2 3 4 5 6 7 8 9 10 11 12 13 14

Populating ITEM table with 10000 items

Populating ORDERS, ORDER_LINES, CC_XACTS with 129600 orders

Complete (in 10,000's): 1 2 3 4 5 6 7 8 9 10 11 12

Adding Indexes

Done

[amy@docker188 populate]$ sudo cp TPCW_Populate.class ${CATALINA_HOME}/webapps/servlet/WEB-INF/classes

[sudo] password for amy:

[amy@docker188 populate]$ cd ${CATALINA_HOME}/webapps/servlet/WEB-INF/

[amy@docker188 WEB-INF]$ ll

total 0

drwxr-xr-x 2 root root 32 Mar 29 22:41 classes

drwxr-xr-x 2 root root 48 Mar 27 22:18 lib

[amy@docker188 WEB-INF]$

11 生成并部署图片

[amy@docker188 ImgGen]$ cd ImgFiles

[amy@docker188 ImgFiles]$ pwd

/home/amy/tpcw1.0/ImgGen/ImgFiles

[amy@docker188 ImgFiles]$ make

执行后没有error,只有warning

————————————————————————————————————————————————————————————————————————————

请问make 和 make install 时出现什么提示证明编译安装成功呢?

(1)

观察你能看到的最后几行

出现error就没成功

出现waring可以无视

(2)

如果编译出错的话,make就会停止,然后打印出一堆Error,如果成功编译完了,是没有Error、错误等字样出现的。判断是否成功只要看make打印信息的末尾是不是有Error。

如果想见证一下错误,就在源代码里故意弄几个错误,make最后就会出错,然后可以观察一下错误信息。

————————————————————————————————————————————————————————————————————————————

题外话,在centos6起的docker容器中,默认没有make命令,需要:#yum -y install gcc automake autoconf libtool make

(继续吧)

[amy@docker188 ImgFiles]$ pwd

/home/amy/tpcw1.0/ImgGen/ImgFiles

[amy@docker188 ImgFiles]$ cd ..

[amy@docker188 ImgGen]$ pwd

/home/amy/tpcw1.0/ImgGen

[amy@docker188 ImgGen]$ cd ../populate

[amy@docker188 populate]$ pwd

/home/amy/tpcw1.0/populate

[amy@docker188 populate]$ sudo perl populate_images 执行正常

[amy@docker188 populate]$ sudo cp ../images/* ${CATALINA_HOME}/webapps/tpcw/Images

12 编译并部署servlets

[amy@docker188 servlets]$ javac *.java

报错两次:1,原文中对TPCW_Database.java文件中,sql语句没有加“;”

2,TPCW_Database.java:347: error: illegal character: '\'

解决方法:TPCW_Database.java文件中只改连接mysql数据库部分,其他将prepare SQL语句改为mysql语句部分不改。

[amy@docker188 servlets]$ javac *.java

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: Some input files use unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

(当前目录下每个都生成字节码,没报错就行。)

#cp *.class ${CATALINA_HOME}/webapps/servlet/WEB-INF/classes

vi ${CATALINA_HOME}/webapps/servlet/WEB-INF/web.xml

13 编译RBE

[amy@docker188 util]$ pwd

/home/amy/tpcw1.0/rbe/util

[amy@docker188 util]$ javac *.java

(执行完什么反应也没有,说明没错)

[amy@docker188 util]$ cd ../args

[amy@docker188 args]$ mkdir -p rbe/util

[amy@docker188 args]$ cp ../util/*.class rbe/util/

[amy@docker188 args]$ pwd

/home/amy/tpcw1.0/rbe/args

[amy@docker188 args]$ cd rbe/util/

[amy@docker188 util]$ ll

total 44

-rw-r--r-- 1 amy amy 749 Mar 30 09:25 AbCharStrPattern.class

-rw-r--r-- 1 amy amy 421 Mar 30 09:25 CharRangeStrPattern.class

-rw-r--r-- 1 amy amy 1975 Mar 30 09:25 CharSetStrPattern.class

-rw-r--r-- 1 amy amy 364 Mar 30 09:25 CharStrPattern.class

-rw-r--r-- 1 amy amy 629 Mar 30 09:25 Debug.class

-rw-r--r-- 1 amy amy 508 Mar 30 09:25 DebugError.class

-rw-r--r-- 1 amy amy 2970 Mar 30 09:25 Histogram.class

-rw-r--r-- 1 amy amy 2833 Mar 30 09:25 Pad.class

-rw-r--r-- 1 amy amy 1007 Mar 30 09:25 StringPattern.class

-rw-r--r-- 1 amy amy 1063 Mar 30 09:25 StrStrPattern.class

-rw-rw-r-- 1 amy amy 3004 Mar 30 09:25 TestPattern.class

[amy@docker188 args]$ mkdir rbe/args

[amy@docker188 args]$ javac *.java

Note: ArgDB.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

[amy@docker188 args]$ cp *.class rbe/args/

[amy@docker188 args]$ mv rbe ../

[amy@docker188 args]$ pwd

/home/amy/tpcw1.0/rbe/args

[amy@docker188 args]$ cd ..

[amy@docker188 rbe]$

[amy@docker188 rbe]$ javac *.java

EB.java:317: warning: unreachable catch clause

catch (IOException ioe) {

^

thrown type MalformedURLException has already been caught

Note: RBE.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: Some input files use unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

1 warning

14 测试TPC-W:

启动tomcat

[amy@docker188 bin]$ pwd

/usr/local/apache-tomcat-8.0.20/bin

[amy@docker188 bin]$ sudo ./startup.sh

[sudo] password for amy:

Using CATALINA_BASE: /usr/local/apache-tomcat-8.0.20

Using CATALINA_HOME: /usr/local/apache-tomcat-8.0.20

Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.0.20/temp

Using JRE_HOME: /

Using CLASSPATH: /usr/local/apache-tomcat-8.0.20/bin/bootstrap.jar:/usr/local/apache-tomcat-8.0.20/bin/tomcat-juli.jar

Tomcat started.

访问http://localhost:8080/servlet/TPCW_home_interaction页面测试是否安装成功

(localhost换成部署你环境的主机ip;如果是容器,localhost为docker守护进程所在宿主机的ip,8080端口换成你主机映射docker容器的端口(如主机49154->8080,则端口写49154))

浏览器无结果:参考方法 http://blog.csdn.net/kergp/article/details/9136607 http://blog.csdn.net/lastsweetop/article/details/7412710
可以vi 打开 /etc/sysconfig/iptables 的文件中追加

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

#iptables -F 这个命令可以清除CentOS中iptables自带防火墙默认规则

15 运行TPC-W:

[amy@docker188 ~]$ cd tpcw1.0/

[amy@docker188 ~]$java rbe.RBE -EB rbe.EBTPCW1Factory 30 -OUT test.m -RU 100 -MI 1000 -RD 100 -CUST 10000 -ITEM 10000

模拟试试:(可以进数据库查看当前访问进程)

mysql> show processlist;

---------------------------------------------------------

数据库方面涉及:

(1)在mysql数据库中加入允许远程访问的test用户,用户密码也是test:

mysqk>GRANT USAGE ON *.* TO 'test'@'%' IDENTIFIED BY 'test' WITH GRANT OPTION;

mysql>grant all privileges on *.* to 'test'@'%' identified by 'test';

mysql>flush privileges;//刷新系统权限表

下面这种方法会报错:

mysql>insert into mysql.user(Host,User,Password) values("%","test",password("test"));会报错!!!

(Mysql添加用户错误:ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value解决方法)

可能用到的命令

netstat -apn | grep 8080

iptables -l

iptables -h

iptables -L

sudo systemctl stop iptables.service

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

在容器中部署TPC_W的方法

基础镜像尽量选择centos6(centos7在安装mysql的时候你会很痛苦,service命令等都精简的没了)

其他部分同上面安装方法一样,只是可能需要 #yum install tar wget等

若yum源链接总是提示超时,可以在/etc/yum.conf末尾添加timeout=1200

容器中使用make命令:

容器部署问题:

bash-4.1# make

gcc -O -v -I/root/aaa/tpcw1.0/ImgGen/ImgFiles -c -o cjpeg.o cjpeg.c

make: gcc: Command not found

make: *** [cjpeg.o] Error 127

bash-4.1# yum -y install gcc automake autoconf libtool make
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: