获取测试代码
竞赛题目页面 https://tianchi.aliyun.com/competition/entrance/531980/information
打开java代码模板 https://code.aliyun.com/tianchi_polardbx_2022/java_demo
点击派生项目,然后选择用户或项目组
派生后进入项目查看
点击下载ZIP
下载的ZIP压缩包用IDEA打开
修改Tester文件中路径
修改项目pom.xml文件maven-assembly-plugin段,用来生成包含依赖包的jar文件
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.aliyun.polardbx.engine.Tester</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
运行mvn clean package 生成target\tianchi-java-demo-1.0-SNAPSHOT-jar-with-dependencies.jar 文件
创建服务器并运行jar
打开ECS管理后台 https://ecs.console.aliyun.com/
创建实例,选按量付费类型,规格名称选择 ecs.i4p.2xlarge,这是带有BPS本地盘的实例规格
实例创建后运行
yum groupinstall "Development Tools" -y
yum install -y cmake java-11-openjdk
参照文档 https://help.aliyun.com/document_detail/188251.html 配置挂载本地盘
mkfs -t ext4 /dev/pmem0 && \
mkdir /mnt/pmem && \
mount -o dax,noatime /dev/pmem0 /mnt/pmem
mkdir /mnt/pmem/race
touch /mnt/pmem/race_disk
使用上传工具比如winscp上传生成的tianchi-java-demo-1.0-SNAPSHOT-jar-with-dependencies.jar文件到服务器上,然后运行java -jar tianchi-java-demo-1.0-SNAPSHOT-jar-with-dependencies.jar
生成文件内容