Tabla de contenido
With the exponential growth of the cloud, many will have heard of Amazon S3. But what if I told you that you can have something similar in your own corner of cyberspace? Yes, you can! And it’s not a Herculean task. With open-source tools like MinIO, it’s possible. So stick around, because I’m going to guide you through setting up your own S3 server.
Why have your own S3?
You might wonder if it’s really worth it, with so many offers already available on the market. But think about the autonomy, the costs you save, and the adaptability according to your needs. Or just think about the challenge and the technical fun that comes with it.
Meet MinIO, the star of our story
MinIO is more than just software. It’s an object storage solution known for its performance and, to top it off, it’s open-source. Moreover, it works wonderfully with Amazon S3’s API, so if you’re already familiar with S3, with MinIO you’ll feel right at home.
Setting up MinIO on Ubuntu 22.04
The beginning: Installation
Let’s start from the beginning, okay? Assuming you already have your machine with Ubuntu 22.04 ready:
Download MinIO:
Open your terminal and type:
wget https://dl.min.io/server/minio/release/linux-amd64/minio
Give it permissions:
We want it to be executable:
chmod +x minio
Starting up: First run
Once installed, it’s time to get it running.
Run MinIO:
Suppose you’ve decided to save your data in /data; first, we execute:
mkdir /data
Then, we can launch the software in the following way, but it’s not best practice as one can access with the default user minioadmin and password minioadmin:
./minio server /data
To avoid the above, you can run it defining a user and password with the environment variables set for it:
That is:
MINIO_ROOT_USER=YourUsername MINIO_ROOT_PASSWORD=YourPassword ./minio server /data
For example:
root@MinIO:~# MINIO_ROOT_USER=LearnIT MINIO_ROOT_PASSWORD=102371209673jhdef ./minio server /data MinIO Object Storage Server Copyright: 2015-2023 MinIO, Inc. License: GNU AGPLv3 <https://www.gnu.org/licenses/agpl-3.0.html> Version: RELEASE.2023-10-16T04-13-43Z (go1.21.3 linux/amd64) Status: 1 Online, 0 Offline. S3-API: http://146.255.69.234:9000 http://127.0.0.1:9000 RootUser: LearnIT RootPass: 102371209673jhdef Console: http://146.255.69.234:46267 http://127.0.0.1:46267 RootUser: LearnIT RootPass: 102371209673jhdef Command-line: https://min.io/docs/minio/linux/reference/minio-mc.html#quickstart $ mc alias set 'myminio' 'http://146.255.69.234:9000' 'LearnIT' '102371209673jhdef' Documentation: https://min.io/docs/minio/linux/index.html Warning: The standard parity is set to 0. This can lead to data loss.
This way of starting it is safer, but the software runs in the foreground; you can send it to the background in the following ways:
- Use software like screen and run it.
- You can use nohup.
- Another option is to configure a service with systemd.
Access and explore:
Now you can go to your browser and type the IP address of the server where you installed MinIO and port 9000; for example, if you installed it locally, you can type http://localhost:9000. With the credentials you’ve set up, you can start exploring the world of MinIO.
High Availability with MinIO
Having a server is good, but if we want it to be reliable, we need to think in terms of high availability.
MinIO in distributed mode, the art of expansion
If you have multiple servers, MinIO has got you covered! You can have them work together in a distributed cluster. Imagine four servers working together, creating a robust distributed storage system.
Erasure Coding, or how MinIO protects your data
Thanks to this technique, MinIO splits your data into fragments distributed across all servers. If one fails, there’s no problem; the data can be reconstructed from the fragments on the other servers.
Load balancer? Yes, please
With multiple servers accepting requests, it’s advisable to use a load balancer, such as NGINX or HAProxy. This ensures traffic is properly distributed and handles potential issues from any of the nodes.
Alternatives to MinIO
Of course, the world of object storage is vast, and MinIO is not alone. Let’s look at some alternatives:
Ceph with its S3 Gateway
Advantages:
- Highly scalable.
- Can manage not just object storage but also block storage and filesystems.
Disadvantages:
- More complex to configure than MinIO.
- Requires more hardware resources to get started.
OpenStack Swift
Advantages:
- Integrated into the OpenStack ecosystem.
- Specifically designed for scalability and redundancy.
Disadvantages:
- Its learning curve can be steeper if you’re not familiar with OpenStack.
- Initial configuration is more complex than MinIO.