Minio Multi-Node Multi-Drive 分布式部署

1.nginx安装

安装依赖

yum install -y make cmake gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

下载nginx包

wget http://nginx.org/download/nginx-1.12.2.tar.gz

解压

tar zxvf nginx-1.12.2.tar.gz && cd nginx-1.12.2

编译

./configure && make && make install

配置全局命令  设置软连接

ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx

启动 nginx

nginx


  • 2.挂盘

部署环境介绍

该部署具有一个服务器池,该池由两个具有顺序主机名的 MinIO 服务器主机组成。

node1  node2

所有主机都有四个本地连接的驱动器,这些驱动器具有顺序挂载点:

/mnt/data-1  /mnt/data-2
/mnt/data-3   /mnt/data-4

vmware 挂盘

虚拟机查看 磁盘挂载情况

格式化磁盘格式  

 mkfs.xfs /dev/sdb -L DISK1   #  -L 起别名
 mkfs.xfs /dev/sdc -L DISK2
 mkfs.xfs /dev/sdd -L DISK3
 mkfs.xfs /dev/sde -L DISK4

 编辑fstab

vi /etc/fstab

LABEL=DISK1      /mnt/data-1     xfs     defaults,noatime  0       2
LABEL=DISK2      /mnt/data-2     xfs     defaults,noatime  0       2
LABEL=DISK3      /mnt/data-3     xfs     defaults,noatime  0       2
LABEL=DISK4      /mnt/data-4     xfs     defaults,noatime  0       2

挂载

mount -a

注意:两个节点都需要这些操作

3.时钟同步

yum install -y ntp

#server
vim /etc/ntp.conf
# ntp server 端配置/etc/ntp.conf
# 把其他所有的 server 行全部注释,添加下面一行即可


server 127.127.1.0 iburst  # 一定是这个值!如果改成 127.0.0.1 是不对的。

然后执行下面命令重启:
service ntpd restart 或 systemctl restart ntpd


#client

# ntp 客户端配置/etc/ntp.conf 添加下面的

#配置上游时间服务器为本地的 ntpd Server 服务器
# 把其他所有的 server 行全部注释,添加下面一行即可


server 192.168.2.94 prefer


# Fudge 192.168.2.94 stratum 10  # 可以不添加

#配置允许上游时间服务器主动修改本机的时间


restrict 192.168.2.35 nomodify notrap noquery  # 每个 client 需要把这个 ip 改成自己的

#然后执行下面命令重启:
service ntpd restart 或 systemctl restart ntpd


4.minio 安装

添加用户用户组 赋予用户权限

groupadd -r minio

useradd -M -r -g minio minio

cd /mnt

chown minio:minio data-1 data-2 data-3 data-4

下载minio

wget https://dl.min.io/server/minio/release/linux-amd64/minio

#scp 到集群各个节点
scp -p minio node2:/opt/soft/

#复制执行权限
chmod +x minio

chown minio:minio minio

编辑systemd配置

vim /etc/default/minio

# Set the hosts and volumes MinIO uses at startup
# The command uses MinIO expansion notation {x...y} to denote a
# sequential series.
#
# The following example covers four MinIO hosts
# with 4 drives each at the specified hostname and drive locations.
# The command includes the port that each MinIO server listens on
# (default 9000)

MINIO_VOLUMES="http://node{1...2}:9000/mnt/data-{1...4}"   #磁盘目录

# Set all MinIO server options
#
# The following explicitly sets the MinIO Console listen address to
# port 9001 on all network interfaces. The default behavior is dynamic
# port selection.

MINIO_OPTS="--console-address :9001"

# Set the root username. This user has unrestricted permissions to
# perform S3 and administrative API operations on any resource in the
# deployment.
#
# Defer to your organizations requirements for superadmin user name.

MINIO_ROOT_USER=minioadmin  #账号

# Set the root password
#
# Use a long, random, unique string that meets your organizations
# requirements for passwords.

MINIO_ROOT_PASSWORD=minioadmin  #密码

# Set to the URL of the load balancer for the MinIO deployment
# This value *must* match across all MinIO servers. If you do
# not have a load balancer, set this value to to any *one* of the
# MinIO hosts in the deployment as a temporary measure.
MINIO_SERVER_URL="http://node1:9000"

vi /usr/lib/systemd/system/minio.server

[Unit]
Description=MinIO
Documentation=https://min.io/docs/minio/linux/index.html
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/opt/soft/minio   #minio 安装目录

[Service]
WorkingDirectory=/opt/soft/

User=minio   #启动minio用户
Group=minio        #启动minio用户所属组
ProtectProc=invisible

EnvironmentFile=-/etc/default/minio  #minio启动配置
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi"
ExecStart=/opt/soft/minio server $MINIO_OPTS $MINIO_VOLUMES  #执行代码逻辑

# MinIO RELEASE.2023-05-04T21-44-30Z adds support for Type=notify (https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=)
# This may improve systemctl setups where other services use `After=minio.server`
# Uncomment the line to enable the functionality
# Type=notify

# Let systemd restart this service always
Restart=always

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536

# Specifies the maximum number of threads this process can create
TasksMax=infinity

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=infinity
SendSIGKILL=no

[Install]
WantedBy=multi-user.target

# Built for ${project.name}-${project.version} (${project.name})
 

配置负载均衡器

vim /usr/local/nginx/conf/nginx.conf

#user  nobody;
worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    server {
        listen       80;
        server_name  192.168.4.142;

        location / {
            proxy_pass http://minio_servers;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
        }
        
    }
    
    upstream minio_servers {
    server node1:9000;
    server node2:9000;
}


}

启动两个节点 minio  

启动之前保证两个节点都执行了上述minio安装操作

systemctl start minio

注意:一定要保证 数据目录是空的。data里面有个隐藏目录 .minio.sys 删除掉

  •  rm -rf data-{1,2,3,4}/.m*

  •  rm -rf data-{1,2,3,4}/*

启动nginx
nginx -s reload

url http:node1

账号:minioadmin

密码:minioadmin

  • 36
    点赞
  • 33
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值