Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minio: How to make folders and files already in mount point available when starting minio server?

I am running a Minio server using its docker image.

docker run -p 9000:9000 --name minio1 \
  -e "MINIO_ACCESS_KEY=user" \
  -e "MINIO_SECRET_KEY=pass" \
  -v /home/me/data:/data \
  minio/minio server /data

I have a couple of folders with files in the mount point. How do I make them available in Minio, do I need to upload them?

Can I put them in a folder and have it added as a bucket when I initialize the server?

EDIT:

When I open the minio web UI on localhost:9000 I don't see the files and folders that were already at the mount point.

What is the most efficient way to add all these folders to the minio server, such that a bucket is created for the first folder in the tree and then all the files inside each folder are added to their 'folder' bucket as objects? I could achieve this using Minio Python SDK, for example, by recursively walking down the folder tree and upload the files, but is that necessary?

like image 223
dzang Avatar asked Apr 03 '19 13:04

dzang


People also ask

Where is MinIO data stored?

Minio is an open source distributed object storage server written in Go, designed for Private Cloud infrastructure providing S3 storage functionality.

What is MinIO distributed mode?

A distributed MinIO deployment consists of 4 or more drives/volumes managed by one or more minio server process, where the processes manage pooling the compute and storage resources into a single aggregated object storage resource.


1 Answers

For what its worth, it appears you have to use the minio command line client to accomplish this: the maintainers explicitly declined to add an option to do this internal to Minio (see https://github.com/minio/minio/issues/4769). The easiest option I'd see is basically do something like this:

docker run -p 9000:9000 --name minio1 -e "MINIO_ACCESS_KEY=user" \ 
-e "MINIO_SECRET_KEY=pass" -v /home/me/data:/data \
minio/minio server /data && docker exec -d minio1 \
"/bin/bash /usr/bin/mc config host add srv http://localhost:9000 \
user pass && /usr/bin/mc mb -p srv/bucket"

Which SHOULD launch the docker container and then exec the mc client to create the bucket bucket (change the name if there is a different folder inside data you'd like to expose).

If you're a Docker Compose fan you can try something like what's documented at https://gist.github.com/harshavardhana/cb6c0d4d220a9334a66d6259c7d54c95 or build your own image with a custom entrypoint.

like image 59
Femi Avatar answered Oct 20 '22 03:10

Femi