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-12 18:27:10 -05:00
|
|
|
|
/*
|
2017-01-18 15:24:34 -05:00
|
|
|
|
* Minio Cloud Storage, (C) 2015, 2016, 2017 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-12 18:27:10 -05: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-18 19:23:42 -04: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-12 18:27:10 -05:00
|
|
|
|
|
|
|
|
|
import (
|
2017-07-12 19:33:21 -04:00
|
|
|
|
"net/http"
|
2017-03-06 22:35:26 -05:00
|
|
|
|
"os"
|
2017-07-12 19:33:21 -04:00
|
|
|
|
"os/signal"
|
2017-04-11 18:44:27 -04:00
|
|
|
|
"runtime"
|
2017-07-12 19:33:21 -04: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-12 18:27:10 -05:00
|
|
|
|
|
|
|
|
|
"github.com/minio/cli"
|
2017-06-05 15:25:04 -04:00
|
|
|
|
"github.com/minio/dsync"
|
2017-11-25 14:58:29 -05:00
|
|
|
|
"github.com/minio/minio/pkg/errors"
|
2017-07-12 19:33:21 -04:00
|
|
|
|
miniohttp "github.com/minio/minio/pkg/http"
|
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-12 18:27:10 -05:00
|
|
|
|
)
|
|
|
|
|
|
2016-09-01 18:12:49 -04:00
|
|
|
|
var serverFlags = []cli.Flag{
|
|
|
|
|
cli.StringFlag{
|
|
|
|
|
Name: "address",
|
2017-07-20 19:39:11 -04:00
|
|
|
|
Value: ":" + globalMinioPort,
|
2017-02-24 17:19:20 -05:00
|
|
|
|
Usage: "Bind to a specific ADDRESS:PORT, ADDRESS can be an IP or hostname.",
|
2016-09-01 18:12:49 -04: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-01 22:19:44 -04: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-12 18:27:10 -05:00
|
|
|
|
CustomHelpTemplate: `NAME:
|
2017-03-16 15:21:58 -04: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-12 18:27:10 -05:00
|
|
|
|
|
|
|
|
|
USAGE:
|
2017-03-16 15:21:58 -04:00
|
|
|
|
{{.HelpName}} {{if .VisibleFlags}}[FLAGS] {{end}}PATH [PATH...]
|
2017-02-15 20:45:08 -05:00
|
|
|
|
{{if .VisibleFlags}}
|
2016-08-28 23:04:47 -04:00
|
|
|
|
FLAGS:
|
2017-02-15 05:25:38 -05:00
|
|
|
|
{{range .VisibleFlags}}{{.}}
|
2017-02-15 20:45:08 -05: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-12 18:27:10 -05:00
|
|
|
|
ENVIRONMENT VARIABLES:
|
2016-07-10 17:38:15 -04:00
|
|
|
|
ACCESS:
|
2017-08-03 23:03:37 -04:00
|
|
|
|
MINIO_ACCESS_KEY: Custom username or access key of minimum 5 characters in length.
|
|
|
|
|
MINIO_SECRET_KEY: Custom password or secret key of minimum 8 characters in length.
|
2016-12-10 03:42:22 -05:00
|
|
|
|
|
|
|
|
|
BROWSER:
|
|
|
|
|
MINIO_BROWSER: To disable web browser access, set this value to "off".
|
2016-07-10 17:38:15 -04:00
|
|
|
|
|
2017-06-20 18:02:18 -04:00
|
|
|
|
REGION:
|
|
|
|
|
MINIO_REGION: To set custom region. By default it is "us-east-1".
|
|
|
|
|
|
2017-12-15 15:33:42 -05:00
|
|
|
|
UPDATE:
|
|
|
|
|
MINIO_UPDATE: To turn off in-place upgrades, set this value to "off".
|
|
|
|
|
|
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-12 18:27:10 -05:00
|
|
|
|
EXAMPLES:
|
2016-11-10 02:37:12 -05:00
|
|
|
|
1. Start minio server on "/home/shared" directory.
|
2017-02-15 20:45:08 -05: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-01 22:19:44 -04:00
|
|
|
|
|
2017-02-24 17:19:20 -05:00
|
|
|
|
2. Start minio server bound to a specific ADDRESS:PORT.
|
2017-02-15 20:45:08 -05: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-12 18:27:10 -05:00
|
|
|
|
|
2016-11-10 02:37:12 -05:00
|
|
|
|
3. Start erasure coded minio server on a 12 disks server.
|
2017-02-15 20:45:08 -05:00
|
|
|
|
$ {{.HelpName}} /mnt/export1/ /mnt/export2/ /mnt/export3/ /mnt/export4/ \
|
2016-09-01 16:29:26 -04:00
|
|
|
|
/mnt/export5/ /mnt/export6/ /mnt/export7/ /mnt/export8/ /mnt/export9/ \
|
|
|
|
|
/mnt/export10/ /mnt/export11/ /mnt/export12/
|
2016-07-10 17:38:15 -04:00
|
|
|
|
|
2016-11-10 02:37:12 -05:00
|
|
|
|
4. Start erasure coded distributed minio server on a 4 node setup with 1 drive each. Run following commands on all the 4 nodes.
|
2016-08-18 17:29:23 -04:00
|
|
|
|
$ export MINIO_ACCESS_KEY=minio
|
|
|
|
|
$ export MINIO_SECRET_KEY=miniostorage
|
2017-02-15 20:45:08 -05:00
|
|
|
|
$ {{.HelpName}} http://192.168.1.11/mnt/export/ http://192.168.1.12/mnt/export/ \
|
2016-10-27 06:30:52 -04:00
|
|
|
|
http://192.168.1.13/mnt/export/ http://192.168.1.14/mnt/export/
|
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-12 18:27:10 -05:00
|
|
|
|
`,
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-30 14:21:19 -04:00
|
|
|
|
func serverHandleCmdArgs(ctx *cli.Context) {
|
2017-06-09 22:50:51 -04:00
|
|
|
|
// Handle common command args.
|
|
|
|
|
handleCommonCmdArgs(ctx)
|
2017-03-29 11:55:33 -04: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-01 22:19:44 -04:00
|
|
|
|
// Server address.
|
2017-04-11 18:44:27 -04:00
|
|
|
|
serverAddr := ctx.String("address")
|
|
|
|
|
fatalIf(CheckLocalServerAddr(serverAddr), "Invalid address ‘%s’ in command line argument.", serverAddr)
|
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-01 22:19:44 -04:00
|
|
|
|
|
2017-04-11 18:44:27 -04:00
|
|
|
|
var setupType SetupType
|
2017-01-11 16:59:51 -05:00
|
|
|
|
var err error
|
2017-08-15 18:10:50 -04:00
|
|
|
|
|
2017-04-11 18:44:27 -04:00
|
|
|
|
globalMinioAddr, globalEndpoints, setupType, err = CreateEndpoints(serverAddr, ctx.Args()...)
|
|
|
|
|
fatalIf(err, "Invalid command line arguments server=‘%s’, args=%s", serverAddr, ctx.Args())
|
|
|
|
|
globalMinioHost, globalMinioPort = mustSplitHostPort(globalMinioAddr)
|
|
|
|
|
if runtime.GOOS == "darwin" {
|
|
|
|
|
// 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 only for macOS.
|
|
|
|
|
fatalIf(checkPortAvailability(globalMinioPort), "Port %d already in use", globalMinioPort)
|
2016-07-31 17:11:14 -04:00
|
|
|
|
}
|
2016-08-30 22:22:27 -04:00
|
|
|
|
|
2017-04-11 18:44:27 -04:00
|
|
|
|
globalIsXL = (setupType == XLSetupType)
|
|
|
|
|
globalIsDistXL = (setupType == DistXLSetupType)
|
|
|
|
|
if globalIsDistXL {
|
2017-01-23 03:32:55 -05:00
|
|
|
|
globalIsXL = true
|
|
|
|
|
}
|
2017-03-30 14:21:19 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func serverHandleEnvVars() {
|
2017-06-09 22:50:51 -04:00
|
|
|
|
// Handle common environment variables.
|
|
|
|
|
handleCommonEnvVars()
|
2017-04-09 13:44:10 -04:00
|
|
|
|
|
|
|
|
|
if serverRegion := os.Getenv("MINIO_REGION"); serverRegion != "" {
|
|
|
|
|
// region Envs are set globally.
|
|
|
|
|
globalIsEnvRegion = true
|
|
|
|
|
globalServerRegion = serverRegion
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-30 14:21:19 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// serverMain handler called for 'minio server' command.
|
|
|
|
|
func serverMain(ctx *cli.Context) {
|
|
|
|
|
if !ctx.Args().Present() || ctx.Args().First() == "help" {
|
|
|
|
|
cli.ShowCommandHelpAndExit(ctx, "server", 1)
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-17 10:24:46 -05:00
|
|
|
|
// Get "json" flag from command line argument and
|
|
|
|
|
// enable json and quite modes if jason flag is turned on.
|
|
|
|
|
jsonFlag := ctx.Bool("json") || ctx.GlobalBool("json")
|
|
|
|
|
if jsonFlag {
|
|
|
|
|
log.EnableJSON()
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-30 14:21:19 -04:00
|
|
|
|
// Get quiet flag from command line argument.
|
|
|
|
|
quietFlag := ctx.Bool("quiet") || ctx.GlobalBool("quiet")
|
|
|
|
|
if quietFlag {
|
|
|
|
|
log.EnableQuiet()
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-09 22:50:51 -04:00
|
|
|
|
// Handle all server command args.
|
2017-03-30 14:21:19 -04:00
|
|
|
|
serverHandleCmdArgs(ctx)
|
2017-06-09 22:50:51 -04:00
|
|
|
|
|
|
|
|
|
// Handle all server environment vars.
|
2017-03-30 14:21:19 -04:00
|
|
|
|
serverHandleEnvVars()
|
|
|
|
|
|
|
|
|
|
// Create certs path.
|
|
|
|
|
fatalIf(createConfigDir(), "Unable to create configuration directories.")
|
|
|
|
|
|
2017-06-09 22:50:51 -04:00
|
|
|
|
// Initialize server config.
|
2017-03-30 14:21:19 -04:00
|
|
|
|
initConfig()
|
|
|
|
|
|
|
|
|
|
// Init the error tracing module.
|
2017-11-25 14:58:29 -05:00
|
|
|
|
errors.Init(GOPATH, "github.com/minio/minio")
|
2017-03-30 14:21:19 -04:00
|
|
|
|
|
|
|
|
|
// Check and load SSL certificates.
|
|
|
|
|
var err error
|
2017-07-12 19:33:21 -04:00
|
|
|
|
globalPublicCerts, globalRootCAs, globalTLSCertificate, globalIsSSL, err = getSSLConfig()
|
|
|
|
|
fatalIf(err, "Invalid SSL certificate file")
|
2017-03-30 14:21:19 -04:00
|
|
|
|
|
2017-12-04 01:47:12 -05:00
|
|
|
|
// Is distributed setup, error out if no certificates are found for HTTPS endpoints.
|
|
|
|
|
if globalIsDistXL && globalEndpoints.IsHTTPS() && !globalIsSSL {
|
|
|
|
|
fatalIf(errInvalidArgument, "No certificates found for HTTPS endpoints (%s)", globalEndpoints)
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-16 15:21:58 -04:00
|
|
|
|
if !quietFlag {
|
|
|
|
|
// Check for new updates from dl.minio.io.
|
|
|
|
|
mode := globalMinioModeFS
|
|
|
|
|
if globalIsDistXL {
|
|
|
|
|
mode = globalMinioModeDistXL
|
2017-04-11 18:44:27 -04:00
|
|
|
|
} else if globalIsXL {
|
|
|
|
|
mode = globalMinioModeXL
|
2017-03-16 15:21:58 -04:00
|
|
|
|
}
|
|
|
|
|
checkUpdate(mode)
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-30 14:21:19 -04:00
|
|
|
|
// Set system resources to maximum.
|
|
|
|
|
errorIf(setMaxResources(), "Unable to change resource limit")
|
|
|
|
|
|
|
|
|
|
// Set nodes for dsync for distributed setup.
|
|
|
|
|
if globalIsDistXL {
|
2017-06-05 15:25:04 -04:00
|
|
|
|
clnts, myNode := newDsyncNodes(globalEndpoints)
|
|
|
|
|
fatalIf(dsync.Init(clnts, myNode), "Unable to initialize distributed locking clients")
|
2017-03-30 14:21:19 -04:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-05 15:48:07 -04:00
|
|
|
|
// Initialize name space lock.
|
2016-11-07 15:09:24 -05:00
|
|
|
|
initNSLock(globalIsDistXL)
|
2016-10-05 15:48:07 -04:00
|
|
|
|
|
2017-03-30 14:21:19 -04:00
|
|
|
|
// Configure server.
|
2017-07-12 19:33:21 -04:00
|
|
|
|
var handler http.Handler
|
|
|
|
|
handler, err = configureServerHandler(globalEndpoints)
|
2017-01-16 20:05:00 -05:00
|
|
|
|
fatalIf(err, "Unable to configure one of server's RPC services.")
|
|
|
|
|
|
2017-01-19 14:32:13 -05:00
|
|
|
|
// Initialize S3 Peers inter-node communication only in distributed setup.
|
2017-03-30 14:21:19 -04:00
|
|
|
|
initGlobalS3Peers(globalEndpoints)
|
2017-01-19 14:32:13 -05:00
|
|
|
|
|
|
|
|
|
// Initialize Admin Peers inter-node communication only in distributed setup.
|
2017-03-30 14:21:19 -04:00
|
|
|
|
initGlobalAdminPeers(globalEndpoints)
|
2017-01-19 14:32:13 -05:00
|
|
|
|
|
2017-07-12 19:33:21 -04:00
|
|
|
|
globalHTTPServer = miniohttp.NewServer([]string{globalMinioAddr}, handler, globalTLSCertificate)
|
2017-09-07 14:16:45 -04:00
|
|
|
|
globalHTTPServer.ReadTimeout = globalConnReadTimeout
|
|
|
|
|
globalHTTPServer.WriteTimeout = globalConnWriteTimeout
|
2017-07-12 19:33:21 -04:00
|
|
|
|
globalHTTPServer.UpdateBytesReadFunc = globalConnStats.incInputBytes
|
|
|
|
|
globalHTTPServer.UpdateBytesWrittenFunc = globalConnStats.incOutputBytes
|
|
|
|
|
globalHTTPServer.ErrorLogFunc = errorIf
|
2017-01-11 16:59:51 -05:00
|
|
|
|
go func() {
|
2017-07-12 19:33:21 -04:00
|
|
|
|
globalHTTPServerErrorCh <- globalHTTPServer.Start()
|
2017-01-11 16:59:51 -05:00
|
|
|
|
}()
|
2016-09-14 04:11:03 -04:00
|
|
|
|
|
2017-07-12 19:33:21 -04:00
|
|
|
|
signal.Notify(globalOSSignalCh, os.Interrupt, syscall.SIGTERM)
|
|
|
|
|
|
2017-04-11 18:44:27 -04:00
|
|
|
|
newObject, err := newObjectLayer(globalEndpoints)
|
2017-07-12 19:33:21 -04:00
|
|
|
|
if err != nil {
|
|
|
|
|
errorIf(err, "Initializing object layer failed")
|
|
|
|
|
err = globalHTTPServer.Shutdown()
|
|
|
|
|
errorIf(err, "Unable to shutdown http server")
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
}
|
2016-09-13 14:00:40 -04:00
|
|
|
|
|
2016-10-10 02:03:10 -04:00
|
|
|
|
globalObjLayerMutex.Lock()
|
2016-08-30 22:22:27 -04:00
|
|
|
|
globalObjectAPI = newObject
|
2016-10-10 02:03:10 -04:00
|
|
|
|
globalObjLayerMutex.Unlock()
|
2016-08-05 16:48:31 -04:00
|
|
|
|
|
2016-10-05 15:48:07 -04:00
|
|
|
|
// Prints the formatted startup message once object layer is initialized.
|
2017-07-12 19:33:21 -04:00
|
|
|
|
apiEndpoints := getAPIEndpoints(globalMinioAddr)
|
2017-04-11 18:44:27 -04:00
|
|
|
|
printStartupMessage(apiEndpoints)
|
2016-10-05 15:48:07 -04:00
|
|
|
|
|
2017-02-10 02:26:44 -05:00
|
|
|
|
// Set uptime time after object layer has initialized.
|
2017-03-18 14:28:41 -04:00
|
|
|
|
globalBootTime = UTCNow()
|
2017-02-10 02:26:44 -05:00
|
|
|
|
|
2017-07-12 19:33:21 -04: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-12 18:27:10 -05:00
|
|
|
|
}
|
2017-01-16 20:05:00 -05:00
|
|
|
|
|
|
|
|
|
// Initialize object layer with the supplied disks, objectLayer is nil upon any error.
|
2017-04-11 18:44:27 -04:00
|
|
|
|
func newObjectLayer(endpoints EndpointList) (newObject ObjectLayer, err error) {
|
2017-01-16 20:05:00 -05:00
|
|
|
|
// For FS only, directly use the disk.
|
2017-04-11 18:44:27 -04:00
|
|
|
|
isFS := len(endpoints) == 1
|
2017-01-16 20:05:00 -05:00
|
|
|
|
if isFS {
|
|
|
|
|
// Initialize new FS object layer.
|
2017-04-11 18:44:27 -04:00
|
|
|
|
return newFSObjectLayer(endpoints[0].Path)
|
2017-01-16 20:05:00 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Initialize storage disks.
|
2017-04-11 18:44:27 -04:00
|
|
|
|
storageDisks, err := initStorageDisks(endpoints)
|
2017-01-16 20:05:00 -05:00
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Wait for formatting disks for XL backend.
|
|
|
|
|
var formattedDisks []StorageAPI
|
2017-04-11 18:44:27 -04:00
|
|
|
|
|
|
|
|
|
// First disk argument check if it is local.
|
|
|
|
|
firstDisk := endpoints[0].IsLocal
|
|
|
|
|
formattedDisks, err = waitForFormatXLDisks(firstDisk, endpoints, storageDisks)
|
2017-01-16 20:05:00 -05:00
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Cleanup objects that weren't successfully written into the namespace.
|
|
|
|
|
if err = houseKeeping(storageDisks); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Once XL formatted, initialize object layer.
|
|
|
|
|
newObject, err = newXLObjectLayer(formattedDisks)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// XL initialized, return.
|
|
|
|
|
return newObject, nil
|
|
|
|
|
}
|