| 
									
										
											  
											
												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
										 |  |  | /* | 
					
						
							| 
									
										
										
										
											2018-03-16 04:03:41 +08:00
										 |  |  |  * Minio Cloud Storage, (C) 2015, 2016, 2017, 2018 Minio, Inc. | 
					
						
							| 
									
										
											  
											
												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
										 |  |  |  * | 
					
						
							|  |  |  |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
					
						
							|  |  |  |  * you may not use this file except in compliance with the License. | 
					
						
							|  |  |  |  * You may obtain a copy of the License at | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *     http://www.apache.org/licenses/LICENSE-2.0
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Unless required by applicable law or agreed to in writing, software | 
					
						
							|  |  |  |  * distributed under the License is distributed on an "AS IS" BASIS, | 
					
						
							|  |  |  |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
					
						
							|  |  |  |  * See the License for the specific language governing permissions and | 
					
						
							|  |  |  |  * limitations under the License. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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" | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 	"fmt" | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	"net/http" | 
					
						
							| 
									
										
										
										
											2017-03-07 11:35:26 +08:00
										 |  |  | 	"os" | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	"os/signal" | 
					
						
							| 
									
										
										
										
											2018-05-19 08:51:03 +08:00
										 |  |  | 	"strings" | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	"syscall" | 
					
						
							| 
									
										
											  
											
												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" | 
					
						
							| 
									
										
										
										
											2017-06-06 03:25:04 +08:00
										 |  |  | 	"github.com/minio/dsync" | 
					
						
							| 
									
										
										
										
											2018-04-22 10:23:54 +08:00
										 |  |  | 	xhttp "github.com/minio/minio/cmd/http" | 
					
						
							| 
									
										
										
										
											2018-04-06 06:04:40 +08:00
										 |  |  | 	"github.com/minio/minio/cmd/logger" | 
					
						
							| 
									
										
										
										
											2018-06-01 03:30:15 +08:00
										 |  |  | 	"github.com/minio/minio/pkg/certs" | 
					
						
							| 
									
										
											  
											
												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
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-22 02:11:57 +08:00
										 |  |  | func init() { | 
					
						
							| 
									
										
										
										
											2018-06-19 03:04:46 +08:00
										 |  |  | 	logger.Init(GOPATH, GOROOT) | 
					
						
							| 
									
										
										
										
											2018-05-22 02:11:57 +08:00
										 |  |  | 	logger.RegisterUIError(fmtError) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-02 06:12:49 +08:00
										 |  |  | var serverFlags = []cli.Flag{ | 
					
						
							|  |  |  | 	cli.StringFlag{ | 
					
						
							|  |  |  | 		Name:  "address", | 
					
						
							| 
									
										
										
										
											2017-07-21 07:39:11 +08:00
										 |  |  | 		Value: ":" + globalMinioPort, | 
					
						
							| 
									
										
										
										
											2017-02-25 06:19:20 +08:00
										 |  |  | 		Usage: "Bind to a specific ADDRESS:PORT, ADDRESS can be an IP or hostname.", | 
					
						
							| 
									
										
										
										
											2016-09-02 06:12:49 +08:00
										 |  |  | 	}, | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var serverCmd = cli.Command{ | 
					
						
							|  |  |  | 	Name:   "server", | 
					
						
							|  |  |  | 	Usage:  "Start object storage server.", | 
					
						
							|  |  |  | 	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} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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
										 |  |  | ENVIRONMENT VARIABLES: | 
					
						
							| 
									
										
										
										
											2016-07-11 05:38:15 +08:00
										 |  |  |   ACCESS: | 
					
						
							| 
									
										
										
										
											2018-02-02 11:43:30 +08:00
										 |  |  |      MINIO_ACCESS_KEY: Custom username or access key of minimum 3 characters in length. | 
					
						
							| 
									
										
										
										
											2017-08-04 11:03:37 +08:00
										 |  |  |      MINIO_SECRET_KEY: Custom password or secret key of minimum 8 characters in length. | 
					
						
							| 
									
										
										
										
											2016-12-10 16:42:22 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   BROWSER: | 
					
						
							|  |  |  |      MINIO_BROWSER: To disable web browser access, set this value to "off". | 
					
						
							| 
									
										
										
										
											2016-07-11 05:38:15 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-29 05:14:06 +08:00
										 |  |  |   CACHE: | 
					
						
							| 
									
										
										
										
											2018-04-02 12:55:09 +08:00
										 |  |  |      MINIO_CACHE_DRIVES: List of mounted drives or directories delimited by ";". | 
					
						
							| 
									
										
										
										
											2018-03-30 04:29:21 +08:00
										 |  |  |      MINIO_CACHE_EXCLUDE: List of cache exclusion patterns delimited by ";". | 
					
						
							|  |  |  |      MINIO_CACHE_EXPIRY: Cache expiry duration in days. | 
					
						
							| 
									
										
										
										
											2018-06-26 01:24:12 +08:00
										 |  |  |      MINIO_CACHE_MAXUSE: Maximum permitted usage of the cache in percentage (0-100). | 
					
						
							| 
									
										
										
										
											2018-06-07 09:10:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-27 00:11:39 +08:00
										 |  |  |   DOMAIN: | 
					
						
							| 
									
										
										
										
											2018-03-30 04:29:21 +08:00
										 |  |  |      MINIO_DOMAIN: To enable virtual-host-style requests, set this value to Minio host domain name. | 
					
						
							| 
									
										
										
										
											2018-03-27 00:11:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-28 07:44:45 +08:00
										 |  |  |   WORM: | 
					
						
							|  |  |  |      MINIO_WORM: To turn on Write-Once-Read-Many in server, set this value to "on". | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  |   BUCKET-DNS: | 
					
						
							| 
									
										
										
										
											2018-04-05 23:18:42 +08:00
										 |  |  |      MINIO_DOMAIN:    To enable bucket DNS requests, set this value to Minio host domain name. | 
					
						
							| 
									
										
										
										
											2018-05-12 03:02:30 +08:00
										 |  |  |      MINIO_PUBLIC_IPS: To enable bucket DNS requests, set this value to list of Minio host public IP(s) delimited by ",". | 
					
						
							| 
									
										
										
										
											2018-04-05 23:18:42 +08:00
										 |  |  |      MINIO_ETCD_ENDPOINTS: To enable bucket DNS requests, set this value to list of etcd endpoints delimited by ",". | 
					
						
							| 
									
										
										
										
											2018-02-03 10:18:52 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												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: | 
					
						
							| 
									
										
										
										
											2016-11-10 15:37:12 +08:00
										 |  |  |   1. Start minio server on "/home/shared" directory. | 
					
						
							| 
									
										
										
										
											2018-05-22 02:11:57 +08:00
										 |  |  |      $ {{.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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-25 06:19:20 +08:00
										 |  |  |   2. Start minio server bound to a specific ADDRESS:PORT. | 
					
						
							| 
									
										
										
										
											2018-05-22 02:11:57 +08:00
										 |  |  |      $ {{.HelpName}} --address 192.168.1.101:9000 /home/shared | 
					
						
							| 
									
										
											  
											
												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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-27 00:11:39 +08:00
										 |  |  |   3. Start minio server and enable virtual-host-style requests. | 
					
						
							| 
									
										
										
										
											2018-05-22 02:11:57 +08:00
										 |  |  |      $ export MINIO_DOMAIN=mydomain.com | 
					
						
							|  |  |  |      $ {{.HelpName}} --address mydomain.com:9000 /mnt/export | 
					
						
							| 
									
										
										
										
											2018-03-27 00:11:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-25 08:17:25 +08:00
										 |  |  |   4. Start erasure coded minio server on a node with 64 drives. | 
					
						
							|  |  |  |      $ {{.HelpName}} /mnt/export{1...64} | 
					
						
							| 
									
										
										
										
											2018-02-16 09:45:57 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-14 02:57:05 +08:00
										 |  |  |   5. Start distributed minio server on an 8 node setup with 8 drives each. Run following command on all the 8 nodes. | 
					
						
							| 
									
										
										
										
											2018-05-22 02:11:57 +08:00
										 |  |  |      $ export MINIO_ACCESS_KEY=minio | 
					
						
							|  |  |  |      $ export MINIO_SECRET_KEY=miniostorage | 
					
						
							|  |  |  |      $ {{.HelpName}} http://node{1...8}.example.com/mnt/export/{1...8}
 | 
					
						
							| 
									
										
										
										
											2018-05-19 08:51:03 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-14 02:57:05 +08:00
										 |  |  |   6. Start minio server with edge caching enabled. | 
					
						
							| 
									
										
										
										
											2018-04-02 12:55:09 +08:00
										 |  |  |      $ export MINIO_CACHE_DRIVES="/mnt/drive1;/mnt/drive2;/mnt/drive3;/mnt/drive4" | 
					
						
							| 
									
										
										
										
											2018-03-29 05:14:06 +08:00
										 |  |  |      $ export MINIO_CACHE_EXCLUDE="bucket1/*;*.png" | 
					
						
							|  |  |  |      $ export MINIO_CACHE_EXPIRY=40 | 
					
						
							| 
									
										
										
										
											2018-06-26 01:24:12 +08:00
										 |  |  |      $ export MINIO_CACHE_MAXUSE=80 | 
					
						
							| 
									
										
										
										
											2018-03-29 05:14:06 +08:00
										 |  |  |      $ {{.HelpName}} /home/shared | 
					
						
							| 
									
										
											  
											
												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
										 |  |  | `, | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-19 08:51:03 +08:00
										 |  |  | // Checks if endpoints are either available through environment
 | 
					
						
							|  |  |  | // or command line, returns false if both fails.
 | 
					
						
							|  |  |  | func endpointsPresent(ctx *cli.Context) bool { | 
					
						
							|  |  |  | 	_, ok := os.LookupEnv("MINIO_ENDPOINTS") | 
					
						
							|  |  |  | 	if !ok { | 
					
						
							|  |  |  | 		ok = ctx.Args().Present() | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return ok | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | func serverHandleCmdArgs(ctx *cli.Context) { | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | 	// Handle common command args.
 | 
					
						
							|  |  |  | 	handleCommonCmdArgs(ctx) | 
					
						
							| 
									
										
										
										
											2017-03-29 23:55:33 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												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
										 |  |  | 	// Server address.
 | 
					
						
							| 
									
										
										
										
											2017-04-12 06:44:27 +08:00
										 |  |  | 	serverAddr := ctx.String("address") | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 	logger.FatalIf(CheckLocalServerAddr(serverAddr), "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-04-12 06:44:27 +08:00
										 |  |  | 	var setupType SetupType | 
					
						
							| 
									
										
										
										
											2017-01-12 05:59:51 +08:00
										 |  |  | 	var err error | 
					
						
							| 
									
										
										
										
											2017-08-16 06:10:50 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-16 09:45:57 +08:00
										 |  |  | 	if len(ctx.Args()) > serverCommandLineArgsMax { | 
					
						
							| 
									
										
										
										
											2018-05-19 08:51:03 +08:00
										 |  |  | 		uErr := uiErrInvalidErasureEndpoints(nil).Msg(fmt.Sprintf("Invalid total number of endpoints (%d) passed, supported upto 32 unique arguments", | 
					
						
							|  |  |  | 			len(ctx.Args()))) | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 		logger.FatalIf(uErr, "Unable to validate passed endpoints") | 
					
						
							| 
									
										
										
										
											2018-02-16 09:45:57 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-19 08:51:03 +08:00
										 |  |  | 	endpoints := strings.Fields(os.Getenv("MINIO_ENDPOINTS")) | 
					
						
							|  |  |  | 	if len(endpoints) > 0 { | 
					
						
							|  |  |  | 		globalMinioAddr, globalEndpoints, setupType, globalXLSetCount, globalXLSetDriveCount, err = createServerEndpoints(serverAddr, endpoints...) | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		globalMinioAddr, globalEndpoints, setupType, globalXLSetCount, globalXLSetDriveCount, err = createServerEndpoints(serverAddr, ctx.Args()...) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 	logger.FatalIf(err, "Invalid command line arguments") | 
					
						
							| 
									
										
										
										
											2018-02-16 09:45:57 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-12 06:44:27 +08:00
										 |  |  | 	globalMinioHost, globalMinioPort = mustSplitHostPort(globalMinioAddr) | 
					
						
							| 
									
										
										
										
											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.
 | 
					
						
							|  |  |  | 	// To avoid this error sutiation we check for port availability.
 | 
					
						
							|  |  |  | 	logger.FatalIf(checkPortAvailability(globalMinioPort), "Unable to start the server") | 
					
						
							| 
									
										
										
										
											2016-08-31 10:22:27 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-12 06:44:27 +08:00
										 |  |  | 	globalIsXL = (setupType == XLSetupType) | 
					
						
							|  |  |  | 	globalIsDistXL = (setupType == DistXLSetupType) | 
					
						
							|  |  |  | 	if globalIsDistXL { | 
					
						
							| 
									
										
										
										
											2017-01-23 16:32:55 +08:00
										 |  |  | 		globalIsXL = true | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func serverHandleEnvVars() { | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | 	// Handle common environment variables.
 | 
					
						
							|  |  |  | 	handleCommonEnvVars() | 
					
						
							| 
									
										
										
										
											2017-04-10 01:44:10 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if serverRegion := os.Getenv("MINIO_REGION"); serverRegion != "" { | 
					
						
							|  |  |  | 		// region Envs are set globally.
 | 
					
						
							|  |  |  | 		globalIsEnvRegion = true | 
					
						
							|  |  |  | 		globalServerRegion = serverRegion | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // serverMain handler called for 'minio server' command.
 | 
					
						
							|  |  |  | func serverMain(ctx *cli.Context) { | 
					
						
							| 
									
										
										
										
											2018-05-19 08:51:03 +08:00
										 |  |  | 	if ctx.Args().First() == "help" || !endpointsPresent(ctx) { | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 		cli.ShowCommandHelpAndExit(ctx, "server", 1) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 	// Disable logging until server initialization is complete, any
 | 
					
						
							|  |  |  | 	// error during initialization will be shown as a fatal message
 | 
					
						
							|  |  |  | 	logger.Disable = true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-17 23:24:46 +08:00
										 |  |  | 	// Get "json" flag from command line argument and
 | 
					
						
							|  |  |  | 	// enable json and quite modes if jason flag is turned on.
 | 
					
						
							| 
									
										
										
										
											2018-03-01 12:13:33 +08:00
										 |  |  | 	jsonFlag := ctx.IsSet("json") || ctx.GlobalIsSet("json") | 
					
						
							| 
									
										
										
										
											2018-01-17 23:24:46 +08:00
										 |  |  | 	if jsonFlag { | 
					
						
							| 
									
										
										
										
											2018-04-06 06:04:40 +08:00
										 |  |  | 		logger.EnableJSON() | 
					
						
							| 
									
										
										
										
											2018-01-17 23:24:46 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 	// Get quiet flag from command line argument.
 | 
					
						
							| 
									
										
										
										
											2018-03-01 12:13:33 +08:00
										 |  |  | 	quietFlag := ctx.IsSet("quiet") || ctx.GlobalIsSet("quiet") | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 	if quietFlag { | 
					
						
							| 
									
										
										
										
											2018-04-06 06:04:40 +08:00
										 |  |  | 		logger.EnableQuiet() | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | 	// Handle all server command args.
 | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 	serverHandleCmdArgs(ctx) | 
					
						
							| 
									
										
										
										
											2017-06-10 10:50:51 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Handle all server environment vars.
 | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 	serverHandleEnvVars() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-24 06:36:10 +08:00
										 |  |  | 	// In distributed setup users need to set ENVs always.
 | 
					
						
							|  |  |  | 	if !globalIsEnvCreds && globalIsDistXL { | 
					
						
							|  |  |  | 		logger.Fatal(uiErrEnvCredentialsMissingServer(nil), "Unable to initialize minio server in distributed mode") | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 	// Create certs path.
 | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 	logger.FatalIf(createConfigDir(), "Unable to initialize configuration files") | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Check and load SSL certificates.
 | 
					
						
							|  |  |  | 	var err error | 
					
						
							| 
									
										
										
										
											2018-06-01 03:30:15 +08:00
										 |  |  | 	globalPublicCerts, globalRootCAs, globalTLSCerts, globalIsSSL, err = getSSLConfig() | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 	logger.FatalIf(err, "Unable to load the TLS configuration") | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-04 14:47:12 +08:00
										 |  |  | 	// Is distributed setup, error out if no certificates are found for HTTPS endpoints.
 | 
					
						
							| 
									
										
										
										
											2018-04-10 10:10:23 +08:00
										 |  |  | 	if globalIsDistXL { | 
					
						
							|  |  |  | 		if globalEndpoints.IsHTTPS() && !globalIsSSL { | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 			logger.Fatal(uiErrNoCertsAndHTTPSEndpoints(nil), "Unable to start the server") | 
					
						
							| 
									
										
										
										
											2018-04-10 10:10:23 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		if !globalEndpoints.IsHTTPS() && globalIsSSL { | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 			logger.Fatal(uiErrCertsAndHTTPEndpoints(nil), "Unable to start the server") | 
					
						
							| 
									
										
										
										
											2018-04-10 10:10:23 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-12-04 14:47:12 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 	if !quietFlag { | 
					
						
							|  |  |  | 		// Check for new updates from dl.minio.io.
 | 
					
						
							|  |  |  | 		mode := globalMinioModeFS | 
					
						
							|  |  |  | 		if globalIsDistXL { | 
					
						
							|  |  |  | 			mode = globalMinioModeDistXL | 
					
						
							| 
									
										
										
										
											2017-04-12 06:44:27 +08:00
										 |  |  | 		} else if globalIsXL { | 
					
						
							|  |  |  | 			mode = globalMinioModeXL | 
					
						
							| 
									
										
										
										
											2017-03-17 03:21:58 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		checkUpdate(mode) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-24 06:36:10 +08:00
										 |  |  | 	// Enforce ENV credentials for distributed setup such that we can create the first config.
 | 
					
						
							|  |  |  | 	if globalIsDistXL && !globalIsEnvCreds { | 
					
						
							|  |  |  | 		logger.Fatal(uiErrInvalidCredentials(nil), "Unable to start the server in distrbuted mode. In distributed mode we require explicit credentials.") | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 	// Set system resources to maximum.
 | 
					
						
							| 
									
										
										
										
											2018-04-06 06:04:40 +08:00
										 |  |  | 	logger.LogIf(context.Background(), setMaxResources()) | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// Set nodes for dsync for distributed setup.
 | 
					
						
							|  |  |  | 	if globalIsDistXL { | 
					
						
							| 
									
										
										
										
											2018-01-23 02:25:10 +08:00
										 |  |  | 		globalDsync, err = dsync.New(newDsyncNodes(globalEndpoints)) | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 		if err != nil { | 
					
						
							|  |  |  | 			logger.Fatal(err, "Unable to initialize distributed locking on %s", globalEndpoints) | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-06 03:48:07 +08:00
										 |  |  | 	// Initialize name space lock.
 | 
					
						
							| 
									
										
										
										
											2016-11-08 04:09:24 +08:00
										 |  |  | 	initNSLock(globalIsDistXL) | 
					
						
							| 
									
										
										
										
											2016-10-06 03:48:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-23 06:54:55 +08:00
										 |  |  | 	// Init global heal state
 | 
					
						
							|  |  |  | 	initAllHealState(globalIsXL) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 	// Configure server.
 | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	var handler http.Handler | 
					
						
							|  |  |  | 	handler, err = configureServerHandler(globalEndpoints) | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2018-05-10 06:11:24 +08:00
										 |  |  | 		logger.Fatal(uiErrUnexpectedError(err), "Unable to configure one of server's RPC services") | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-01-17 09:05:00 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-20 03:32:13 +08:00
										 |  |  | 	// Initialize Admin Peers inter-node communication only in distributed setup.
 | 
					
						
							| 
									
										
										
										
											2017-03-31 02:21:19 +08:00
										 |  |  | 	initGlobalAdminPeers(globalEndpoints) | 
					
						
							| 
									
										
										
										
											2017-01-20 03:32:13 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-01 03:30:15 +08:00
										 |  |  | 	var getCert certs.GetCertificateFunc | 
					
						
							|  |  |  | 	if globalTLSCerts != nil { | 
					
						
							|  |  |  | 		getCert = globalTLSCerts.GetCertificate | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-26 04:51:49 +08:00
										 |  |  | 	globalHTTPServer = xhttp.NewServer([]string{globalMinioAddr}, criticalErrorHandler{handler}, getCert) | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	globalHTTPServer.UpdateBytesReadFunc = globalConnStats.incInputBytes | 
					
						
							|  |  |  | 	globalHTTPServer.UpdateBytesWrittenFunc = globalConnStats.incOutputBytes | 
					
						
							| 
									
										
										
										
											2017-01-12 05:59:51 +08:00
										 |  |  | 	go func() { | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 		globalHTTPServerErrorCh <- globalHTTPServer.Start() | 
					
						
							| 
									
										
										
										
											2017-01-12 05:59:51 +08:00
										 |  |  | 	}() | 
					
						
							| 
									
										
										
										
											2016-09-14 16:11:03 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	signal.Notify(globalOSSignalCh, os.Interrupt, syscall.SIGTERM) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-12 06:44:27 +08:00
										 |  |  | 	newObject, err := newObjectLayer(globalEndpoints) | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2018-06-01 03:30:15 +08:00
										 |  |  | 		// Stop watching for any certificate changes.
 | 
					
						
							|  |  |  | 		globalTLSCerts.Stop() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-09 10:04:36 +08:00
										 |  |  | 		globalHTTPServer.Shutdown() | 
					
						
							|  |  |  | 		logger.FatalIf(err, "Unable to initialize backend") | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2016-09-14 02:00:40 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-10 14:03:10 +08:00
										 |  |  | 	globalObjLayerMutex.Lock() | 
					
						
							| 
									
										
										
										
											2016-08-31 10:22:27 +08:00
										 |  |  | 	globalObjectAPI = newObject | 
					
						
							| 
									
										
										
										
											2016-10-10 14:03:10 +08:00
										 |  |  | 	globalObjLayerMutex.Unlock() | 
					
						
							| 
									
										
										
										
											2016-08-06 04:48:31 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-05 23:18:42 +08:00
										 |  |  | 	// Populate existing buckets to the etcd backend
 | 
					
						
							|  |  |  | 	if globalDNSConfig != nil { | 
					
						
							|  |  |  | 		initFederatorBackend(newObject) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-24 06:36:10 +08:00
										 |  |  | 	// Initialize server config.
 | 
					
						
							|  |  |  | 	initConfig() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Load logger subsystem
 | 
					
						
							|  |  |  | 	loadLoggers() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	var cacheConfig = globalServerConfig.GetCacheConfig() | 
					
						
							|  |  |  | 	if len(cacheConfig.Drives) > 0 { | 
					
						
							|  |  |  | 		// initialize the new disk cache objects.
 | 
					
						
							|  |  |  | 		globalCacheObjectAPI, err = newServerCacheObjects(cacheConfig) | 
					
						
							|  |  |  | 		logger.FatalIf(err, "Unable to initialize disk caching") | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-10 09:50:31 +08:00
										 |  |  | 	// Re-enable logging
 | 
					
						
							|  |  |  | 	logger.Disable = false | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-24 06:36:10 +08:00
										 |  |  | 	// Create a new config system.
 | 
					
						
							|  |  |  | 	globalConfigSys = NewConfigSys() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Initialize config system.
 | 
					
						
							|  |  |  | 	if err := globalConfigSys.Init(newObjectLayerFn()); err != nil { | 
					
						
							|  |  |  | 		logger.Fatal(err, "Unable to initialize config system") | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-10 09:50:31 +08:00
										 |  |  | 	// Create new policy system.
 | 
					
						
							|  |  |  | 	globalPolicySys = NewPolicySys() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Initialize policy system.
 | 
					
						
							|  |  |  | 	if err := globalPolicySys.Init(newObjectLayerFn()); err != nil { | 
					
						
							|  |  |  | 		logger.Fatal(err, "Unable to initialize policy system") | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Create new notification system.
 | 
					
						
							|  |  |  | 	globalNotificationSys = NewNotificationSys(globalServerConfig, globalEndpoints) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Initialize notification system.
 | 
					
						
							|  |  |  | 	if err := globalNotificationSys.Init(newObjectLayerFn()); err != nil { | 
					
						
							|  |  |  | 		logger.Fatal(err, "Unable to initialize notification system") | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-06 03:48:07 +08:00
										 |  |  | 	// Prints the formatted startup message once object layer is initialized.
 | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	apiEndpoints := getAPIEndpoints(globalMinioAddr) | 
					
						
							| 
									
										
										
										
											2017-04-12 06:44:27 +08:00
										 |  |  | 	printStartupMessage(apiEndpoints) | 
					
						
							| 
									
										
										
										
											2016-10-06 03:48:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-10 15:26:44 +08:00
										 |  |  | 	// Set uptime time after object layer has initialized.
 | 
					
						
							| 
									
										
										
										
											2017-03-19 02:28:41 +08:00
										 |  |  | 	globalBootTime = UTCNow() | 
					
						
							| 
									
										
										
										
											2017-02-10 15:26:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-13 07:33:21 +08:00
										 |  |  | 	handleSignals() | 
					
						
							| 
									
										
											  
											
												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.
 | 
					
						
							| 
									
										
										
										
											2017-04-12 06:44:27 +08:00
										 |  |  | func newObjectLayer(endpoints EndpointList) (newObject ObjectLayer, err error) { | 
					
						
							| 
									
										
										
										
											2017-01-17 09:05:00 +08:00
										 |  |  | 	// For FS only, directly use the disk.
 | 
					
						
							| 
									
										
										
										
											2018-02-16 09:45:57 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-12 06:44:27 +08:00
										 |  |  | 	isFS := len(endpoints) == 1 | 
					
						
							| 
									
										
										
										
											2017-01-17 09:05:00 +08:00
										 |  |  | 	if isFS { | 
					
						
							|  |  |  | 		// Initialize new FS object layer.
 | 
					
						
							| 
									
										
										
										
											2018-02-21 04:21:12 +08:00
										 |  |  | 		return NewFSObjectLayer(endpoints[0].Path) | 
					
						
							| 
									
										
										
										
											2017-01-17 09:05:00 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-06 06:04:40 +08:00
										 |  |  | 	format, err := waitForFormatXL(context.Background(), endpoints[0].IsLocal, endpoints, globalXLSetCount, globalXLSetDriveCount) | 
					
						
							| 
									
										
										
										
											2017-01-17 09:05:00 +08:00
										 |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		return nil, err | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-16 09:45:57 +08:00
										 |  |  | 	return newXLSets(endpoints, format, len(format.XL.Sets), len(format.XL.Sets[0])) | 
					
						
							| 
									
										
										
										
											2017-01-17 09:05:00 +08:00
										 |  |  | } |