Advertisement
echoslider

finish_minio_cluster

Nov 28th, 2022 (edited)
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.58 KB | Software | 0 0
  1. ######run with root permissions#######
  2.  
  3.  
  4. #############################################################
  5. #optional. create a zfs storage pool
  6.  
  7. zpool create \
  8.     -o ashift=12 \
  9.     -O acltype=posixacl -O canmount=on -O compression=lz4 \
  10.     -O xattr=sa -f storage mirror \
  11.      /dev/vdb \
  12.     /dev/vdc
  13.  
  14. zfs set atime=off storage
  15. zfs set recordsize=4k storage
  16. zfs set redundant_metadata=most storage
  17. zpool set autotrim=on storage  
  18. #############################################################
  19.  
  20.  
  21.  
  22. #download minio
  23.  
  24. wget -c https://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/local/bin/minio
  25. chmod +x /usr/local/bin/minio
  26.  
  27.  
  28.  
  29. #create the minio service
  30.  
  31. cat > /etc/systemd/system/minio.service  << SERVICE
  32. [Unit]
  33. Description=MinIO
  34. Documentation=https://min.io/docs/minio/linux/index.html
  35. Wants=network-online.target
  36. After=network-online.target
  37. AssertFileIsExecutable=/usr/local/bin/minio
  38.  
  39. [Service]
  40. WorkingDirectory=/usr/local
  41.  
  42. User=minio-user
  43. Group=minio-user
  44. ProtectProc=invisible
  45.  
  46. EnvironmentFile=-/etc/default/minio
  47. ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi"
  48. ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
  49.  
  50. # Let systemd restart this service always
  51. Restart=always
  52.  
  53. # Specifies the maximum file descriptor number that can be opened by this process
  54. LimitNOFILE=65536
  55.  
  56. # Specifies the maximum number of threads this process can create
  57. TasksMax=infinity
  58.  
  59. # Disable timeout logic and wait until process is stopped
  60. TimeoutStopSec=infinity
  61. SendSIGKILL=no
  62.  
  63. [Install]
  64. WantedBy=multi-user.target
  65.  
  66. # Built for ${project.name}-${project.version} (${project.name})
  67. SERVICE
  68.  
  69.  
  70.  
  71. #add servers to hosts file
  72.  
  73. cat >> /etc/hosts  << HOST
  74. 10.0.2.81 minio1
  75. 10.0.2.77 minio2
  76. 10.0.2.82 minio3
  77. 10.0.2.83 minio4
  78. HOST
  79.  
  80.  
  81.  
  82. #create minio config
  83. #here an example how to build 4 single node multi disk cluster.
  84. #"http://minio{1...4}:9000/storage/minio{1...4}"
  85.  
  86.  
  87.  
  88. #this is a config for a 4 single node single disk cluster
  89.  
  90. cat > /etc/default/minio  << MULTINODE
  91. MINIO_VOLUMES="http://minio{1...4}:9000/storage/minio"
  92. MINIO_OPTS="--console-address :9001"
  93. MINIO_ROOT_USER=serveradmin
  94. MINIO_ROOT_PASSWORD=p@ssw0rd
  95. #here put your CLUSTERED ip. if dont have... put the node
  96. MINIO_SERVER_URL="http://minio1:9000"
  97. MULTINODE
  98.  
  99.  
  100. #starting the cluster
  101. #run this commands on every node at the same time
  102.  
  103. systemctl enable minio
  104.  
  105. #if it not run by itself...
  106.  
  107. systemctl start minio
  108.  
  109.  
  110. #run this for check the service is running
  111.  
  112. systemctl status minio
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement