MinIo 的操作与使用

文章目录

      • [一、Client 连通](#一、Client 连通)
        • [1. SpringBoot 项目](#1. SpringBoot 项目)
        • [2. 自己公司的 Maven 项目(非 SpringBoot 项目)](#2. 自己公司的 Maven 项目(非 SpringBoot 项目))

官方 API 文档:Documentation

官方中文文档:MinIO中文文档

一、Client 连通

  Java 代码:

java 复制代码
        MinioClient minioClient =
                MinioClient.builder()
                        .endpoint("http://192.168.110.110:9000")
                        .credentials("xiaoqiang", "heheda123")
                        .build();
        System.out.println(minioClient);
        // 检查桶是否存在
        boolean found = minioClient.bucketExists(BucketExistsArgs.builder().bucket("test").build());
        if (!found) {
            // 创建桶
            minioClient.makeBucket(MakeBucketArgs.builder().bucket("test").build());
        }

        //列出所有桶名
        List<Bucket> buckets = minioClient.listBuckets();
        for (Bucket i : buckets){
            System.out.println(i.name());
        }

  Maven 引入:

xml 复制代码
        <!--此依赖为minio的服务依赖-->
        <dependency>
            <groupId>io.minio</groupId>
            <artifactId>minio</artifactId>
            <version>8.5.7</version>
        </dependency>

  报错:

xml 复制代码
        <dependency>
            <groupId>io.minio</groupId>
            <artifactId>minio</artifactId>
            <version>8.5.2</version>
        </dependency>
        <!--或者-->
        <dependency>
            <groupId>io.minio</groupId>
            <artifactId>minio</artifactId>
            <version>8.4.5</version>
        </dependency>
        <!--或者-->
        <dependency>
            <groupId>io.minio</groupId>
            <artifactId>minio</artifactId>
            <version>8.3.7</version>
        </dependency>

  报错:

xml 复制代码
        <dependency>
            <groupId>io.minio</groupId>
            <artifactId>minio</artifactId>
            <version>8.2.1</version>
        </dependency>
        <!--或者-->
        <dependency>
            <groupId>io.minio</groupId>
            <artifactId>minio</artifactId>
            <version>8.1.0</version>
        </dependency>
        <!--或者-->
        <dependency>
            <groupId>io.minio</groupId>
            <artifactId>minio</artifactId>
            <version>8.0.3</version>
        </dependency>

  报错:Exception in thread "main" java.lang.NoSuchMethodError: kotlin.collections.ArraysKt.copyInto([B[BIII)[B

  尝试解决1:

  结论:不好使。

  尝试解决2:新建一个纯 Maven 项目。好使


  接下来的解决思路:将项目中的依赖依次注释最终只留 Minio 的依赖,看到底是哪个引入的依赖和 Minio 的依赖有冲突。

1. SpringBoot 项目

  最终发现是 spring-boot-starter-parent 的依赖导致的。


  居然是 SpringBoot 的顶层依赖导致的,也是绝了。尝试了下低版本居然可以。

  更高的版本居然也可以。

  经测试,框起来的版本可以用。

2. 自己公司的 Maven 项目(非 SpringBoot 项目)

  经排查,居然是 phoenix 的引入导致的。报错:Exception in thread "main" java.lang.NoSuchFieldError: Companion

  而且通过 exclusion 排除该 jar 包的方式并不好使,可能得重新编译该 jar 包。

相关推荐
分布式存储与RustFS1 个月前
基于Rust的国产开源对象存储RustFS:S3 Table对Iceberg数据湖的适配详解
rust·开源·iceberg·对象存储·rustfs·minio平替·s3 table
云存储小天使1 个月前
当 AI Agent 需要“记住”文件:MountPoint + newCOS 在沙箱场景的应用实践
对象存储·沙箱
分布式存储与RustFS1 个月前
RustFS S3 Table 开源后,我重新梳理了一下 Iceberg 数据湖的选型思路
人工智能·开源·minio·dpu·rustfs·ai存储·s3 table
johnny2331 个月前
S3命令行工具:rclone、s3cmd、s5cmd、mc、S3Copy
s3
AOwhisky1 个月前
Ceph系列第五期:Ceph 对象存储(RADOS Gateway)精讲
linux·运维·笔记·ceph·gateway·对象存储
亚林瓜子1 个月前
AWS S3日志桶常用过期文件生命周期策略
云计算·生命周期·aws·s3·过期·glacier
sg_knight1 个月前
负载均衡配置:使用 Nginx 反向代理 MinIO 集群的实战教程
运维·nginx·负载均衡·文件管理·minio·cos·oss
分布式存储与RustFS1 个月前
AI 多模态记忆数据:基于 RustFS 搭建分层高性能存储实战
人工智能·对象存储·rustfs·ai记忆·ai memory·minio国产替代·分布式存储实战
XSKY星辰天合2 个月前
从“能存下”到“训得动”:XSKY XEOS 支撑头部 AI 实验室建设 EB 级数据湖
数据湖·对象存储·分布式存储
分布式存储与RustFS2 个月前
RustFS:国产对象存储的新希望
对象存储·分布式存储·rustfs·国产自研·轻量化存储·信创替代·minio替代