packagecom.zhx.app.utils;importcom.aliyun.oss.ClientException;importcom.aliyun.oss.OSS;importcom.aliyun.oss.OSSClientBuilder;importcom.aliyun.oss.OSSException;importcom.aliyun.oss.model.PutObjectRequest;importcom.aliyun.oss.model.PutObjectResult;importorg.springframework.beans.factory.annotation.Value;importorg.springframework.stereotype.Component;importjava.io.IOException;importjava.io.InputStream;/*** @ClassName : AliOssUtil* @Description : 阿里云上传服务* @Author : zhx* @Date: 2024-03-1 20:29*/@ComponentpublicclassAliOssUtil{privatestaticStringENDPOINT;@Value("${alioss.endpoint}")publicvoidsetENDPOINT(String endpoint){ENDPOINT= endpoint;}privatestaticStringACCESS_KEY;@Value("${alioss.access_key}")publicvoidsetAccessKey(String accessKey){ACCESS_KEY= accessKey;}privatestaticStringACCESS_KEY_SECRET;@Value("${alioss.access_key_secret}")publicvoidsetAccessKeySecret(String accessKeySecret){ACCESS_KEY_SECRET= accessKeySecret;}privatestaticStringBUCKETNAME;@Value("${alioss.bucketName}")publicvoidsetBUCKETNAME(String bucketName){BUCKETNAME= bucketName;}publicstaticStringuploadFile(String objectName,InputStream inputStream){String url ="";// 创建OSSClient实例。OSS ossClient =newOSSClientBuilder().build(ENDPOINT,ACCESS_KEY,ACCESS_KEY_SECRET);try{// 创建PutObjectRequest对象。PutObjectRequest putObjectRequest =newPutObjectRequest(BUCKETNAME, objectName, inputStream);// 如果需要上传时设置存储类型和访问权限,请参考以下示例代码。// ObjectMetadata metadata = new ObjectMetadata();// metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS, StorageClass.Standard.toString());// metadata.setObjectAcl(CannedAccessControlList.Private);// putObjectRequest.setMetadata(metadata);// 上传文件。PutObjectResult result = ossClient.putObject(putObjectRequest);url ="https://"+BUCKETNAME+"."+ENDPOINT.substring(ENDPOINT.lastIndexOf("/")+1)+"/"+ objectName;}catch(OSSException oe){System.out.println("Caught an OSSException, which means your request made it to OSS, "+"but was rejected with an error response for some reason.");System.out.println("Error Message:"+ oe.getErrorMessage());System.out.println("Error Code:"+ oe.getErrorCode());System.out.println("Request ID:"+ oe.getRequestId());System.out.println("Host ID:"+ oe.getHostId());}catch(ClientException ce){System.out.println("Caught an ClientException, which means the client encountered "+"a serious internal problem while trying to communicate with OSS, "+"such as not being able to access the network.");System.out.println("Error Message:"+ ce.getMessage());}finally{if(ossClient !=null){ossClient.shutdown();}}return url;}publicstaticResultVodeleteFile(String objectName){// 创建OSSClient实例。OSS ossClient =newOSSClientBuilder().build(ENDPOINT,ACCESS_KEY,ACCESS_KEY_SECRET);try{// 删除文件。ossClient.deleteObject(BUCKETNAME, objectName);returnResultUtils.success("删除成功!");}catch(OSSException oe){System.out.println("Caught an OSSException, which means your request made it to OSS, "+"but was rejected with an error response for some reason.");System.out.println("Error Message:"+ oe.getErrorMessage());System.out.println("Error Code:"+ oe.getErrorCode());System.out.println("Request ID:"+ oe.getRequestId());System.out.println("Host ID:"+ oe.getHostId());}catch(ClientException ce){System.out.println("Caught an ClientException, which means the client encountered "+"a serious internal problem while trying to communicate with OSS, "+"such as not being able to access the network.");System.out.println("Error Message:"+ ce.getMessage());}finally{if(ossClient !=null){ossClient.shutdown();}}returnResultUtils.error("上传失败!");}}
fe节点启动报错:Do not specify the helper node to FE itself. Please specify it to the existing running Leader or Follower FE
at com.starrocks.StarRocksFE.main(StarRocksFE.java:68) [starrocks-fe.jar:?]
Caused by: com.sleepycat.je.EnvironmentFailureExcepti…
DisMaxQueryBuilder的定义: A query that generates the union of documents produced by its sub-queries, and that scores each document with the maximum score for that document as produced by any sub-query, plus a tie breaking increment for any addit…
基本类型
整数类型:byte short int long,分别占 1、2、4、8 个字节; 在给 long 类型变量赋值时,如果超过了 int 的表示范围,需要在常量后面加大写 L 或小写字母 l,例如:long value 3425352515…