2023-01-17 07:38:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Copyright (c) 2015-2023 MinIO, Inc.
  
						 
					
						
							
								
									
										
										
										
											2021-04-19 03:41:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								//
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// This file is part of MinIO Object Storage stack
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// This program is free software: you can redistribute it and/or modify
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// it under the terms of the GNU Affero General Public License as published by
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// the Free Software Foundation, either version 3 of the License, or
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// (at your option) any later version.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// This program is distributed in the hope that it will be useful
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// but WITHOUT ANY WARRANTY; without even the implied warranty of
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// GNU Affero General Public License for more details.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// You should have received a copy of the GNU Affero General Public License
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
						 
					
						
							
								
									
										
											 
										
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											 
										 
										
											2016-02-13 07:27:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-19 07:23:42 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								package  cmd  
						 
					
						
							
								
									
										
											 
										
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											 
										 
										
											2016-02-13 07:27:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  (  
						 
					
						
							
								
									
										
										
										
											2018-04-06 06:04:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"context" 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-26 02:25:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"encoding/hex" 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-14 09:38:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"errors" 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-09 10:04:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"fmt" 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 06:13:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"io" 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-18 11:27:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"log" 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-03 09:52:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"math/rand" 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-22 05:42:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"net" 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-07 11:35:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"os" 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-13 07:33:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"os/signal" 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-22 10:05:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"runtime" 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 08:51:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"strings" 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-13 07:33:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"syscall" 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-23 03:16:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"time" 
							 
						 
					
						
							
								
									
										
											 
										
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											 
										 
										
											2016-02-13 07:27:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-02 14:15:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/coreos/go-systemd/v22/daemon" 
							 
						 
					
						
							
								
									
										
											 
										
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											 
										 
										
											2016-02-13 07:27:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									"github.com/minio/cli" 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-20 08:53:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/minio/madmin-go/v3" 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-20 02:05:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/minio/minio-go/v7" 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-13 01:12:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/minio/minio-go/v7/pkg/credentials" 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-22 05:42:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/minio/minio-go/v7/pkg/set" 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-02 05:59:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/minio/minio/internal/auth" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									"github.com/minio/minio/internal/bucket/bandwidth" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									"github.com/minio/minio/internal/color" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									"github.com/minio/minio/internal/config" 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-26 06:50:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/minio/minio/internal/handlers" 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-26 02:25:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/minio/minio/internal/hash/sha256" 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-02 05:59:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									xhttp  "github.com/minio/minio/internal/http" 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 02:04:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									xioutil  "github.com/minio/minio/internal/ioutil" 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-02 05:59:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/minio/minio/internal/logger" 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-05 03:57:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"github.com/minio/pkg/v2/certs" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									"github.com/minio/pkg/v2/env" 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-07 01:12:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"golang.org/x/exp/slices" 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									"gopkg.in/yaml.v2" 
							 
						 
					
						
							
								
									
										
											 
										
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											 
										 
										
											2016-02-13 07:27:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								)  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-10 22:57:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// ServerFlags - server command specific flags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								var  ServerFlags  =  [ ] cli . Flag {  
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cli . StringFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :    "config" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "specify server configuration via YAML configuration" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EnvVar :  "MINIO_CONFIG" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-02 06:12:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cli . StringFlag { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-16 08:20:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Name :    "address" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Value :   ":"  +  GlobalMinioDefaultPort , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "bind to a specific ADDRESS:PORT, ADDRESS can be an IP or hostname" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EnvVar :  "MINIO_ADDRESS" , 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-02 06:12:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-09 07:58:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cli . IntFlag { 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 23:45:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Name :    "listeners" ,  // Deprecated Oct 2022
 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-16 08:20:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Value :   1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "bind N number of listeners per ADDRESS:PORT" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EnvVar :  "MINIO_LISTENERS" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-19 23:45:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Hidden :  true , 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-09 07:58:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-18 11:27:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cli . StringFlag { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-16 08:20:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Name :    "console-address" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "bind to a specific ADDRESS:PORT for embedded Console UI, ADDRESS can be an IP or hostname" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EnvVar :  "MINIO_CONSOLE_ADDRESS" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-18 11:27:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 01:06:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cli . DurationFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :    "shutdown-timeout" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Value :   xhttp . DefaultShutdownTimeout , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "shutdown timeout to gracefully shutdown server" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-16 08:20:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EnvVar :  "MINIO_SHUTDOWN_TIMEOUT" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-30 01:06:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Hidden :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-30 21:24:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cli . DurationFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :    "idle-timeout" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Value :   xhttp . DefaultIdleTimeout , 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-18 15:03:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Usage :   "idle timeout is the maximum amount of time to wait for the next request when keep-alive are enabled" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-30 21:24:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										EnvVar :  "MINIO_IDLE_TIMEOUT" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Hidden :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cli . DurationFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :    "read-header-timeout" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Value :   xhttp . DefaultReadHeaderTimeout , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "read header timeout is the amount of time allowed to read request headers" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EnvVar :  "MINIO_READ_HEADER_TIMEOUT" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Hidden :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-10 05:25:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cli . DurationFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :    "conn-client-read-deadline" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "custom connection READ deadline for incoming requests" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Hidden :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EnvVar :  "MINIO_CONN_CLIENT_READ_DEADLINE" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-06 02:09:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cli . DurationFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :    "conn-read-deadline" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "custom connection READ deadline" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Hidden :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Value :   10  *  time . Minute , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EnvVar :  "MINIO_CONN_READ_DEADLINE" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cli . DurationFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :    "conn-write-deadline" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "custom connection WRITE deadline" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Hidden :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Value :   10  *  time . Minute , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EnvVar :  "MINIO_CONN_WRITE_DEADLINE" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-04 05:12:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cli . DurationFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :    "conn-user-timeout" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "custom TCP_USER_TIMEOUT for socket buffers" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Hidden :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Value :   10  *  time . Minute , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EnvVar :  "MINIO_CONN_USER_TIMEOUT" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cli . StringFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :    "interface" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "bind to right VRF device for MinIO services" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Hidden :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EnvVar :  "MINIO_INTERFACE" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-25 06:13:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cli . DurationFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :    "dns-cache-ttl" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "custom DNS cache TTL for baremetal setups" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Hidden :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Value :   10  *  time . Minute , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EnvVar :  "MINIO_DNS_CACHE_TTL" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-30 08:50:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cli . IntFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :    "max-idle-conns-per-host" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :   "set a custom max idle connections per host value" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Hidden :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Value :   2048 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										EnvVar :  "MINIO_MAX_IDLE_CONNS_PER_HOST" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 22:34:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cli . StringSliceFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :   "ftp" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :  "enable and configure an FTP(Secure) server" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cli . StringSliceFlag { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Name :   "sftp" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Usage :  "enable and configure an SFTP server" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} , 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-02 06:12:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-29 05:11:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								var  gatewayCmd  =  cli . Command {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Name :             "gateway" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Usage :            "start object storage gateway" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Hidden :           true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Flags :            append ( ServerFlags ,  GlobalFlags ... ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									HideHelpCommand :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Action :           gatewayMain , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  gatewayMain ( ctx  * cli . Context )  error  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									logger . Fatal ( errInvalidArgument ,  "Gateway is deprecated, To continue to use Gateway please use releases no later than 'RELEASE.2022-10-24T18-35-07Z'. We recommend all our users to migrate from gateway mode to server mode. Please read https://blog.min.io/deprecation-of-the-minio-gateway/" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  nil 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-09-02 06:12:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								var  serverCmd  =  cli . Command {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Name :    "server" , 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-21 09:35:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Usage :   "start object storage server" , 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-10 22:57:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Flags :   append ( ServerFlags ,  GlobalFlags ... ) , 
							 
						 
					
						
							
								
									
										
										
											
												config: Migrate to the new version. Remove backend details.
Migrate to new config format v4.
```
{
	"version": "4",
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"console": {
			"enable": true,
			"level": "fatal"
		},
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		}
	}
}
```
This patch also updates [minio cli spec](./minio.md)
											 
										 
										
											2016-04-02 10:19:44 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									Action :  serverMain , 
							 
						 
					
						
							
								
									
										
											 
										
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											 
										 
										
											2016-02-13 07:27:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									CustomHelpTemplate :  ` NAME : 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-17 03:21:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { { . HelpName } }  -  { { . Usage } } 
							 
						 
					
						
							
								
									
										
											 
										
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											 
										 
										
											2016-02-13 07:27:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								USAGE :  
						 
					
						
							
								
									
										
										
										
											2018-02-16 09:45:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { { . HelpName } }  { { if  . VisibleFlags } } [ FLAGS ]  { { end } } DIR1  [ DIR2 . . ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { { . HelpName } }  { { if  . VisibleFlags } } [ FLAGS ]  { { end } } DIR { 1. . .64 } 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 12:30:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { { . HelpName } }  { { if  . VisibleFlags } } [ FLAGS ]  { { end } } DIR { 1. . .64 }  DIR { 65. . .128 } 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-16 09:45:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								DIR :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  DIR  points  to  a  directory  on  a  filesystem .  When  you  want  to  combine 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  multiple  drives  into  a  single  large  system ,  pass  one  directory  per 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  filesystem  separated  by  space .  You  may  also  use  a  ' ... '  convention 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  to  abbreviate  the  directory  arguments .  Remote  directories  in  a 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  distributed  setup  are  encoded  as  HTTP ( s )  URIs . 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-16 09:45:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ { if  . VisibleFlags } }  
						 
					
						
							
								
									
										
										
										
											2016-08-29 11:04:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								FLAGS :  
						 
					
						
							
								
									
										
										
										
											2017-02-15 18:25:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { { range  . VisibleFlags } } { { . } } 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-16 09:45:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { { end } } { { end } } 
							 
						 
					
						
							
								
									
										
											 
										
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											 
										 
										
											2016-02-13 07:27:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								EXAMPLES :  
						 
					
						
							
								
									
										
										
										
											2023-04-15 22:34:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  1.  Start  MinIO  server  on  "/home/shared"  directory . 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-15 16:32:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     { { . Prompt } }  { { . HelpName } }  / home / shared 
							 
						 
					
						
							
								
									
										
										
											
												config: Migrate to the new version. Remove backend details.
Migrate to new config format v4.
```
{
	"version": "4",
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"console": {
			"enable": true,
			"level": "fatal"
		},
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		}
	}
}
```
This patch also updates [minio cli spec](./minio.md)
											 
										 
										
											2016-04-02 10:19:44 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-04-22 14:59:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  2.  Start  single  node  server  with  64  local  drives  "/mnt/data1"  to  "/mnt/data64" . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								     { { . Prompt } }  { { . HelpName } }  / mnt / data { 1. . .64 } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 22:34:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  3.  Start  distributed  MinIO  server  on  an  32  node  setup  with  32  drives  each ,  run  following  command  on  all  the  nodes 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 12:07:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     { { . Prompt } }  { { . HelpName } }  http : //node{1...32}.example.com/mnt/export{1...32}
 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 08:51:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 22:34:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  4.  Start  distributed  MinIO  server  in  an  expanded  setup ,  run  the  following  command  on  all  the  nodes 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-27 12:07:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     { { . Prompt } }  { { . HelpName } }  http : //node{1...16}.example.com/mnt/export{1...32} \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            http : //node{17...64}.example.com/mnt/export{1...64}
 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 22:34:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  5.  Start  distributed  MinIO  server ,  with  FTP  and  SFTP  servers  on  all  interfaces  via  port  8021 ,  8022  respectively 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								     { { . Prompt } }  { { . HelpName } }  http : //node{1...4}.example.com/mnt/export{1...4} \
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								           -- ftp = "address=:8021"  -- ftp = "passive-port-range=30000-40000"  \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								           -- sftp = "address=:8022"  -- sftp = "ssh-private-key=${HOME}/.ssh/id_rsa" 
							 
						 
					
						
							
								
									
										
											 
										
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											 
										 
										
											2016-02-13 07:27:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								` ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-07 09:03:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  serverCmdArgs ( ctx  * cli . Context )  [ ] string  {  
						 
					
						
							
								
									
										
										
										
											2021-09-02 02:34:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									v ,  _ ,  _ ,  err  :=  env . LookupEnv ( config . EnvArgs ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										logger . FatalIf ( err ,  "Unable to validate passed arguments in %s:%s" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											config . EnvArgs ,  os . Getenv ( config . EnvArgs ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-11 00:59:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  v  ==  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										v ,  _ ,  _ ,  err  =  env . LookupEnv ( config . EnvVolumes ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											logger . FatalIf ( err ,  "Unable to validate passed arguments in %s:%s" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												config . EnvVolumes ,  os . Getenv ( config . EnvVolumes ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-07 09:03:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  v  ==  ""  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-02 02:34:07 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Fall back to older environment value MINIO_ENDPOINTS
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										v ,  _ ,  _ ,  err  =  env . LookupEnv ( config . EnvEndpoints ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											logger . FatalIf ( err ,  "Unable to validate passed arguments in %s:%s" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												config . EnvEndpoints ,  os . Getenv ( config . EnvEndpoints ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-07 09:03:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  v  ==  ""  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-15 04:51:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ! ctx . Args ( ) . Present ( )  ||  ctx . Args ( ) . First ( )  ==  "help"  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											cli . ShowCommandHelpAndExit ( ctx ,  ctx . Command . Name ,  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-07 09:03:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  ctx . Args ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  strings . Fields ( v ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-19 08:51:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  mergeServerCtxtFromConfigFile ( configFile  string ,  ctxt  * serverCtxt )  error  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rd ,  err  :=  Open ( configFile ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  err 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									defer  rd . Close ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cf  :=  & config . ServerConfig { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									dec  :=  yaml . NewDecoder ( rd ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									dec . SetStrict ( true ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  err  =  dec . Decode ( cf ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  err 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  cf . Version  !=  "v1"  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  fmt . Errorf ( "unexpected version: %s" ,  cf . Version ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-09 04:04:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ctxt . RootUser  =  cf . RootUser 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ctxt . RootPwd  =  cf . RootPwd 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  cf . Addr  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ctxt . Addr  =  cf . Addr 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  cf . ConsoleAddr  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ctxt . ConsoleAddr  =  cf . ConsoleAddr 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  cf . CertsDir  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ctxt . CertsDir  =  cf . CertsDir 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ctxt . certsDirSet  =  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  cf . Options . FTP . Address  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ctxt . FTP  =  append ( ctxt . FTP ,  fmt . Sprintf ( "address=%s" ,  cf . Options . FTP . Address ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  cf . Options . FTP . PassivePortRange  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ctxt . FTP  =  append ( ctxt . FTP ,  fmt . Sprintf ( "passive-port-range=%s" ,  cf . Options . FTP . PassivePortRange ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  cf . Options . SFTP . Address  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ctxt . SFTP  =  append ( ctxt . SFTP ,  fmt . Sprintf ( "address=%s" ,  cf . Options . SFTP . Address ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  cf . Options . SFTP . SSHPrivateKey  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ctxt . SFTP  =  append ( ctxt . SFTP ,  fmt . Sprintf ( "ssh-private-key=%s" ,  cf . Options . SFTP . SSHPrivateKey ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ctxt . Layout ,  err  =  buildDisksLayoutFromConfFile ( cf . Pools ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  err 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  serverHandleCmdArgs ( ctxt  serverCtxt )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									handleCommonArgs ( ctxt ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-29 23:55:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-21 14:04:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									logger . FatalIf ( CheckLocalServerAddr ( globalMinioAddr ) ,  "Unable to validate passed arguments" ) 
							 
						 
					
						
							
								
									
										
										
											
												config: Migrate to the new version. Remove backend details.
Migrate to new config format v4.
```
{
	"version": "4",
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"console": {
			"enable": true,
			"level": "fatal"
		},
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		}
	}
}
```
This patch also updates [minio cli spec](./minio.md)
											 
										 
										
											2016-04-02 10:19:44 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-12 05:59:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									var  err  error 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-07 09:03:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									var  setupType  SetupType 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Check and load TLS certificates.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-22 13:42:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalPublicCerts ,  globalTLSCerts ,  globalIsTLS ,  err  =  getTLSConfig ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-07 09:03:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									logger . FatalIf ( err ,  "Unable to load the TLS configuration" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Check and load Root CAs.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-11 23:29:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalRootCAs ,  err  =  certs . GetRootCAs ( globalCertsCADir . Get ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-08-07 09:03:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									logger . FatalIf ( err ,  "Failed to read root CAs (%v)" ,  err ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-14 00:46:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Add the global public crts as part of global root CAs
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  _ ,  publicCrt  :=  range  globalPublicCerts  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										globalRootCAs . AddCert ( publicCrt ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-08-07 09:03:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Register root CAs for remote ENVs
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									env . RegisterGlobalCAs ( globalRootCAs ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-08-16 06:10:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalEndpoints ,  setupType ,  err  =  createServerEndpoints ( globalMinioAddr ,  ctxt . Layout . pools ,  ctxt . Layout . legacy ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-27 02:37:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									logger . FatalIf ( err ,  "Invalid command line arguments" ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-24 02:48:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalNodes  =  globalEndpoints . GetNodes ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-27 02:37:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-09-13 10:10:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalIsErasure  =  ( setupType  ==  ErasureSetupType ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalIsDistErasure  =  ( setupType  ==  DistErasureSetupType ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  globalIsDistErasure  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										globalIsErasure  =  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalIsErasureSD  =  ( setupType  ==  ErasureSDSetupType ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  globalDynamicAPIPort  &&  globalIsDistErasure  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										logger . FatalIf ( errInvalidArgument ,  "Invalid --address=\"%s\", port '0' is not allowed in a distributed erasure coded setup" ,  ctxt . Addr ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-09-13 10:10:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-27 02:37:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalLocalNodeName  =  GetLocalPeer ( globalEndpoints ,  globalMinioHost ,  globalMinioPort ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-07 04:35:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									nodeNameSum  :=  sha256 . Sum256 ( [ ] byte ( globalLocalNodeName ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-26 02:25:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalLocalNodeNameHex  =  hex . EncodeToString ( nodeNameSum [ : ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-16 09:45:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 10:18:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Initialize, see which NIC the service is running on, and save it as global value
 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									setGlobalInternodeInterface ( ctxt . Interface ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 10:18:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-12-22 13:42:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// allow transport to be HTTP/1.1 for proxying.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-13 12:31:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalProxyTransport  =  NewCustomHTTPProxyTransport ( ) ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-02 23:43:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalProxyEndpoints  =  GetProxyEndpoints ( globalEndpoints ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-30 08:50:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalInternodeTransport  =  NewInternodeHTTPTransport ( ctxt . MaxIdleConnsPerHost ) ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-30 23:04:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalRemoteTargetTransport  =  NewRemoteTargetHTTPTransport ( false ) ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-30 15:05:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalHealthChkTransport  =  NewHTTPTransport ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-26 06:50:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalForwarder  =  handlers . NewForwarder ( & handlers . Forwarder { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										PassHost :      true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RoundTripper :  NewHTTPTransportWithTimeout ( 1  *  time . Hour ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Logger :  func ( err  error )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  err  !=  nil  &&  ! errors . Is ( err ,  context . Canceled )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												logger . LogIf ( GlobalContext ,  err ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-04 05:12:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalTCPOptions  =  xhttp . TCPOptions { 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-10 05:25:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										UserTimeout :        int ( ctxt . UserTimeout . Milliseconds ( ) ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ClientReadTimeout :  ctxt . ConnClientReadDeadline , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Interface :          ctxt . Interface , 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-04 05:12:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-09 10:04:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// On macOS, if a process already listens on LOCALIPADDR:PORT, net.Listen() falls back
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// to IPv6 address ie minio will start listening on IPv6 address whereas another
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// (non-)minio process is listening on IPv4 of given port.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-01-04 09:43:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// To avoid this error situation we check for port availability.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-04 05:12:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									logger . FatalIf ( xhttp . CheckPortAvailability ( globalMinioHost ,  globalMinioPort ,  globalTCPOptions ) ,  "Unable to start the server" ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-31 10:22:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalConnReadDeadline  =  ctxt . ConnReadDeadline 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalConnWriteDeadline  =  ctxt . ConnWriteDeadline 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-31 02:21:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-14 18:08:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  initAllSubsystems ( ctx  context . Context )  {  
						 
					
						
							
								
									
										
										
										
											2022-08-24 21:42:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Initialize notification peer targets
 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-10 01:27:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalNotificationSys  =  NewNotificationSys ( globalEndpoints ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-24 21:42:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Create new notification system
 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-05 18:16:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalEventNotifier  =  NewEventNotifier ( GlobalContext ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-24 21:42:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-20 04:53:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Create new bucket metadata system.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 02:45:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  globalBucketMetadataSys  ==  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										globalBucketMetadataSys  =  NewBucketMetadataSys ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Reinitialize safely when testing.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										globalBucketMetadataSys . Reset ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-20 04:53:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-10 11:36:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Create the bucket bandwidth monitor
 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-25 05:36:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalBucketMonitor  =  bandwidth . NewMonitor ( ctx ,  uint64 ( totalNodeCount ( ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-10 11:36:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-10-31 14:39:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Create a new config system.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalConfigSys  =  NewConfigSys ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Create new IAM system.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalIAMSys  =  NewIAMSys ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-11-10 01:27:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Create new policy system.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalPolicySys  =  NewPolicySys ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Create new lifecycle system.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalLifecycleSys  =  NewLifecycleSys ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-05 17:42:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Create new bucket encryption subsystem
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalBucketSSEConfigSys  =  NewBucketSSEConfigSys ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-05 00:42:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-09 04:44:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Create new bucket object lock subsystem
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalBucketObjectLockSys  =  NewBucketObjectLockSys ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-05 00:42:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Create new bucket quota subsystem
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalBucketQuotaSys  =  NewBucketQuotaSys ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-13 11:04:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Create new bucket versioning subsystem
 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-06 02:45:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  globalBucketVersioningSys  ==  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										globalBucketVersioningSys  =  NewBucketVersioningSys ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-22 08:49:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-18 15:03:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Create new bucket replication subsystem
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-17 08:46:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalBucketTargetSys  =  NewBucketTargetSys ( GlobalContext ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-20 01:30:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Create new ILM tier configuration subsystem
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalTierConfigMgr  =  NewTierConfigMgr ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-04 05:16:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalTierJournal  =  NewTierJournal ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-14 23:16:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-08 15:11:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalTransitionState  =  newTransitionState ( GlobalContext ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-11-14 23:16:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalSiteResyncMetrics  =  newSiteResyncMetrics ( GlobalContext ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-10 01:27:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 05:09:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  configRetriableErrors ( err  error )  bool  {  
						 
					
						
							
								
									
										
										
										
											2023-10-24 03:30:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  err  ==  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  false 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-25 04:22:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									notInitialized  :=  strings . Contains ( err . Error ( ) ,  "Server not initialized, please try again" )  || 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										errors . Is ( err ,  errServerNotInitialized ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-24 03:30:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 05:09:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Initializing sub-systems needs a retry mechanism for
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// the following reasons:
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//  - Read quorum is lost just after the initialization
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//    of the object layer.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//  - Write quorum not met when upgrading configuration
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//    version is needed, migration is needed etc.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rquorum  :=  InsufficientReadQuorum { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									wquorum  :=  InsufficientWriteQuorum { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// One of these retriable errors shall be retried.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  errors . Is ( err ,  errDiskNotFound )  || 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										errors . Is ( err ,  errConfigNotFound )  || 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										errors . Is ( err ,  context . DeadlineExceeded )  || 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										errors . Is ( err ,  errErasureWriteQuorum )  || 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										errors . Is ( err ,  errErasureReadQuorum )  || 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-18 06:13:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										errors . Is ( err ,  io . ErrUnexpectedEOF )  || 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 05:09:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										errors . As ( err ,  & rquorum )  || 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										errors . As ( err ,  & wquorum )  || 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-13 10:49:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										isErrObjectNotFound ( err )  || 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 05:09:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										isErrBucketNotFound ( err )  || 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-24 03:30:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										errors . Is ( err ,  os . ErrDeadlineExceeded )  || 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										notInitialized 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 05:09:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  bootstrapTraceMsg ( msg  string )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									info  :=  madmin . TraceInfo { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										TraceType :  madmin . TraceBootstrap , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Time :       UTCNow ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										NodeName :   globalLocalNodeName , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										FuncName :   "BOOTSTRAP" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Message :    fmt . Sprintf ( "%s %s" ,  getSource ( 2 ) ,  msg ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalBootstrapTracer . Record ( info ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-08 23:39:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  serverDebugLog  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-16 07:13:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										fmt . Println ( time . Now ( ) . Round ( time . Millisecond ) . Format ( time . RFC3339 ) ,  " bootstrap: " ,  msg ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-08 23:39:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-03-18 07:01:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									noSubs  :=  globalTrace . NumSubscribers ( madmin . TraceBootstrap )  ==  0 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  noSubs  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-22 07:52:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalTrace . Publish ( info ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  bootstrapTrace ( msg  string ,  worker  func ( ) )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  serverDebugLog  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-16 07:13:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										fmt . Println ( time . Now ( ) . Round ( time . Millisecond ) . Format ( time . RFC3339 ) ,  " bootstrap: " ,  msg ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									now  :=  time . Now ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									worker ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									dur  :=  time . Since ( now ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									info  :=  madmin . TraceInfo { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-22 07:52:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										TraceType :  madmin . TraceBootstrap , 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Time :       UTCNow ( ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-22 07:52:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										NodeName :   globalLocalNodeName , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										FuncName :   "BOOTSTRAP" , 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Message :    fmt . Sprintf ( "%s %s (duration: %s)" ,  getSource ( 2 ) ,  msg ,  dur ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalBootstrapTracer . Record ( info ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  globalTrace . NumSubscribers ( madmin . TraceBootstrap )  ==  0  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalTrace . Publish ( info ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-22 07:52:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-21 00:28:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  initServerConfig ( ctx  context . Context ,  newObject  ObjectLayer )  error  {  
						 
					
						
							
								
									
										
										
										
											2022-03-26 07:29:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									t1  :=  time . Now ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-03 09:52:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									r  :=  rand . New ( rand . NewSource ( time . Now ( ) . UnixNano ( ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										select  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  <- ctx . Done ( ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Retry was canceled successfully.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  fmt . Errorf ( "Initializing sub-systems stopped gracefully %w" ,  ctx . Err ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-03 09:52:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-05-08 07:12:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// These messages only meant primarily for distributed setup, so only log during distributed setup.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-13 11:04:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  globalIsDistErasure  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-22 04:56:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											logger . Info ( "Waiting for all MinIO sub-systems to be initialize..." ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-08 07:12:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-07 05:25:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-22 04:56:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Upon success migrating the config, initialize all sub-systems
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// if all sub-systems initialized successfully return right away
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										err  :=  initConfigSubsystem ( ctx ,  newObject ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  err  ==  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// All successful return.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  globalIsDistErasure  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												// These messages only meant primarily for distributed setup, so only log during distributed setup.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												logger . Info ( "All MinIO sub-systems initialized successfully in %s" ,  time . Since ( t1 ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-02 09:07:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-22 04:56:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  nil 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-05 11:04:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 05:09:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  configRetriableErrors ( err )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-07 05:25:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											logger . Info ( "Waiting for all MinIO sub-systems to be initialized.. possible cause (%v)" ,  err ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-03 09:52:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											time . Sleep ( time . Duration ( r . Float64 ( )  *  float64 ( 5 * time . Second ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-05 11:04:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											continue 
							 
						 
					
						
							
								
									
										
										
										
											2020-02-02 09:07:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-05 11:04:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Any other unhandled return right here.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  fmt . Errorf ( "Unable to initialize sub-systems: %w" ,  err ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-05 11:04:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-10 01:27:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  initConfigSubsystem ( ctx  context . Context ,  newObject  ObjectLayer )  error  {  
						 
					
						
							
								
									
										
										
										
											2020-05-07 05:25:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// %w is used by all error returns here to make sure
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// we wrap the underlying error, make sure when you
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// are modifying this code that you do so, if and when
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// you want to add extra context to your error. This
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// ensures top level retry works accordingly.
 
							 
						 
					
						
							
								
									
										
										
										
											2021-01-04 03:27:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-11-10 01:27:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Initialize config system.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  err  :=  globalConfigSys . Init ( newObject ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-19 05:09:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  configRetriableErrors ( err )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  fmt . Errorf ( "Unable to initialize config system: %w" ,  err ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-10 00:59:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-10 00:59:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Any other config errors we simply print a message and proceed forward.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-07 21:22:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										logger . LogIf ( ctx ,  fmt . Errorf ( "Unable to initialize config, some features may be missing: %w" ,  err ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-10 01:27:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2020-05-05 11:04:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  nil 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-31 14:39:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 10:18:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  setGlobalInternodeInterface ( interfaceName  string )  {  
						 
					
						
							
								
									
										
										
										
											2023-07-14 02:41:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									globalInternodeInterfaceOnce . Do ( func ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 10:18:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  interfaceName  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											globalInternodeInterface  =  interfaceName 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-14 02:41:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ip  :=  "127.0.0.1" 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 10:18:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										host ,  _  :=  mustSplitHostPort ( globalLocalNodeName ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-14 02:41:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  host  !=  ""  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 10:18:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  net . ParseIP ( host )  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ip  =  host 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												ctx ,  cancel  :=  context . WithTimeout ( context . Background ( ) ,  2 * time . Second ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												defer  cancel ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-29 01:54:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												lookupHost  :=  globalDNSCache . LookupHost 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  IsKubernetes ( )  ||  IsDocker ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													lookupHost  =  net . DefaultResolver . LookupHost 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												haddrs ,  err  :=  lookupHost ( ctx ,  host ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-19 10:18:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  err  ==  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ip  =  haddrs [ 0 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-07-14 02:41:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ifs ,  _  :=  net . Interfaces ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  _ ,  interf  :=  range  ifs  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											addrs ,  err  :=  interf . Addrs ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  err  ==  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												for  _ ,  addr  :=  range  addrs  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  strings . SplitN ( addr . String ( ) ,  "/" ,  2 ) [ 0 ]  ==  ip  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														globalInternodeInterface  =  interf . Name 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-10-22 05:42:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Return the list of address that MinIO server needs to listen on:
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//   - Returning 127.0.0.1 is necessary so Console will be able to send
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//     requests to the local S3 API.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//   - The returned List needs to be deduplicated as well.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  getServerListenAddrs ( )  [ ] string  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Use a string set to avoid duplication
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									addrs  :=  set . NewStringSet ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// Listen on local interface to receive requests from Console
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  _ ,  ip  :=  range  mustGetLocalIPs ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ip  !=  nil  &&  ip . IsLoopback ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											addrs . Add ( net . JoinHostPort ( ip . String ( ) ,  globalMinioPort ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-13 10:48:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									host ,  _  :=  mustSplitHostPort ( globalMinioAddr ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  host  !=  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ctx ,  cancel  :=  context . WithTimeout ( context . Background ( ) ,  2 * time . Second ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										defer  cancel ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-29 01:54:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										lookupHost  :=  globalDNSCache . LookupHost 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  IsKubernetes ( )  ||  IsDocker ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											lookupHost  =  net . DefaultResolver . LookupHost 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										haddrs ,  err  :=  lookupHost ( ctx ,  host ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-13 10:48:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  err  ==  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											for  _ ,  addr  :=  range  haddrs  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												addrs . Add ( net . JoinHostPort ( addr ,  globalMinioPort ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Unable to lookup host in 2-secs, let it fail later anyways.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											addrs . Add ( globalMinioAddr ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										addrs . Add ( globalMinioAddr ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-22 05:42:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  addrs . ToSlice ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-31 02:21:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// serverMain handler called for 'minio server' command.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								func  serverMain ( ctx  * cli . Context )  {  
						 
					
						
							
								
									
										
										
										
											2020-10-13 05:19:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									signal . Notify ( globalOSSignalCh ,  os . Interrupt ,  syscall . SIGTERM ,  syscall . SIGQUIT ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-09 00:10:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									go  handleSignals ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-01-22 07:49:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									setDefaultProfilerRates ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-31 02:21:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-02-26 17:33:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Initialize globalConsoleSys system
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bootstrapTrace ( "newConsoleLogger" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										globalConsoleSys  =  NewConsoleLogger ( GlobalContext ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										logger . AddSystemTarget ( GlobalContext ,  globalConsoleSys ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Set node name, only set for distributed setup.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										globalConsoleSys . SetNodeName ( globalLocalNodeName ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-16 12:13:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Always load ENV variables from files first.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									loadEnvVarsFromFiles ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Handle all server command args and build the disks layout
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bootstrapTrace ( "serverHandleCmdArgs" ,  func ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										err  :=  buildServerCtxt ( ctx ,  & globalServerCtxt ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										logger . FatalIf ( err ,  "Unable to prepare the list of endpoints" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										serverHandleCmdArgs ( globalServerCtxt ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-11 00:59:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// DNS cache subsystem to reduce outgoing DNS requests
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									runDNSCache ( ctx ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-13 06:32:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Handle all server environment vars.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									serverHandleEnvVars ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-09 04:04:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Load the root credentials from the shell environment or from
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// the config file if not defined, set the default one.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									loadRootCredentials ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Perform any self-tests
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bootstrapTrace ( "selftests" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bitrotSelfTest ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										erasureSelfTest ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										compressSelfTest ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-14 04:06:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Initialize KMS configuration
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bootstrapTrace ( "handleKMSConfig" ,  handleKMSConfig ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-17 12:30:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-12-05 07:32:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Initialize all help
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bootstrapTrace ( "initHelp" ,  initHelp ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-05 07:32:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-20 00:54:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Initialize all sub-systems
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bootstrapTrace ( "initAllSubsystems" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										initAllSubsystems ( GlobalContext ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-20 00:54:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-12-04 14:47:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Is distributed setup, error out if no certificates are found for HTTPS endpoints.
 
							 
						 
					
						
							
								
									
										
										
										
											2020-06-13 11:04:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  globalIsDistErasure  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-22 13:42:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  globalEndpoints . HTTPS ( )  &&  ! globalIsTLS  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-05 01:35:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											logger . Fatal ( config . ErrNoCertsAndHTTPSEndpoints ( nil ) ,  "Unable to start the server" ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-10 10:10:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-22 13:42:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ! globalEndpoints . HTTPS ( )  &&  globalIsTLS  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-05 01:35:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											logger . Fatal ( config . ErrCertsAndHTTPEndpoints ( nil ) ,  "Unable to start the server" ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-10 10:10:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-04 14:47:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-14 01:43:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Check for updates in non-blocking manner.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									go  func ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ! globalServerCtxt . Quiet  &&  ! globalInplaceUpdateDisabled  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-14 01:43:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Check for new updates from dl.min.io.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bootstrapTrace ( "checkUpdate" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												checkUpdate ( getMinioMode ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-14 01:43:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-17 03:21:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-31 02:21:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Set system resources to maximum.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bootstrapTrace ( "setMaxResources" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										_  =  setMaxResources ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-31 02:21:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-11 09:36:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Verify kernel release and version.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  oldLinux ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										logger . Info ( color . RedBold ( "WARNING: Detected Linux kernel version older than 4.0.0 release, there are some known potential performance problems with this kernel version. MinIO recommends a minimum of 4.x.x linux kernel version for best performance" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-03-22 10:05:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									maxProcs  :=  runtime . GOMAXPROCS ( 0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cpuProcs  :=  runtime . NumCPU ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  maxProcs  <  cpuProcs  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-12-14 00:27:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										logger . Info ( color . RedBoldf ( "WARNING: Detected GOMAXPROCS(%d) < NumCPU(%d), please make sure to provide all PROCS to MinIO for optimal performance" ,  maxProcs ,  cpuProcs ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-22 10:05:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-01 03:30:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									var  getCert  certs . GetCertificateFunc 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  globalTLSCerts  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										getCert  =  globalTLSCerts . GetCertificate 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2024-01-25 05:36:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Initialize gridn
 
							 
						 
					
						
							
								
									
										
											 
										
											
												perf: websocket grid connectivity for all internode communication (#18461)
This PR adds a WebSocket grid feature that allows servers to communicate via 
a single two-way connection.
There are two request types:
* Single requests, which are `[]byte => ([]byte, error)`. This is for efficient small
  roundtrips with small payloads.
* Streaming requests which are `[]byte, chan []byte => chan []byte (and error)`,
  which allows for different combinations of full two-way streams with an initial payload.
Only a single stream is created between two machines - and there is, as such, no
server/client relation since both sides can initiate and handle requests. Which server
initiates the request is decided deterministically on the server names.
Requests are made through a mux client and server, which handles message
passing, congestion, cancelation, timeouts, etc.
If a connection is lost, all requests are canceled, and the calling server will try
to reconnect. Registered handlers can operate directly on byte 
slices or use a higher-level generics abstraction.
There is no versioning of handlers/clients, and incompatible changes should
be handled by adding new handlers.
The request path can be changed to a new one for any protocol changes.
First, all servers create a "Manager." The manager must know its address 
as well as all remote addresses. This will manage all connections.
To get a connection to any remote, ask the manager to provide it given
the remote address using.
```
func (m *Manager) Connection(host string) *Connection
```
All serverside handlers must also be registered on the manager. This will
make sure that all incoming requests are served. The number of in-flight 
requests and responses must also be given for streaming requests.
The "Connection" returned manages the mux-clients. Requests issued
to the connection will be sent to the remote.
* `func (c *Connection) Request(ctx context.Context, h HandlerID, req []byte) ([]byte, error)`
   performs a single request and returns the result. Any deadline provided on the request is
   forwarded to the server, and canceling the context will make the function return at once.
* `func (c *Connection) NewStream(ctx context.Context, h HandlerID, payload []byte) (st *Stream, err error)`
   will initiate a remote call and send the initial payload.
```Go
// A Stream is a two-way stream.
// All responses *must* be read by the caller.
// If the call is canceled through the context,
//The appropriate error will be returned.
type Stream struct {
	// Responses from the remote server.
	// Channel will be closed after an error or when the remote closes.
	// All responses *must* be read by the caller until either an error is returned or the channel is closed.
	// Canceling the context will cause the context cancellation error to be returned.
	Responses <-chan Response
	// Requests sent to the server.
	// If the handler is defined with 0 incoming capacity this will be nil.
	// Channel *must* be closed to signal the end of the stream.
	// If the request context is canceled, the stream will no longer process requests.
	Requests chan<- []byte
}
type Response struct {
	Msg []byte
	Err error
}
```
There are generic versions of the server/client handlers that allow the use of type
safe implementations for data types that support msgpack marshal/unmarshal.
											 
										 
										
											2023-11-21 09:09:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bootstrapTrace ( "initGrid" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										logger . FatalIf ( initGlobalGrid ( GlobalContext ,  globalEndpoints ) ,  "Unable to configure server grid RPC services" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Configure server.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bootstrapTrace ( "configureServer" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										handler ,  err  :=  configureServerHandler ( globalEndpoints ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-13 00:09:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  err  !=  nil  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											logger . Fatal ( config . ErrUnexpectedError ( err ) ,  "Unable to configure one of server's RPC services" ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-13 00:09:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
											 
										
											
												perf: websocket grid connectivity for all internode communication (#18461)
This PR adds a WebSocket grid feature that allows servers to communicate via 
a single two-way connection.
There are two request types:
* Single requests, which are `[]byte => ([]byte, error)`. This is for efficient small
  roundtrips with small payloads.
* Streaming requests which are `[]byte, chan []byte => chan []byte (and error)`,
  which allows for different combinations of full two-way streams with an initial payload.
Only a single stream is created between two machines - and there is, as such, no
server/client relation since both sides can initiate and handle requests. Which server
initiates the request is decided deterministically on the server names.
Requests are made through a mux client and server, which handles message
passing, congestion, cancelation, timeouts, etc.
If a connection is lost, all requests are canceled, and the calling server will try
to reconnect. Registered handlers can operate directly on byte 
slices or use a higher-level generics abstraction.
There is no versioning of handlers/clients, and incompatible changes should
be handled by adding new handlers.
The request path can be changed to a new one for any protocol changes.
First, all servers create a "Manager." The manager must know its address 
as well as all remote addresses. This will manage all connections.
To get a connection to any remote, ask the manager to provide it given
the remote address using.
```
func (m *Manager) Connection(host string) *Connection
```
All serverside handlers must also be registered on the manager. This will
make sure that all incoming requests are served. The number of in-flight 
requests and responses must also be given for streaming requests.
The "Connection" returned manages the mux-clients. Requests issued
to the connection will be sent to the remote.
* `func (c *Connection) Request(ctx context.Context, h HandlerID, req []byte) ([]byte, error)`
   performs a single request and returns the result. Any deadline provided on the request is
   forwarded to the server, and canceling the context will make the function return at once.
* `func (c *Connection) NewStream(ctx context.Context, h HandlerID, payload []byte) (st *Stream, err error)`
   will initiate a remote call and send the initial payload.
```Go
// A Stream is a two-way stream.
// All responses *must* be read by the caller.
// If the call is canceled through the context,
//The appropriate error will be returned.
type Stream struct {
	// Responses from the remote server.
	// Channel will be closed after an error or when the remote closes.
	// All responses *must* be read by the caller until either an error is returned or the channel is closed.
	// Canceling the context will cause the context cancellation error to be returned.
	Responses <-chan Response
	// Requests sent to the server.
	// If the handler is defined with 0 incoming capacity this will be nil.
	// Channel *must* be closed to signal the end of the stream.
	// If the request context is canceled, the stream will no longer process requests.
	Requests chan<- []byte
}
type Response struct {
	Msg []byte
	Err error
}
```
There are generic versions of the server/client handlers that allow the use of type
safe implementations for data types that support msgpack marshal/unmarshal.
											 
										 
										
											2023-11-21 09:09:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Allow grid to start after registering all services.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-29 02:04:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										xioutil . SafeClose ( globalGridStart ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-14 16:11:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										httpServer  :=  xhttp . NewServer ( getServerListenAddrs ( ) ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											UseHandler ( setCriticalErrorHandler ( corsHandler ( handler ) ) ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											UseTLSConfig ( newTLSConfig ( getCert ) ) . 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											UseShutdownTimeout ( globalServerCtxt . ShutdownTimeout ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											UseIdleTimeout ( globalServerCtxt . IdleTimeout ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											UseReadHeaderTimeout ( globalServerCtxt . ReadHeaderTimeout ) . 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											UseBaseContext ( GlobalContext ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											UseCustomLogger ( log . New ( io . Discard ,  "" ,  0 ) ) .  // Turn-off random logging by Go stdlib
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											UseTCPOptions ( globalTCPOptions ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										httpServer . TCPOptions . Trace  =  bootstrapTraceMsg 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										go  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											serveFn ,  err  :=  httpServer . Init ( GlobalContext ,  func ( listenAddr  string ,  err  error )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												logger . LogIf ( GlobalContext ,  fmt . Errorf ( "Unable to listen on `%s`: %v" ,  listenAddr ,  err ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												globalHTTPServerErrorCh  <-  err 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												return 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											globalHTTPServerErrorCh  <-  serveFn ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										setHTTPServer ( httpServer ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-03 07:54:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-11-16 23:59:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  globalIsDistErasure  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "verifying system configuration" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Additionally in distributed setup, validate the setup and configuration.
 
							 
						 
					
						
							
								
									
										
										
										
											2024-01-25 05:36:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  err  :=  verifyServerSystemConfig ( GlobalContext ,  globalEndpoints ,  globalGrid . Load ( ) ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												logger . Fatal ( err ,  "Unable to start the server" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-11-23 04:45:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-21 00:28:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ! globalDisableFreezeOnBoot  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Freeze the services until the bucket notification subsystem gets initialized.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "freezeServices" ,  freezeServices ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-21 00:28:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									var  newObject  ObjectLayer 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bootstrapTrace ( "newObjectLayer" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										var  err  error 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										newObject ,  err  =  newObjectLayer ( GlobalContext ,  globalEndpoints ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											logFatalErrs ( err ,  Endpoint { } ,  true ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-05 04:21:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-18 23:06:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									xhttp . SetDeploymentID ( globalDeploymentID ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-24 05:36:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									xhttp . SetMinIOVersion ( Version ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-29 10:39:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-28 00:23:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for  _ ,  n  :=  range  globalNodes  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										nodeName  :=  n . Host 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  n . IsLocal  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											nodeName  =  globalLocalNodeName 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-18 23:06:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										nodeNameSum  :=  sha256 . Sum256 ( [ ] byte ( nodeName  +  globalDeploymentID ( ) ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-28 00:23:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										globalNodeNamesHex [ hex . EncodeToString ( nodeNameSum [ : ] ) ]  =  struct { } { } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									var  err  error 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bootstrapTrace ( "initServerConfig" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  err  =  initServerConfig ( GlobalContext ,  newObject ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											var  cerr  config . Err 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// For any config error, we don't need to drop into safe-mode
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// instead its a user error and should be fixed by user.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  errors . As ( err ,  & cerr )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												logger . FatalIf ( err ,  "Unable to initialize the server" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// If context was canceled
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  errors . Is ( err ,  context . Canceled )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												logger . FatalIf ( err ,  "Server startup canceled upon user request" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											logger . LogIf ( GlobalContext ,  err ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ! globalServerCtxt . StrictS3Compat  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											logger . Info ( color . RedBold ( "WARNING: Strict AWS S3 compatible incoming PUT, POST content payload validation is turned off, caution is advised do not use in production" ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-21 00:28:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  globalActiveCred . Equal ( auth . DefaultCredentials )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										msg  :=  fmt . Sprintf ( "WARNING: Detected default credentials '%s', we recommend that you change these values with 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment variables" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											globalActiveCred ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										logger . Info ( color . RedBold ( msg ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-14 03:54:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Initialize users credentials and policies in background right after config has initialized.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									go  func ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "globalIAMSys.Init" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											globalIAMSys . Init ( GlobalContext ,  newObject ,  globalEtcdClient ,  globalRefreshIAMInterval ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-07 16:17:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-06-21 00:28:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Initialize Console UI
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-14 03:54:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  globalBrowserEnabled  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bootstrapTrace ( "initConsoleServer" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												srv ,  err  :=  initConsoleServer ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													logger . FatalIf ( err ,  "Unable to initialize console service" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-07 16:17:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												setConsoleSrv ( srv ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-07 16:17:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												go  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													logger . FatalIf ( newConsoleServerFn ( ) . Serve ( ) ,  "Unable to initialize console server" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-14 03:54:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 22:34:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// if we see FTP args, start FTP if possible
 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  len ( globalServerCtxt . FTP )  >  0  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bootstrapTrace ( "go startFTPServer" ,  func ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												go  startFTPServer ( globalServerCtxt . FTP ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 22:34:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// If we see SFTP args, start SFTP if possible
 
							 
						 
					
						
							
								
									
										
										
										
											2023-12-07 17:33:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  len ( globalServerCtxt . SFTP )  >  0  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bootstrapTrace ( "go startSFTPServer" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												go  startSFTPServer ( globalServerCtxt . SFTP ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-15 22:34:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-14 03:54:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-18 05:42:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									go  func ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-24 03:30:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										r  :=  rand . New ( rand . NewSource ( time . Now ( ) . UnixNano ( ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 23:44:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ! globalDisableFreezeOnBoot  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											defer  bootstrapTrace ( "unfreezeServices" ,  unfreezeServices ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 23:44:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											t  :=  time . AfterFunc ( 5 * time . Minute ,  func ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-24 03:30:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												logger . Info ( color . Yellow ( "WARNING: Initializing the config subsystem is taking longer than 5 minutes. Please set '_MINIO_DISABLE_API_FREEZE_ON_BOOT=true' to not freeze the APIs" ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 23:44:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											defer  t . Stop ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-08 04:46:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Initialize data scanner.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "initDataScanner" ,  func ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-11-23 05:46:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  v  :=  env . Get ( "_MINIO_SCANNER" ,  config . EnableOn ) ;  v  ==  config . EnableOn  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												initDataScanner ( GlobalContext ,  newObject ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-08 04:46:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Initialize background replication
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "initBackgroundReplication" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											initBackgroundReplication ( GlobalContext ,  newObject ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-08 04:46:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "globalTransitionState.Init" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											globalTransitionState . Init ( newObject ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-08 04:46:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Initialize batch job pool.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "newBatchJobPool" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											globalBatchJobPool  =  newBatchJobPool ( GlobalContext ,  newObject ,  100 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-03 17:10:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-08 04:46:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Initialize the license update job
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "initLicenseUpdateJob" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											initLicenseUpdateJob ( GlobalContext ,  newObject ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-08 04:46:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-05-31 01:58:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										go  func ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-08 04:46:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Initialize transition tier configuration manager
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bootstrapTrace ( "globalTierConfigMgr.Init" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  err  :=  globalTierConfigMgr . Init ( GlobalContext ,  newObject ) ;  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													logger . LogIf ( GlobalContext ,  err ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													logger . FatalIf ( globalTierJournal . Init ( GlobalContext ) ,  "Unable to initialize remote tier pending deletes journal" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-31 01:58:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-18 05:42:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 23:44:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Initialize bucket notification system.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "initBucketTargets" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											logger . LogIf ( GlobalContext ,  globalEventNotifier . InitBucketTargets ( GlobalContext ,  newObject ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 23:44:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										var  buckets  [ ] BucketInfo 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 23:44:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// List buckets to initialize bucket metadata sub-sys.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "listBuckets" ,  func ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-10-24 03:30:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												buckets ,  err  =  newObject . ListBuckets ( GlobalContext ,  BucketOptions { } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  err  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  configRetriableErrors ( err )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														logger . Info ( "Waiting for list buckets to succeed to initialize buckets.. possible cause (%v)" ,  err ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														time . Sleep ( time . Duration ( r . Float64 ( )  *  float64 ( time . Second ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														continue 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													logger . LogIf ( GlobalContext ,  fmt . Errorf ( "Unable to list buckets to initialize bucket metadata sub-system: %w" ,  err ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-21 05:03:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Initialize bucket metadata sub-system.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "globalBucketMetadataSys.Init" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											globalBucketMetadataSys . Init ( GlobalContext ,  buckets ,  newObject ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-03 09:52:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 23:44:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// initialize replication resync state.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "initResync" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											globalReplicationPool . initResync ( GlobalContext ,  buckets ,  newObject ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-19 23:44:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Initialize site replication manager after bucket metadata
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "globalSiteReplicationSys.Init" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											globalSiteReplicationSys . Init ( GlobalContext ,  newObject ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-17 10:00:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-08 04:46:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Initialize quota manager.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bootstrapTrace ( "globalBucketQuotaSys.Init" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											globalBucketQuotaSys . Init ( newObject ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-13 05:19:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-08 04:46:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Populate existing buckets to the etcd backend
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  globalDNSConfig  !=  nil  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											// Background this operation.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bootstrapTrace ( "go initFederatorBackend" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												go  initFederatorBackend ( buckets ,  newObject ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2019-10-23 13:59:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// Prints the formatted startup message, if err is not nil then it prints additional information as well.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printStartupMessage ( getAPIEndpoints ( ) ,  err ) 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-10 15:07:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// Print a warning at the end of the startup banner so it is more noticeable
 
							 
						 
					
						
							
								
									
										
										
										
											2023-05-05 05:44:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  newObject . BackendInfo ( ) . StandardSCParity  ==  0  { 
							 
						 
					
						
							
								
									
										
										
										
											2023-01-10 15:07:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											logger . Error ( "Warning: The standard parity is set to 0. This can lead to data loss." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-09 03:40:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-07-13 01:12:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									region  :=  globalSite . Region 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  region  ==  ""  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										region  =  "us-east-1" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2023-08-23 18:07:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bootstrapTrace ( "globalMinioClient" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										globalMinioClient ,  err  =  minio . New ( globalLocalNodeName ,  & minio . Options { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Creds :      credentials . NewStaticV4 ( globalActiveCred . AccessKey ,  globalActiveCred . SecretKey ,  "" ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Secure :     globalIsTLS , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Transport :  globalProxyTransport , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											Region :     region , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										logger . FatalIf ( err ,  "Unable to initialize MinIO client" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-13 01:12:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-10-01 04:40:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									go  bootstrapTrace ( "startResourceMetricsCollection" ,  func ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										startResourceMetricsCollection ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-02-15 05:19:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// Add User-Agent to differentiate the requests.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									globalMinioClient . SetAppInfo ( "minio-perf-test" ,  ReleaseTag ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-28 10:51:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  serverDebugLog  { 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-16 07:13:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										fmt . Println ( "== DEBUG Mode enabled ==" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										fmt . Println ( "Currently set environment settings:" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-21 05:03:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ks  :=  [ ] string { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											config . EnvAccessKey , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											config . EnvSecretKey , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											config . EnvRootUser , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											config . EnvRootPassword , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-28 10:51:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for  _ ,  v  :=  range  os . Environ ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-21 05:03:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											// Do not print sensitive creds in debug.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-06-07 01:12:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  slices . Contains ( ks ,  strings . Split ( v ,  "=" ) [ 0 ] )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-21 05:03:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												continue 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-16 07:13:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											fmt . Println ( v ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-28 10:51:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2024-02-16 07:13:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										fmt . Println ( "======" ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-28 10:51:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-08 02:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-05-13 07:42:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									daemon . SdNotify ( false ,  daemon . SdNotifyReady ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-09-01 09:52:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									<- globalOSSignalCh 
							 
						 
					
						
							
								
									
										
											 
										
											
												config/main: Re-write config files - add to new config v3
- New config format.
```
{
	"version": "3",
	"address": ":9000",
    "backend": {
          "type": "fs",
          "disk": "/path"
    },
	"credential": {
		"accessKey": "WLGDGYAQYIGI833EV05A",
		"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
	},
	"region": "us-east-1",
	"logger": {
		"file": {
			"enable": false,
			"fileName": "",
			"level": "error"
		},
		"syslog": {
			"enable": false,
			"address": "",
			"level": "debug"
		},
		"console": {
			"enable": true,
			"level": "fatal"
		}
	}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
											 
										 
										
											2016-02-13 07:27:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2017-01-17 09:05:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// Initialize object layer with the supplied disks, objectLayer is nil upon any error.
  
						 
					
						
							
								
									
										
										
										
											2020-12-02 05:50:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								func  newObjectLayer ( ctx  context . Context ,  endpointServerPools  EndpointServerPools )  ( newObject  ObjectLayer ,  err  error )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  newErasureServerPools ( ctx ,  endpointServerPools ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-17 09:05:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}