将DB从H2迁移到Mysql,实时数据不能显示-已解决

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

将DB从H2迁移到Mysql,实时数据不能显示-已解决

taohuang
This post was updated on .
已解决:

mysql perf_test表的agent_stat和running_sample字段varchar长度设置比写入的小,导致不能显示,分别设置到varchar(1000)和varchar(10000)即可


I try to change db from h2 to mysql

1. Add mysql to Database.java




2. modify ~/.ngrinder/database.conf

database.type=mysql
database.url=localhost:3306/pftest
database.url_option=useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&nullNamePatternMatchesAll=true&nullCatalogMeansCurrent=true
database.username=root
database.password=root

3. mvn clean -Dmaven.test.skip=true package, redeploy war and run, return Missing table: AGENT

4. 我采用了liquibase导出h2数据,然后再导入到mysql的方式
liquibase --changeLogFile=db.changelog.h2.xml --driver=org.h2.Driver --classpath=/Users/huangtao/liquibase-3.6.2-bin/lib/h2-1.3.168.jar --url="jdbc:h2:/Users/huangtao/.ngrinder/db/h2" --username=admin --password=admin generateChangeLog

Reply | Threaded
Open this post in threaded view
|

Re: 将DB从H2迁移到Mysql,实时数据不能显示

taohuang
This post was updated on .
5. 使用liquibase导出当前h2 db的数据,再导入到mysql,返回“Unexpected error running Liquibase: Row size too large. ”

h2 db的字段长度限制似乎和mysql incompatible ?The maximum row size for the used table type is 65535

liquibase --changeLogFile=db.changelog.h2.org.xml --driver=com.mysql.jdbc.Driver --classpath=/Users/huangtao/liquibase-3.6.2-bin/lib/mysql-connector-java-5.1.47.jar --url="jdbc:mysql://localhost/ngrinder" --username=root --password=root update

Unexpected error running Liquibase: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs [Failed SQL: CREATE TABLE ngrinder.PERF_TEST (ID BIGINT AUTO_INCREMENT NOT NULL, CREATED_DATE timestamp NULL, LAST_MODIFIED_DATE timestamp NULL, AGENT_COUNT INT NULL, `DESCRIPTION` VARCHAR(2048) NULL, DISTRIBUTION_PATH VARCHAR(255) NULL, DURATION BIGINT NULL, ERRORS BIGINT NULL, FINISH_TIME timestamp NULL, IGNORE_SAMPLE_COUNT INT NULL, RAMP_UP_INIT_COUNT INT NULL, RAMP_UP_INIT_SLEEP_TIME INT NULL, LAST_PROGRESS_MESSAGE VARCHAR(2048) NULL, MEAN_TEST_TIME DOUBLE NULL, PEAK_TPS DOUBLE NULL, ERRORRATE DOUBLE NULL, MINRT DOUBLE NULL, PCT25RT DOUBLE NULL, PCT50RT DOUBLE NULL, PCT75RT DOUBLE NULL, PCT90RT DOUBLE NULL, PCT95RT DOUBLE NULL, PCT99RT DOUBLE NULL, MAXRT DOUBLE NULL, PORT INT NULL, RAMP_UP_STEP INT NULL, RAMP_UP_INCREMENT_INTERVAL INT NULL, PROCESSES INT NULL, PROGRESS_MESSAGE VARCHAR(2048) NULL, RUN_COUNT INT NULL, SCHEDULED_TIME timestamp NULL, SCRIPT_NAME VARCHAR(255) NULL, SCRIPT_REVISION BIGINT NULL, SEND_MAIL CHAR(1) DEFAULT 'F' NULL, START_TIME timestamp NULL, STATUS VARCHAR(255) NULL, STOP_REQUEST CHAR(1) DEFAULT 'F' NULL, TAG_STRING VARCHAR(255) NULL, TARGET_HOSTS VARCHAR(65535) NULL, TEST_COMMENT VARCHAR(2048) NULL, TEST_ERROR_CAUSE VARCHAR(255) NULL, NAME VARCHAR(255) NULL, TEST_TIME_STANDARD_DEVIATION DOUBLE NULL, TESTS BIGINT NULL, THREADS INT NULL, THRESHOLD VARCHAR(255) NULL, TPS DOUBLE NULL, USE_RAMPUP CHAR(1) NULL, VUSER_PER_AGENT INT NULL, CREATED_USER BIGINT NULL, LAST_MODIFIED_USER BIGINT NULL, REGION VARCHAR(255) NULL, SAFE_DISTRIBUTION CHAR(1) DEFAULT 'F' NULL, AGENT_STAT VARCHAR(10000) NULL, RUNNING_SAMPLE VARCHAR(10000) NULL, MONITOR_STAT VARCHAR(2000) NULL, SAMPLING_INTERVAL INT NULL, PARAM VARCHAR(256) DEFAULT '' NULL, RAMP_UP_TYPE VARCHAR(10) DEFAULT 'PROCESS' NULL, CONSTRAINT CONSTRAINT_C PRIMARY KEY (ID))]
Reply | Threaded
Open this post in threaded view
|

Re: 将DB从H2迁移到Mysql,实时数据不能显示

taohuang
This post was updated on .
In reply to this post by taohuang
6. 将varchar(2048)修改成text可以成功迁移db到mysql,但是启动controller服务会校验失败;后来用简单的方法保持类型不变,只修改varchar(2048) to varchar(255)控制了table长度,服务正常启动

7. 运行测试任务,可以生成最终结果,但是执行过程中的tps等数据的实时统计图不能显示,求问如何解决?





controller和agent log没有报错

2018-09-03 22:58:38,460 INFO  agent daemon: worker acehuang-0 started
2018-09-03 22:58:38,466 INFO  agent daemon: worker acehuang-1 started
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
2018-09-03 22:58:40,783 INFO  acehuang-0: Starting threads
2018-09-03 22:58:40,800 INFO  acehuang-1: Starting threads
2018-09-03 22:59:36,734 INFO  acehuang-1: Finished
2018-09-03 22:59:37,109 INFO  acehuang-0: Finished
2018-09-03 22:59:37,520 INFO  agent daemon: All workers are finished
2018-09-03 22:59:37,524 INFO  agent daemon: communication shut down
2018-09-03 22:59:37,525 INFO  agent daemon: Test shuts down.
2018-09-03 22:59:37,526 INFO  agent controller: Send log for test_3
2018-09-03 22:59:37,531 INFO  agent controller: Clean up the perftest logs

在chrome发现http://localhost:8089/perftest/8/api/sample?_=1536164407550 没有数据回包