当前位置:网站首页>Network file storage system (II) practical operation of Minio distributed file system
Network file storage system (II) practical operation of Minio distributed file system
2022-07-25 07:43:00 【xueshanfeitian】
introduction
minio summary
MinIO It's based on Go High performance object storage services for languages . It USES a Apache License v2.0 Open source licenses , Amazon compatible S3 Cloud storage service interface , It is very suitable for storing large capacity unstructured data .
MinIO Can be used as the primary storage for cloud native applications , Compared with traditional object storage , Cloud native applications need higher throughput and lower latency . And these are all MinIO Performance indicators that can be achieved .
minio framework

MinIO With local drive (JBOD / JBOF) On the product server . All servers in the cluster have the same functions ( Completely symmetrical architecture ). No name node or metadata server .
MinIO Write data and metadata together as objects , Thus, there is no need to use metadata database . Besides ,MinIO Inline , Strictly and consistently perform all functions ( Erase the code , position rotrot Check , encryption ). The result is MinIO remarkable dexterity .
Every MinIO Clusters are distributed MinIO A collection of servers , One process per node . MinIO Run in user space as a single process , And use lightweight collaborative routines to achieve high concurrency . Group drives into erase sets ( By default , Each group 16 A drive ), Then the object is placed on these erasure sets using a deterministic hash algorithm .
MinIO Designed for large scale , Designed for cloud storage services in multiple data centers . Each tenant runs its own MinIO to cluster around , The cluster is completely isolated from other tenants , So that they can protect them from escalation , Any interference with updates and security events . Each tenant expands independently by combining clusters across geographical regions .
Usage method
minio download , Just go to the mirror website , Here the little ape will not post the connection , The following is mainly about how we can centos To use minio
step1 Upload and modify permissions
# Upload files
rz xxxx
# Modify the permissions
chmod +x minio
step2 Prepare data file directories and log files
mkdir -p /data/minio
touch minio.log
step3 Set the console password
vim /etc/profile
# Set console account ( least 3 position )
export MINIO_ACCESS_KEY=feitian
export MINIO_SECRET_KEY=feitian_minio
source /etc/profile

step4 start-up
# Background start
nohup /usr/local/minio server --address :9800 --console-address :9889 /data/minio >/data/minio/minio.log 2>&1 &
explain
nohup: Background start
./minio server: Start command
--address :9800: Appoint API port
--console-address :9889: Specify the console port
/home/minio/data: Specify the storage directory
>/home/minio/minio.log 2>&1 : Redirect console logs to /home/minio/minio.log In file
&: Background operation
step5 Sign in

step6 close minio
## see minio process
ps -ef|grep minio
## obtain pid xxx by pid
kill -9 xxx
Client side usage
stay pom Add the following dependencies to
<!-- Minio -->
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.2.2</version>
</dependency>
Configuration class
@Configuration
@ConfigurationProperties(prefix = "minio")
public class MinioConfig
{
/** * Service address */
private String url;
/** * user name */
private String accessKey;
/** * password */
private String secretKey;
/** * Bucket name */
private String bucketName;
public String getUrl()
{
return url;
}
public void setUrl(String url)
{
this.url = url;
}
public String getAccessKey()
{
return accessKey;
}
public void setAccessKey(String accessKey)
{
this.accessKey = accessKey;
}
public String getSecretKey()
{
return secretKey;
}
public void setSecretKey(String secretKey)
{
this.secretKey = secretKey;
}
public String getBucketName()
{
return bucketName;
}
public void setBucketName(String bucketName)
{
this.bucketName = bucketName;
}
@Bean
public MinioClient getMinioClient()
{
return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();
}
}
Data access class
@Primary
@Service
public class MinioSysFileServiceImpl implements ISysFileService
{
@Autowired
private MinioConfig minioConfig;
@Autowired
private MinioClient client;
/** * Local file upload interface * * @param file Uploaded files * @return Access address * @throws Exception */
@Override
public String uploadFile(MultipartFile file) throws Exception
{
String fileName = FileUploadUtils.extractFilename(file);
PutObjectArgs args = PutObjectArgs.builder()
.bucket(minioConfig.getBucketName())
.object(fileName)
.stream(file.getInputStream(), file.getSize(), -1)
.contentType(file.getContentType())
.build();
client.putObject(args);
return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName;
}
}
FileUploadUtils class
..........
/** * Encoded file name */
public static final String extractFilename(MultipartFile file)
{
return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), FileTypeUtils.getExtension(file));
}
..........
边栏推荐
- [programmer 2 Civil Servant] IV. common problems
- C# 43. 获取UDP可用端口
- [unity introduction program] basic concepts - 2D collider collider 2D
- Gather the wisdom of developers and consolidate the foundation of the database industry
- [paper notes] effective CNN architecture design guided by visualization
- JS note 17: the whole process of jest project configuration of typescript project
- SAP queries open Po (open purchase order)
- How to use kotlin flow in Android projects
- J1 常用的DOS命令(P25)
- How to use network installation to deploy multiple virtual servers in KVM environment
猜你喜欢

New version 8.6 SEO quick release system (can be built at source level)

Cerebral cortex: the relationship between lifestyle and brain function in the elderly and its relationship with cognitive decline

How does MTK change the boot logo?

Open source, innovators win, 2022 "science and innovation China" open source innovation list selection is fully open!

A review of nature: gender differences in anxiety and depression - circuits and mechanisms

Configuring WAPI certificate security policy for Huawei wireless devices

Completely replace the redis+ database architecture, and JD 618 is stable!

Calculation formula of cross entropy

RPC communication principle and project technology selection

What has become a difficult problem for most people to change careers, so why do many people study software testing?
随机推荐
Summer Challenge harmonyos - slider slider for custom components
webflux默认io线程数
How to do a good job in safety development?
[unity introduction program] basic concepts - 2D collider collider 2D
[unity entry plan] interface Introduction (1) -scene view
深度学习制作数据集时,从长视频中指定每隔多少帧提取一张图像到指定文件路径的方法
When deep learning makes data sets, it specifies how many frames to extract an image from the long video to the specified file path
A fast method of data set enhancement for deep learning
【软件测试】包装简历从这几点出发、提升通过率
Introduction to Manhattan distance
diagramscene工程难点分析
P1049 [noip2001 popularization group t4] packing problem
[software testing] package resume from these points to improve the pass rate
P1047 [noip2005 popularization group t2] tree outside the school gate
Tips - prevent system problems and file loss
MathWorks has been in China for 15 years. What are the secrets of continuous innovation?
If Debian infringes the rust trademark, will it be exempted by compromising and renaming?
Gather the wisdom of developers and consolidate the foundation of the database industry
Problems during nanodet training: modulenotfounderror: no module named 'nanodet' solution
查看电脑重启次数、原因