一、背景
Jscape使用的是默认的h2文件数据库,上传的文件很多,导致累积了很多的触发器记录。即使清空后也无法释放空间,jscape在加载数据文件耗时很长,导致整个jscape使用起来很卡顿,甚至影响了一些文件上传的功能。
确定使用jscape自带的数据库迁移功能,将h2数据库迁移到rds的mysql数据库。参考链接:
http://files.jscape.com/secureftpserver/docs/10.2/migrating_to_centralized_global_datastore.htm?zoom_highlightsub=data
二、准备工作
1、使用当前用户连接数据库实例
mysql -hxxx.xxx.rds.cn-north-1.amazonaws.com.cn -utest -ptest
2、创建数据库
create database jscape default character set utf8 collate utf8_general_ci;
3、创建用户
create user 'jscape'@'%' identified by 'password';
4、赋权
grant select,insert,update,delete,create on jscape.* to jscape;
三、开始迁移
1、切换到Jscape的安装目录
cd /opt/JSCAPE_MFT_Server
2、停止Jscape
./stop_service.sh
3、执行拷贝命令:将h2的数据拷贝到mysql
./js-database-configuration -copy -destination-url jdbc:mysql://xxx.xxx.rds.cn-north-1.amazonaws.com.cn/jscape -destination-user jscape -destination-password password
4、执行切换数据库命令
./js-database-configuration -configure -url jdbc:mysql://xxx.xxx.rds.cn-north-1.amazonaws.com.cn/jscape -user jscape -password password
5、启动Jscape
./start_service.sh
6、登录web控制台验证 Settings → Datastore → JDBC URL