693579551 发表于 2015-10-13 09:35:05

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

依据文章:http://www.cppblog.com/LIULIANG/archive/2012/09/23/191710.aspx (辅,ubuntu环境)
          http://blog.iyunv.com/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.iyunv.com/Linux/2010-11/29913.htm
            http://www.cppblog.com/LIULIANG/archive/2012/09/23/191710.aspx
            http://blog.iyunv.com/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=&quot;2&quot; valign=&quot;middle&quot; nowrap>
<a href=&quot;http://www.oracle.com&quot;><img src=&quot;/errors/us/assets/oralogo-small.gif&quot; width=&quot;154&quot; height=&quot;19&quot; hspa'e=&quot;10&quot; vspace=&quot;25&quot; border=&quot;0&quot; >
</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.iyunv.com/2406488/548796
               http://blog.iyunv.com/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 &quot;search all&quot; 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.iyunv.com/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...                        #################################
Updating / installing...                                                      
   1:mysql-community-release-el7-5    #################################




$ cd /etc/yum.repos.d
$ ll
total 12
-rw-r--r--. 1 root root615 Mar 27 07:01 CentOS7-Base-163.repo
-rw-r--r--1 root root 1209 Jan 292014 mysql-community.repo
-rw-r--r--1 root root 1060 Jan 292014 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 kB00:00:00   
extras                                                                   | 3.4 kB00:00:00   
mysql-connectors-community                                             | 2.5 kB00:00:00   
mysql-tools-community                                                    | 2.5 kB00:00:00   
mysql56-community                                                      | 2.5 kB00: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
$ 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



log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid                                                      
                                                                        
                                                                              
查找mysql的安装路径                                                            
## find /usr -name mysql                                    
/usr/bin/mysql                                                                  
/usr/lib64/mysql                                                               
/usr/share/mysql                                                               
         
根据步骤安装就可以了,不过安装完成后,没有密码,需要设置密码:
(法一)
#mysql_secure_installation
(MySQL安全配置向导mysql_secure_installation详解:http://www.iyunv/article/47727.htm)   
(法二)                                                                  
初次安装mysql是root账户是没有密码的,置密码的方法 :                                                               
mysql -u root
      
根据mysql的命令行来更改:


mysql> use mysql;
mysql> update user set password=PASSWORD(&quot;GIVE-NEW-ROOT-PASSWORD&quot;) where User='root';
mysql> flush privileges;
mysql> quit                                                                        
                                                                              
成功登陆:                                                                     
# 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之间有空格)


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


$ java -version
java version &quot;1.8.0_40&quot;
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修改部分源码


$ pwd
/home/amy/tpcw1.0/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.iyunv.com/cybercode/article/details/6737415)


8 在MySQL中创建数据库tpcw2
$ 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:
$ sudo mkdir -p ${CATALINA_HOME}/webapps/tpcw/Images(成功)
$ sudo mkdir -p ${CATALINA_HOME}/webapps/servlet/WEB-INF/classes (成功)


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


$ pwd
/home/amy/tpcw1.0/populate
$ sudo systemctl startmysqld.service
$ 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 或者 )
$ javac -encoding gbk TPCW_Populate.java
$ ll
total 72
-rwxr-xr-x 1 amy amy   141 Feb 252000 Makefile
-rwxr-xr-x 1 amy amy1659 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报错如下:)


$ 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, &quot;root&quot;, &quot;root&quot;);//(dbName);此处添加密码root
         con.setAutoCommit(false);//解决java.sql.SQLException: Can't call commit when autocommit=true
    }


删除TPCW_Populate.class文件,重新编译运行。
$ javac -encoding gbk TPCW_Populate.java
$ 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
                (&quot;INSERT INTO author(A_ID,A_FNAME,A_LNAME,A_MNAME,A_DOB,A_BIO) VALUES (?, ?, ?, ?, ?, ?)&quot;);
依次同上,报错:Unable to populate COUNTRY table
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'tpcw2.COUNTRY' doesn't exist


成功执行的样子:
$ javac -encoding gbk TPCW_Populate.java
$ 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


$ sudo cp TPCW_Populate.class ${CATALINA_HOME}/webapps/servlet/WEB-INF/classes
password for amy:
$ cd ${CATALINA_HOME}/webapps/servlet/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
$




11 生成并部署图片


$ cd ImgFiles
$ pwd
/home/amy/tpcw1.0/ImgGen/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
(继续吧)
$ pwd
/home/amy/tpcw1.0/ImgGen/ImgFiles
$ cd ..
$ pwd
/home/amy/tpcw1.0/ImgGen
$ cd ../populate
$ pwd
/home/amy/tpcw1.0/populate
$ sudo perl populate_images   执行正常
$ sudo cp ../images/* ${CATALINA_HOME}/webapps/tpcw/Images


12 编译并部署servlets
$ javac *.java
报错两次:1,原文中对TPCW_Database.java文件中,sql语句没有加“;”
          2,TPCW_Database.java:347: error: illegal character: '\'


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


$ 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




$ pwd
/home/amy/tpcw1.0/rbe/util
$ javac *.java
(执行完什么反应也没有,说明没错)


$ cd ../args
$ mkdir -p rbe/util
$ cp ../util/*.class rbe/util/
$ pwd
/home/amy/tpcw1.0/rbe/args
$ cd rbe/util/
$ ll
total 44
-rw-r--r-- 1 amy amy749 Mar 30 09:25 AbCharStrPattern.class
-rw-r--r-- 1 amy amy421 Mar 30 09:25 CharRangeStrPattern.class
-rw-r--r-- 1 amy amy 1975 Mar 30 09:25 CharSetStrPattern.class
-rw-r--r-- 1 amy amy364 Mar 30 09:25 CharStrPattern.class
-rw-r--r-- 1 amy amy629 Mar 30 09:25 Debug.class
-rw-r--r-- 1 amy amy508 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




$ mkdir rbe/args
$ javac *.java
Note: ArgDB.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
$ cp *.class rbe/args/
$ mv rbe ../
$ pwd
/home/amy/tpcw1.0/rbe/args


$ cd ..
$
$ 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
$ pwd
/usr/local/apache-tomcat-8.0.20/bin
$ sudo ./startup.sh
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.iyunv.com/kergp/article/details/9136607
               http://blog.iyunv.com/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:
$ cd tpcw1.0/
$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(&quot;%&quot;,&quot;test&quot;,password(&quot;test&quot;));会报错!!!
(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
      


&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;
在容器中部署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: *** Error 127
bash-4.1# yum -y install gcc automake autoconf libtool make


         版权声明:本文为博主原创文章,未经博主允许不得转载。
页: [1]
查看完整版本: 主机安装部署TPC_W测试环境,以及在docker容器中安装部署TPC_W测试环境