The first answer is yes, FastdFS does not support Windows. Second, I suggest you use MinioCopy the code
One, the introduction
Generally, you choose ali Cloud OSS, Qiniuyun, etc. If you are open source, there are a lot of open source distributed file storage systems out there. If you go online and search “Ceph, GlusterFS,Sheepdog,
Lustre, Swift, Cinder, TFS, HDFS, MooseFS FastDFS, MogileFS “so much, do you have any feeling to see after the analysis of these products, or don’t know which to choose????
This is a comparison article for the mainstream open source distributed file storage system:
Comparison of open source distributed storage systems _ to the end of the world -CSDN blog _ Four major open source distributed storage blog.csdn.net
Two, that exactly choose which?
2.1. When there is no choice, let’s take a look at the star of Github
2.2 minio is recommended
Check out this article: MinIO is Strong – 8 Reasons I Gave up FastDFS and Embraced MinIO
MinIO is Strong – 8 reasons TO give up FastDFS and embrace MinIO www.cnblogs.com
Minio installation and use
3.1. Windows installation is very simple
Download directly from the official website:
min.io/min.io
F:\Data is the directory where the files are stored
3.3 Java calls minio
There is a corresponding demo on the official website, but the version referenced on the official website is older and the corresponding demo is also older. We can go to Github to see the latest demo.
githug examples:
Github.com/minio/minio…
Minio/minio-javagithub.com/minio/minio…
The following code is based on the official Github fine-tuned example
<dependency> <groupId> IO. Minio </artifactId> minio</artifactId> <version>8.0.3</version> </dependency>Copy the code
class MinioTest { MinioClient minioClient; @BeforeEach void setUp() { minioClient = MinioClient.builder() .endpoint("https://play.min.io") .credentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG") .build(); } /** * upload a file ** @throws Exception */ @test void test_upload() throws Exception {minioclient.uploadObject ( UploadObjectArgs.builder() .bucket("bucket01") .object("test.txt") .filename("D:\\data\\Desktop\\test.txt") .build()); System.out.println("my-filename is uploaded to my-objectname successfully"); } / download file * * * * * @ throws the Exception * / @ Test void test_download () throws the Exception {minioClient. DownloadObject ( DownloadObjectArgs.builder() .bucket("bucket01") .object("test.txt") .filename("D:\\data\\Desktop\\test.txt") .build()); System.out.println("my-filename is uploaded to my-objectname successfully"); } /** * Obtain the file URL ** @throws Exception */ @test void 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); } /** * upload + encryption ** @throws Exception */ @test void 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:\\data\\Desktop\\test.txt") .sse(ssec) .build()); System.out.println("my-filename is uploaded to my-objectname successfully"); } /** * Download + decrypt ** @throws Exception */ @test void 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:\\data\\Desktop\\_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"); } /** * How to save the key object when uploading ** @throws Exception */ @test void 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)); // Save the keySave. SecretKey key2 = new SecretKeySpec(keySave, "AES"); System.out.println("key2 = " + Base64.getEncoder().encodeToString(key2 .getEncoded())); //key1 == key2 assertEquals(key1,key2); }}Copy the code