首先答案是肯定的,fastdfs不支持windows。
其次建议你使用Minio
一、引言
一般来说文件存储花钱就选择阿里云oss、七牛云等产品,开源的话,目前开源的分布式文件存储系统非常多,上网一搜 "Ceph,GlusterFS,Sheepdog,
Lustre,Swift,Cinder,TFS,HDFS,MooseFS,FastDFS,MogileFS等" 这么多,有没有感觉看完对这些产品的分析后,还是不知道选择哪个????
这是一篇针对主流的开源的分布式文件存储系统的对比文章:
开源分布式存储系统的对比_直到世界的尽头-CSDN博客_四大开源分布式存储blog.csdn.net二、那到底选择哪个呢?
2.1、实在没法选择时,我们先看看几开源产品github 的 star
分布式文件系统 | github star | os支持 |
---|---|---|
minio | 25.1k | win/linux |
fastdfs | 7k | win |
ceph | 8.6k | win/linux |
GlusterFS | 2.9k | win/linux |
2.2、推荐使用minio
看看这篇文章:《MinIO很强-让我放弃FastDFS拥抱MinIO的8个理由》
MinIO很强-让我放弃FastDFS拥抱MinIO的8个理由www.cnblogs.com三、minio安装与使用
3.1、 windows安装非常简单
官网直接下载:
https://min.io/min.io启动就这么简单, F:Data 就是文件存储的目录
3.3、java调用minio
在官方上有相应的demo,不过官网引用的版本比较旧,相应的demo也比较旧,最新的demo我们可以去github上看。
githug examples:
https://github.com/minio/minio-javagithub.comminio/minio-java
https://github.com/minio/minio-javagithub.com以下代码基于官方github微调后的示例
<dependency><groupId>io.minio</groupId><artifactId>minio</artifactId><version>8.0.3</version></dependency>
class MinioTest {MinioClient minioClient;@BeforeEachvoid setUp() {minioClient =MinioClient.builder().endpoint("https://play.min.io").credentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG").build();}/*** 上传文件** @throws Exception*/@Testvoid test_upload() throws Exception {minioClient.uploadObject(UploadObjectArgs.builder().bucket("bucket01").object("test.txt").filename("D:dataDesktoptest.txt").build());System.out.println("my-filename is uploaded to my-objectname successfully");}/*** 下载文件** @throws Exception*/@Testvoid test_download() throws Exception {minioClient.downloadObject(DownloadObjectArgs.builder().bucket("bucket01").object("test.txt").filename("D:dataDesktoptest.txt").build());System.out.println("my-filename is uploaded to my-objectname successfully");}/*** 获取文件URL** @throws Exception*/@Testvoid test_geturl() throws Exception {String url =minioClient.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder().method(Method.GET).bucket("bucket01").object("test.txt").expiry(60 * 60 * 24).build());System.out.println(url);}/*** 上传+加密** @throws Exception*/@Testvoid test_upload_sse() throws Exception {KeyGenerator keyGen = KeyGenerator.getInstance("AES");keyGen.init(256);ServerSideEncryptionCustomerKey ssec =new ServerSideEncryptionCustomerKey(keyGen.generateKey());minioClient.uploadObject(UploadObjectArgs.builder().bucket("bucket01").object("test-sse-01.txt").filename("D:dataDesktoptest.txt").sse(ssec).build());System.out.println("my-filename is uploaded to my-objectname successfully");}/*** 下载+解密** @throws Exception*/@Testvoid test_download_sse() throws Exception {KeyGenerator keyGen = KeyGenerator.getInstance("AES");keyGen.init(256);ServerSideEncryptionCustomerKey ssec =new ServerSideEncryptionCustomerKey(keyGen.generateKey());minioClient.downloadObject(DownloadObjectArgs.builder().bucket("bucket01").object("test-sse-01.txt").filename("D:dataDesktop_test-sse-01.txt").ssec(ssec) // Replace with same SSE-C used at the time of upload..build());System.out.println("my-objectname is successfully downloaded to my-filename");}/*** 如何保存上传时的密钥对象** @throws Exception*/@Testvoid test_key() throws Exception {KeyGenerator keyGen = KeyGenerator.getInstance("AES");keyGen.init(256);SecretKey key1 = keyGen.generateKey();byte[] keySave = key1.getEncoded();System.out.println("key1 = " + Base64.getEncoder().encodeToString(keyBytes));//这里把keySave 保存下来就可以了,当然我们可以转成base64保存//以下就是把存储下来的keySave还原成SecretKey对象SecretKey key2 = new SecretKeySpec(keySave , "AES");System.out.println("key2 = " + Base64.getEncoder().encodeToString(key2 .getEncoded()));//key1 == key2assertEquals(key1,key2);}
}