Browse Source

bulkWriter support localMinio (#870)

Signed-off-by: lentitude2tk <xushuang.hu@zilliz.com>
xushuang.hu 1 year ago
parent
commit
9ab4f7462c

+ 7 - 3
examples/main/java/io/milvus/BulkWriterExample.java

@@ -78,16 +78,20 @@ public class BulkWriterExample {
      * you need to configure it accordingly; Otherwise, you can ignore it.
      */
     public static class StorageConsts {
-        public static final CloudStorage cloudStorage = CloudStorage.AWS;
+        public static final CloudStorage cloudStorage = CloudStorage.MINIO;
 
         /**
-         * If using remote storage such as AWS S3, GCP GCS, Aliyun OSS, Tencent Cloud TOS,
+         * If using remote storage such as AWS S3, GCP GCS, Aliyun OSS, Tencent Cloud TOS, Minio
          * please configure the following parameters.
          */
-        public static final String STORAGE_ENDPOINT = cloudStorage.getEndpoint();
+        public static final String STORAGE_ENDPOINT = cloudStorage.getEndpoint("http://127.0.0.1:9000");
         public static final String STORAGE_BUCKET = "storage.bucket";
         public static final String STORAGE_ACCESS_KEY = "storage.access.key";
         public static final String STORAGE_SECRET_KEY = "storage.secret.key";
+        /**
+         * if using local storage such as Minio
+         * Please set this parameter to empty.
+         */
         public static final String STORAGE_REGION = "storage.region";
 
         /**

+ 3 - 2
src/main/java/io/milvus/bulkwriter/common/clientenum/CloudStorage.java

@@ -23,6 +23,7 @@ import io.milvus.exception.ParamException;
 import org.apache.commons.lang3.StringUtils;
 
 public enum CloudStorage {
+    MINIO("%s", "minioAddress"),
     AWS("s3.amazonaws.com", null),
     GCP("storage.googleapis.com", null),
     AZURE("%s.blob.core.windows.net", "accountName"),
@@ -60,7 +61,7 @@ public enum CloudStorage {
             case ALI:
                 return String.format("https://%s.oss-%s.aliyuncs.com/%s", bucketName, region, commonPrefix);
             default:
-                throw new ParamException("no support others storage address");
+                throw new ParamException("no support others remote storage address");
         }
     }
 
@@ -68,6 +69,6 @@ public enum CloudStorage {
         if (this == CloudStorage.AZURE) {
             return String.format("https://%s.blob.core.windows.net/%s/%s", accountName, containerName, commonPrefix);
         }
-        throw new ParamException("no support others storage address");
+        throw new ParamException("no support others remote storage address");
     }
 }