[Docker installs minIO cluster (1)]

docker install minIO cluster (1)

1. docker deployment minio cluster

  • Prepare 2 nodes and create 2 mount points for each node. Since the root disk cannot be used in cluster mode, the docker volume is used as the mount point here.
  • In a 2-node cluster, when one node fails, the read and write operations to the cluster will not be affected.

2. All nodes configure host name resolution:

  • Both nodes execute the following commands
cat >> /etc/hosts << EOF
192.168.124.122 minio-1
192.168.124.129 minio-2
EOF

3. Create data volume

  • Both nodes must be created
docker volume create minio-data1
docker volume create minio-data2

docker volume ls // 查看所有容器卷
# docker volume minio-data2 // 查看指定容器卷详情信息
# docker stop minioyy // 暂停容器实例
# docker rm minioyy // 移除容器实例
# docker volume rm minio-data2 // 删除自定义数据卷

4. Deploy the minio cluster, each node mounts 2 directories on 2 nodes

  • minio-1 node execution
docker run -d --name minioyy \
--restart=always --net=host \
-e "MINIO_ROOT_USER=minioadmin" \
-e "MINIO_ROOT_PASSWORD=minioadmin" \
-v minio-data1:/data1 \
-v minio-data2:/data2 \
 minio/minio:RELEASE.2021-06-14T01-29-23Z server \
 --address 79.2.78.16:9000 \
 http://minio-{
    
    1...2}/data{
    
    1...2}
  • minio-2 node execution
docker run -d --name minioyy \
--restart=always --net=host \
-e "MINIO_ROOT_USER=minioadmin" \
-e "MINIO_ROOT_PASSWORD=minioadmin" \
-v minio-data1:/data1 \
-v minio-data2:/data2 \
 minio/minio:RELEASE.2021-06-14T01-29-23Z server \
 --address 79.2.78.17:9000 \
 http://minio-{
    
    1...2}/data{
    
    1...2}
  • view log
docker logs -f minioyy
  • report error
API: SYSTEM()
Time: 02:59:08 UTC 11/18/2021
Error: Marking http://minio-1:9000/minio/storage/data2/v36 temporary offline; caused by Post "http://minio-1:9000/minio/storage/data2/v36/readall?disk-id=&file-path=format.json&volume=.minio.sys": dial tcp 192.168.124.122:9000: connect: no route to host (*fmt.wrapError)
       6: internal/rest/client.go:147:rest.(*Client).Call()
       5: cmd/storage-rest-client.go:151:cmd.(*storageRESTClient).call()
       4: cmd/storage-rest-client.go:523:cmd.(*storageRESTClient).ReadAll()
       3: cmd/format-erasure.go:406:cmd.loadFormatErasure()
       2: cmd/format-erasure.go:326:cmd.loadFormatErasureAll.func1()
       1: internal/sync/errgroup/errgroup.go:123:errgroup.(*Group).Go.func1()

insert image description here

  • The reason is that the firewall does not open the port.
  • fix bug
firewall-cmd  --permanent --zone=public --add-port=9000/tcp
firewall-cmd  --state
firewall-cmd  --reload
# 重启minio
docker restart minioyy

insert image description here

  • Check the log again
docker logs -f minioyy
Exiting on signal: TERMINATED
Waiting for all MinIO sub-systems to be initialized.. lock acquired
All MinIO sub-systems initialized successfully
Waiting for all MinIO IAM sub-system to be initialized.. lock acquired
IAM initialization complete
Status:         4 Online, 0 Offline. 
Endpoint: http://192.168.124.129:9000 

Browser Access:
   http://192.168.124.129:9000

Object API (Amazon S3 compatible):
   Go:         https://docs.min.io/docs/golang-client-quickstart-guide
   Java:       https://docs.min.io/docs/java-client-quickstart-guide
   Python:     https://docs.min.io/docs/python-client-quickstart-guide
   JavaScript: https://docs.min.io/docs/javascript-client-quickstart-guide
   .NET:       https://docs.min.io/docs/dotnet-client-quickstart-guide
Detected default credentials 'minioadmin:minioadmin', please change the credentials immediately by setting 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment values

insert image description here

  • Note: When docker deploys cluster mode, you must specify the –net=host parameter, use the host network, and use port mapping to create a cluster.
  • View container running status
[root@CentOS-7 ~]# docker ps
CONTAINER ID   IMAGE                                      COMMAND                  CREATED             STATUS             PORTS   NAMES
de5e0fd719c3   minio/minio:RELEASE.2021-06-14T01-29-23Z   "/usr/bin/docker-ent…"   29 minutes ago      Up 19 minutes              minioyy
  • The client checks the minio status, and the two nodes and the Drivers on each node are all online:

5. Access node 1 minio

  • Browser access http://192.168.124.122:9000
    insert image description here

6. Log in and create a Bucket

  • Create Bucket: oss, model
    insert image description here

7. Access node 2 minio

Guess you like

Origin blog.csdn.net/qq_38066812/article/details/122477030