【MinIO】大文件上傳配置


 

 

#### server ####
server.port=4444
server.servlet.context-path=/minio
#### logging ####
logging.level.com.minio.ls=debug
#### http ####
spring.servlet.multipart.enabled=true
spring.servlet.multipart.file-size-threshold=600GB
spring.servlet.multipart.max-file-size=600GB
spring.servlet.multipart.max-request-size=600GB

#### MinIO ### minio.endpoint=http://127.0.0.1:9000 minio.accessKey=minioadmin minio.secretKey=minioadmin minio.bucketName=demo01 # 是否打開 undertow 日志,默認為 false server.undertow.accesslog.enabled=false # 設置訪問日志所在目錄 server.undertow.accesslog.dir=logs # 指定工作者線程的 I/0 線程數,默認為 2 或者 CPU 的個數 server.undertow.io-threads= # 指定工作者線程個數,默認為 I/O 線程個數的 8 倍 server.undertow.worker-threads= # 設置 HTTP POST 內容的最大長度,默認不做限制 server.undertow.max-http-post-size=0

  

 public boolean putObject(String bucketName, String objectName, InputStream stream, String contentType, long objectSize) throws IOException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, ServerException, ErrorResponseException, XmlParserException, InsufficientDataException, InternalException {

        boolean flag = bucketExists(bucketName);

        if (flag) {
            minioClient.putObject(
                    PutObjectArgs.builder().
                            bucket(bucketName).
                            object(objectName).
                            stream(stream,
                                    objectSize,//stream.available(),
                                    -1
                            )
                            .contentType(contentType)
                            .build());
            StatObjectResponse statObject = statObject(bucketName, objectName);
            if (statObject != null && statObject.size() > 0) {
                return true;
            }
        }
        return false;
    }

 

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM