Browse Source

同步s3 scene_view_data目录

lyhzzz 3 years ago
parent
commit
b43a46921b

+ 4 - 1
src/main/java/com/cdf/service/impl/FdkkSceneEditService.java

@@ -153,7 +153,10 @@ public class FdkkSceneEditService {
             throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
         }
         writeHotJson(fdkkHotRequest.getNum());
-        //ReadCmdLine.callShellByExec("aws s3 sync s3://4dkankan/cdf s3://4dage-moderate2/cdf --profile user1");
+        String sell = "aws s3 sync s3://4dkankan/scene_view_data/"+fdkkHotRequest.getNum()+" " +
+                "s3://4dage-moderate2/scene_view_data/"+fdkkHotRequest.getNum()+" --profile user1";
+        log.info("执行脚本:{}",sell);
+        ReadCmdLine.callShellByExec(sell);
     }
 
     public void writeHotJson(String num) throws IOException {

+ 12 - 12
src/main/java/com/cdf/util/UploadToCdfOssUtil.java

@@ -184,7 +184,7 @@ public class UploadToCdfOssUtil {
 		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
 		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
 			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
+			.withRegion(Regions.AP_SOUTHEAST_1)
 			.build();
 		try {
 			com.amazonaws.services.s3.model.ObjectMetadata metadata = new com.amazonaws.services.s3.model.ObjectMetadata();
@@ -333,7 +333,7 @@ public class UploadToCdfOssUtil {
 
 		AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
 				.withCredentials(new AWSStaticCredentialsProvider(awsCred))
-				.withRegion(Regions.EU_WEST_2)
+				.withRegion(Regions.AP_SOUTHEAST_1)
 				.build();
 
 		// Set the pre-signed URL to expire after one hour.
@@ -412,7 +412,7 @@ public class UploadToCdfOssUtil {
 		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
 		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
 				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)
+				.withRegion(Regions.AP_SOUTHEAST_1)
 				.build();
 
 		try {
@@ -454,7 +454,7 @@ public class UploadToCdfOssUtil {
 		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
 		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
 			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
+			.withRegion(Regions.AP_SOUTHEAST_1)
 			.build();
 		try{
 			File file = new File(filePath);
@@ -502,7 +502,7 @@ public class UploadToCdfOssUtil {
 		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
 		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
 				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)
+				.withRegion(Regions.AP_SOUTHEAST_1)
 				.build();
 
 		if (objectName.startsWith("/")) {
@@ -616,7 +616,7 @@ public class UploadToCdfOssUtil {
 		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
 		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
 			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
+			.withRegion(Regions.AP_SOUTHEAST_1)
 			.build();
 
 		try {
@@ -772,7 +772,7 @@ public class UploadToCdfOssUtil {
 			BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
 			AmazonS3 s3 = AmazonS3ClientBuilder.standard()
 				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)//s3 地区位置
+				.withRegion(Regions.AP_SOUTHEAST_1)//s3 地区位置
 				.build();
 
 			// 复制文件
@@ -800,7 +800,7 @@ public class UploadToCdfOssUtil {
 			BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
 			AmazonS3 s3 = AmazonS3ClientBuilder.standard()
 				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)//s3 地区位置
+				.withRegion(Regions.AP_SOUTHEAST_1)//s3 地区位置
 				.build();
 			// 复制文件
 			log.info("开始复制:" + sourceKey);
@@ -914,7 +914,7 @@ public class UploadToCdfOssUtil {
 			BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
 			AmazonS3 s3 = AmazonS3ClientBuilder.standard()
 				.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-				.withRegion(Regions.EU_WEST_2)
+				.withRegion(Regions.AP_SOUTHEAST_1)
 				.build();
 
 			GetObjectRequest request  = new GetObjectRequest(bucketName,objectName);
@@ -948,10 +948,10 @@ public class UploadToCdfOssUtil {
 		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
 		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
 			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
+			.withRegion(Regions.AP_SOUTHEAST_1)
 			.build();
 		try {
-			boolean exist = s3.doesObjectExist(bucket, objectName);
+			boolean exist = s3.doesObjectExist(s3bucket, objectName);
 			return exist;
 		}catch (Exception e){
 			log.error("s4判断是否存在key异常,key=" + objectName, e);
@@ -1038,7 +1038,7 @@ public class UploadToCdfOssUtil {
 		BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3key, s3secrey);
 		AmazonS3 s3 = AmazonS3ClientBuilder.standard()
 			.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
-			.withRegion(Regions.EU_WEST_2)
+			.withRegion(Regions.AP_SOUTHEAST_1)
 			.build();
 		try {
 			GetObjectRequest request  = new GetObjectRequest(this.bucket,objectName);

+ 1 - 1
src/main/java/com/cdf/util/UploadToFdkkOssUtil.java

@@ -951,7 +951,7 @@ public class UploadToFdkkOssUtil {
 			.withRegion(Regions.EU_WEST_2)
 			.build();
 		try {
-			boolean exist = s3.doesObjectExist(bucket, objectName);
+			boolean exist = s3.doesObjectExist(s3bucket, objectName);
 			return exist;
 		}catch (Exception e){
 			log.error("s4判断是否存在key异常,key=" + objectName, e);

+ 5 - 6
src/main/resources/application-local.yaml

@@ -5,8 +5,7 @@ spring:
     druid:
       url: jdbc:mysql://127.0.0.1:3306/cdf_gm?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowMultiQueries=true
       username: root
-      password: 4Dage@zhongmian#@168
-      #123456
+      password: 123456
 logging:
   config: classpath:logback-spring.xml
 mybatis-plus:
@@ -28,14 +27,14 @@ fdkk:
 
 cdf:
   aws:
-    s3key: AKIAWCV5QFZ3ZNELKYUY
-    s3secrey: epS5ghyR4LJ7rxk/qJO9ZYh6m9Oz6g5haKDu4yws
-    s3bucket: 4dkankan
+    s3key: AKIAUI25IY4RAEMUZCOQ
+    s3secrey: CeL0IMH+I0qMxLXBRRs3cbRh9DeVOeTMy8wa60o7
+    s3bucket: 4dage-moderate2
 
 upload:
   type: aws
   file-path: cdf/file/
-  query-path: https://eurs3.4dkankan.com/
+  query-path: http://glp-vr.cdfmembers.com/
 
 local:
   path: /home/4dkankan/