Skip to content

Instantly share code, notes, and snippets.

@davlgd
Last active October 14, 2020 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davlgd/537ea27f5eb93b7c7bf3462fb7c7046e to your computer and use it in GitHub Desktop.
Save davlgd/537ea27f5eb93b7c7bf3462fb7c7046e to your computer and use it in GitHub Desktop.
Minio distributed setup
#!/bin/bash
apt update && apt full-upgrade -y && apt autoremove -y
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
mv minio /usr/local/bin
useradd -r minio -s /sbin/nologin
chown minio:minio /usr/local/bin/minio
mkdir /mnt/minio{1..4}
mkfs.ext4 /dev/sda
mkfs.ext4 /dev/sdb
mkfs.ext4 /dev/sdc
mkfs.ext4 /dev/sdd
echo "/dev/sda /mnt/minio1 ext4 defaults 0 0" >> /etc/fstab
echo "/dev/sdb /mnt/minio2 ext4 defaults 0 0" >> /etc/fstab
echo "/dev/sdc /mnt/minio3 ext4 defaults 0 0" >> /etc/fstab
echo "/dev/sdd /mnt/minio4 ext4 defaults 0 0" >> /etc/fstab
reboot
#!/bin/bash
chown minio:minio /mnt/minio{1..4}
echo "IP.privée.serveur.1 minio-server1" >> /etc/hosts
echo "IP.privée.serveur.2 minio-server2" >> /etc/hosts
systemctl daemon-reload
systemctl enable minio
reboot
#/etc/default/minio
MINIO_ACCESS_KEY="clé_d_accès"
MINIO_SECRET_KEY="clé_secrète"
MINIO_VOLUMES="http://minio-server{1...2}/mnt/minio{1...4}"
MINIO_OPTS="-C /etc/minio --address IP.privée.du.serveur:9000"
#/etc/systemd/system/minio.service
[Unit]
Description=MinIO
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio
[Service]
WorkingDirectory=/usr/local/
EnvironmentFile=/etc/default/minio
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi"
ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
# Let systemd restart this service always
Restart=always
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=infinity
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment