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 00:27:10 +01:00
|
|
|
/*
|
2017-01-18 21:24:34 +01: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-13 00:27:10 +01: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 01:23:42 +02: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 00:27:10 +01:00
|
|
|
|
|
|
|
import (
|
2017-01-11 22:59:51 +01:00
|
|
|
"errors"
|
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 00:27:10 +01:00
|
|
|
"fmt"
|
|
|
|
"net"
|
2016-10-27 12:30:52 +02:00
|
|
|
"net/url"
|
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 00:27:10 +01:00
|
|
|
"os"
|
2016-12-17 20:00:16 +01:00
|
|
|
"path"
|
2016-12-20 02:04:31 +01:00
|
|
|
"sort"
|
2017-01-11 22:59:51 +01:00
|
|
|
"strconv"
|
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 00:27:10 +01:00
|
|
|
"strings"
|
|
|
|
|
2016-10-28 17:45:32 +02:00
|
|
|
"runtime"
|
|
|
|
|
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 00:27:10 +01:00
|
|
|
"github.com/minio/cli"
|
|
|
|
)
|
|
|
|
|
2016-09-02 00:12:49 +02:00
|
|
|
var serverFlags = []cli.Flag{
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "address",
|
|
|
|
Value: ":9000",
|
2016-11-10 08:37:12 +01:00
|
|
|
Usage: `Bind to a specific IP:PORT. Defaults to ":9000".`,
|
2016-09-02 00:12:49 +02: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 04:19:44 +02: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 00:27:10 +01:00
|
|
|
CustomHelpTemplate: `NAME:
|
|
|
|
minio {{.Name}} - {{.Usage}}
|
|
|
|
|
|
|
|
USAGE:
|
2016-08-29 05:04:47 +02:00
|
|
|
minio {{.Name}} [FLAGS] PATH [PATH...]
|
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 00:27:10 +01:00
|
|
|
|
2016-08-29 05:04:47 +02:00
|
|
|
FLAGS:
|
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 00:27:10 +01:00
|
|
|
{{range .Flags}}{{.}}
|
|
|
|
{{end}}
|
|
|
|
ENVIRONMENT VARIABLES:
|
2016-07-10 23:38:15 +02:00
|
|
|
ACCESS:
|
2016-12-10 09:42:22 +01:00
|
|
|
MINIO_ACCESS_KEY: Custom username or access key of 5 to 20 characters in length.
|
|
|
|
MINIO_SECRET_KEY: Custom password or secret key of 8 to 40 characters in length.
|
|
|
|
|
|
|
|
BROWSER:
|
|
|
|
MINIO_BROWSER: To disable web browser access, set this value to "off".
|
2016-07-10 23:38:15 +02: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 00:27:10 +01:00
|
|
|
EXAMPLES:
|
2016-11-10 08:37:12 +01:00
|
|
|
1. Start minio server on "/home/shared" directory.
|
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 04:19:44 +02:00
|
|
|
$ minio {{.Name}} /home/shared
|
|
|
|
|
2016-11-10 08:37:12 +01:00
|
|
|
2. Start minio server bound to a specific IP:PORT.
|
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 04:19:44 +02:00
|
|
|
$ minio {{.Name}} --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 00:27:10 +01:00
|
|
|
|
2016-11-10 08:37:12 +01:00
|
|
|
3. Start erasure coded minio server on a 12 disks server.
|
2016-09-01 22:29:26 +02:00
|
|
|
$ minio {{.Name}} /mnt/export1/ /mnt/export2/ /mnt/export3/ /mnt/export4/ \
|
|
|
|
/mnt/export5/ /mnt/export6/ /mnt/export7/ /mnt/export8/ /mnt/export9/ \
|
|
|
|
/mnt/export10/ /mnt/export11/ /mnt/export12/
|
2016-07-10 23:38:15 +02:00
|
|
|
|
2016-11-10 08:37:12 +01: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 23:29:23 +02:00
|
|
|
$ export MINIO_ACCESS_KEY=minio
|
|
|
|
$ export MINIO_SECRET_KEY=miniostorage
|
2016-10-27 12:30:52 +02:00
|
|
|
$ minio {{.Name}} http://192.168.1.11/mnt/export/ http://192.168.1.12/mnt/export/ \
|
|
|
|
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-13 00:27:10 +01:00
|
|
|
`,
|
|
|
|
}
|
|
|
|
|
2016-04-12 21:45:15 +02:00
|
|
|
type serverCmdConfig struct {
|
2017-01-17 02:05:00 +01:00
|
|
|
serverAddr string
|
|
|
|
endpoints []*url.URL
|
2016-10-18 21:49:24 +02:00
|
|
|
}
|
|
|
|
|
2016-10-27 12:30:52 +02:00
|
|
|
// Parse an array of end-points (from the command line)
|
|
|
|
func parseStorageEndpoints(eps []string) (endpoints []*url.URL, err error) {
|
2016-10-18 21:49:24 +02:00
|
|
|
for _, ep := range eps {
|
|
|
|
if ep == "" {
|
2016-10-27 12:30:52 +02:00
|
|
|
return nil, errInvalidArgument
|
2016-10-18 21:49:24 +02:00
|
|
|
}
|
2016-10-27 12:30:52 +02:00
|
|
|
var u *url.URL
|
|
|
|
u, err = url.Parse(ep)
|
2016-10-18 21:49:24 +02:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2016-11-04 20:14:19 +01:00
|
|
|
if u.Host != "" {
|
|
|
|
_, port, err := net.SplitHostPort(u.Host)
|
|
|
|
// Ignore the missing port error as the default port can be globalMinioPort.
|
|
|
|
if err != nil && !strings.Contains(err.Error(), "missing port in address") {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
if globalMinioHost == "" {
|
|
|
|
// For ex.: minio server host1:port1 host2:port2...
|
|
|
|
// we return error as port is configurable only
|
|
|
|
// using "--address :port"
|
|
|
|
if port != "" {
|
2016-12-17 22:43:26 +01:00
|
|
|
return nil, fmt.Errorf("Invalid Argument %s, port configurable using --address :<port>", u.Host)
|
2016-11-04 20:14:19 +01:00
|
|
|
}
|
|
|
|
u.Host = net.JoinHostPort(u.Host, globalMinioPort)
|
|
|
|
} else {
|
|
|
|
// For ex.: minio server --address host:port host1:port1 host2:port2...
|
|
|
|
// i.e if "--address host:port" is specified
|
|
|
|
// port info in u.Host is mandatory else return error.
|
|
|
|
if port == "" {
|
2016-12-17 22:43:26 +01:00
|
|
|
return nil, fmt.Errorf("Invalid Argument %s, port mandatory when --address <host>:<port> is used", u.Host)
|
2016-11-04 20:14:19 +01:00
|
|
|
}
|
|
|
|
}
|
2016-10-27 12:30:52 +02:00
|
|
|
}
|
|
|
|
endpoints = append(endpoints, u)
|
2016-10-18 21:49:24 +02:00
|
|
|
}
|
|
|
|
return endpoints, nil
|
2016-04-12 21:45:15 +02: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 04:19:44 +02:00
|
|
|
// initServerConfig initialize server config.
|
|
|
|
func initServerConfig(c *cli.Context) {
|
2016-07-30 23:55:20 +02:00
|
|
|
// Create certs path.
|
|
|
|
err := createCertsPath()
|
|
|
|
fatalIf(err, "Unable to create \"certs\" directory.")
|
|
|
|
|
2016-11-11 16:18:44 +01:00
|
|
|
// Load user supplied root CAs
|
|
|
|
loadRootCAs()
|
|
|
|
|
2016-10-18 08:14:41 +02:00
|
|
|
// When credentials inherited from the env, server cmd has to save them in the disk
|
|
|
|
if os.Getenv("MINIO_ACCESS_KEY") != "" && os.Getenv("MINIO_SECRET_KEY") != "" {
|
|
|
|
// Env credentials are already loaded in serverConfig, just save in the disk
|
2016-08-03 01:48:21 +02:00
|
|
|
err = serverConfig.Save()
|
2016-10-18 08:14:41 +02:00
|
|
|
fatalIf(err, "Unable to save credentials in the disk.")
|
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 00:27:10 +01:00
|
|
|
}
|
2016-04-19 07:05:32 +02:00
|
|
|
|
|
|
|
// Set maxOpenFiles, This is necessary since default operating
|
|
|
|
// system limits of 1024, 2048 are not enough for Minio server.
|
|
|
|
setMaxOpenFiles()
|
2016-10-06 22:35:56 +02:00
|
|
|
|
2016-07-30 17:50:49 +02:00
|
|
|
// Set maxMemory, This is necessary since default operating
|
|
|
|
// system limits might be changed and we need to make sure we
|
|
|
|
// do not crash the server so the set the maxCacheSize appropriately.
|
|
|
|
setMaxMemory()
|
|
|
|
|
2016-04-19 07:05:32 +02:00
|
|
|
// Do not fail if this is not allowed, lower limits are fine as well.
|
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 00:27:10 +01:00
|
|
|
}
|
|
|
|
|
2016-08-26 09:11:53 +02:00
|
|
|
// Validate if input disks are sufficient for initializing XL.
|
2016-10-27 12:30:52 +02:00
|
|
|
func checkSufficientDisks(eps []*url.URL) error {
|
2016-08-26 09:11:53 +02:00
|
|
|
// Verify total number of disks.
|
2016-10-18 21:49:24 +02:00
|
|
|
total := len(eps)
|
|
|
|
if total > maxErasureBlocks {
|
2016-08-26 09:11:53 +02:00
|
|
|
return errXLMaxDisks
|
|
|
|
}
|
2016-10-18 21:49:24 +02:00
|
|
|
if total < minErasureBlocks {
|
2016-08-26 09:11:53 +02:00
|
|
|
return errXLMinDisks
|
|
|
|
}
|
|
|
|
|
|
|
|
// isEven function to verify if a given number if even.
|
|
|
|
isEven := func(number int) bool {
|
|
|
|
return number%2 == 0
|
|
|
|
}
|
|
|
|
|
|
|
|
// Verify if we have even number of disks.
|
|
|
|
// only combination of 4, 6, 8, 10, 12, 14, 16 are supported.
|
2016-10-18 21:49:24 +02:00
|
|
|
if !isEven(total) {
|
2016-08-26 09:11:53 +02:00
|
|
|
return errXLNumDisks
|
|
|
|
}
|
|
|
|
|
|
|
|
// Success.
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2016-08-24 04:19:24 +02:00
|
|
|
// Returns if slice of disks is a distributed setup.
|
2016-11-07 21:09:24 +01:00
|
|
|
func isDistributedSetup(eps []*url.URL) bool {
|
2016-10-27 12:30:52 +02:00
|
|
|
// Validate if one the disks is not local.
|
2016-10-18 21:49:24 +02:00
|
|
|
for _, ep := range eps {
|
|
|
|
if !isLocalStorage(ep) {
|
2016-11-07 21:09:24 +01:00
|
|
|
// One or more disks supplied as arguments are
|
|
|
|
// not attached to the local node.
|
|
|
|
return true
|
2016-08-24 04:19:24 +02:00
|
|
|
}
|
|
|
|
}
|
2016-11-07 21:09:24 +01:00
|
|
|
return false
|
2016-08-24 04:19:24 +02:00
|
|
|
}
|
|
|
|
|
2017-01-18 21:24:34 +01:00
|
|
|
// Returns true if path is empty, or equals to '.', '/', '\' characters.
|
|
|
|
func isPathSentinel(path string) bool {
|
|
|
|
return path == "" || path == "." || path == "/" || path == `\`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returned when path is empty or root path.
|
|
|
|
var errEmptyRootPath = errors.New("Empty or root path is not allowed")
|
|
|
|
|
|
|
|
// Invalid scheme passed.
|
|
|
|
var errInvalidScheme = errors.New("Invalid scheme")
|
|
|
|
|
2016-12-17 20:00:16 +01:00
|
|
|
// Check if endpoint is in expected syntax by valid scheme/path across all platforms.
|
|
|
|
func checkEndpointURL(endpointURL *url.URL) (err error) {
|
2017-01-18 21:24:34 +01:00
|
|
|
// Applicable to all OS.
|
|
|
|
if endpointURL.Scheme == "" || endpointURL.Scheme == httpScheme || endpointURL.Scheme == httpsScheme {
|
|
|
|
if isPathSentinel(path.Clean(endpointURL.Path)) {
|
|
|
|
err = errEmptyRootPath
|
2016-12-17 20:00:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Applicable to Windows only.
|
2017-01-18 21:24:34 +01:00
|
|
|
if runtime.GOOS == globalWindowsOSName {
|
2016-12-17 20:00:16 +01:00
|
|
|
// On Windows, endpoint can be a path with drive eg. C:\Export and its URL.Scheme is 'C'.
|
|
|
|
// Check if URL.Scheme is a single letter alphabet to represent a drive.
|
|
|
|
// Note: URL.Parse() converts scheme into lower case always.
|
|
|
|
if len(endpointURL.Scheme) == 1 && endpointURL.Scheme[0] >= 'a' && endpointURL.Scheme[0] <= 'z' {
|
|
|
|
// If endpoint is C:\ or C:\export, URL.Path does not have path information like \ or \export
|
|
|
|
// hence we directly work with endpoint.
|
2017-01-18 21:24:34 +01:00
|
|
|
if isPathSentinel(strings.SplitN(path.Clean(endpointURL.String()), ":", 2)[1]) {
|
|
|
|
err = errEmptyRootPath
|
2016-12-17 20:00:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-18 21:24:34 +01:00
|
|
|
return errInvalidScheme
|
2016-12-17 20:00:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check if endpoints are in expected syntax by valid scheme/path across all platforms.
|
2016-12-15 05:42:19 +01:00
|
|
|
func checkEndpointsSyntax(eps []*url.URL, disks []string) error {
|
2016-10-28 17:45:32 +02:00
|
|
|
for i, u := range eps {
|
2016-12-17 20:00:16 +01:00
|
|
|
if err := checkEndpointURL(u); err != nil {
|
|
|
|
return fmt.Errorf("%s: %s (%s)", err.Error(), u.Path, disks[i])
|
2016-10-28 17:45:32 +02:00
|
|
|
}
|
|
|
|
}
|
2016-12-17 20:00:16 +01:00
|
|
|
|
2016-12-15 05:42:19 +01:00
|
|
|
return nil
|
2016-10-28 17:45:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Make sure all the command line parameters are OK and exit in case of invalid parameters.
|
|
|
|
func checkServerSyntax(c *cli.Context) {
|
|
|
|
serverAddr := c.String("address")
|
|
|
|
|
|
|
|
host, portStr, err := net.SplitHostPort(serverAddr)
|
|
|
|
fatalIf(err, "Unable to parse %s.", serverAddr)
|
|
|
|
|
|
|
|
// Verify syntax for all the XL disks.
|
|
|
|
disks := c.Args()
|
2017-01-17 02:05:00 +01:00
|
|
|
|
|
|
|
// Parse disks check if they comply with expected URI style.
|
2016-10-28 17:45:32 +02:00
|
|
|
endpoints, err := parseStorageEndpoints(disks)
|
2016-12-15 05:42:19 +01:00
|
|
|
fatalIf(err, "Unable to parse storage endpoints %s", strings.Join(disks, " "))
|
|
|
|
|
|
|
|
// Validate if endpoints follow the expected syntax.
|
|
|
|
err = checkEndpointsSyntax(endpoints, disks)
|
|
|
|
fatalIf(err, "Invalid endpoints found %s", strings.Join(disks, " "))
|
|
|
|
|
|
|
|
// Validate for duplicate endpoints are supplied.
|
|
|
|
err = checkDuplicateEndpoints(endpoints)
|
|
|
|
fatalIf(err, "Duplicate entries in %s", strings.Join(disks, " "))
|
2016-10-28 17:45:32 +02:00
|
|
|
|
|
|
|
if len(endpoints) > 1 {
|
2016-12-15 05:42:19 +01:00
|
|
|
// Validate if we have sufficient disks for XL setup.
|
2016-10-28 17:45:32 +02:00
|
|
|
err = checkSufficientDisks(endpoints)
|
2017-01-17 02:05:00 +01:00
|
|
|
fatalIf(err, "Insufficient number of disks.")
|
2016-12-17 22:43:26 +01:00
|
|
|
} else {
|
|
|
|
// Validate if we have invalid disk for FS setup.
|
|
|
|
if endpoints[0].Host != "" && endpoints[0].Scheme != "" {
|
|
|
|
fatalIf(errInvalidArgument, "%s, FS setup expects a filesystem path", endpoints[0])
|
|
|
|
}
|
2016-10-28 17:45:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if !isDistributedSetup(endpoints) {
|
|
|
|
// for FS and singlenode-XL validation is done, return.
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rest of the checks applies only to distributed XL setup.
|
|
|
|
if host != "" {
|
|
|
|
// We are here implies --address host:port is passed, hence the user is trying
|
|
|
|
// to run one minio process per export disk.
|
|
|
|
if portStr == "" {
|
|
|
|
fatalIf(errInvalidArgument, "Port missing, Host:Port should be specified for --address")
|
|
|
|
}
|
|
|
|
foundCnt := 0
|
|
|
|
for _, ep := range endpoints {
|
|
|
|
if ep.Host == serverAddr {
|
|
|
|
foundCnt++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if foundCnt == 0 {
|
|
|
|
// --address host:port should be available in the XL disk list.
|
|
|
|
fatalIf(errInvalidArgument, "%s is not available in %s", serverAddr, strings.Join(disks, " "))
|
|
|
|
}
|
|
|
|
if foundCnt > 1 {
|
|
|
|
// --address host:port should match exactly one entry in the XL disk list.
|
|
|
|
fatalIf(errInvalidArgument, "%s matches % entries in %s", serverAddr, foundCnt, strings.Join(disks, " "))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, ep := range endpoints {
|
2017-01-18 21:24:34 +01:00
|
|
|
if ep.Scheme == httpsScheme && !globalIsSSL {
|
2016-10-28 17:45:32 +02:00
|
|
|
// Certificates should be provided for https configuration.
|
2017-01-11 22:59:51 +01:00
|
|
|
fatalIf(errInvalidArgument, "Certificates not provided for secure configuration")
|
2016-10-28 17:45:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-15 05:42:19 +01:00
|
|
|
// Checks if any of the endpoints supplied is local to this server.
|
2016-12-13 20:18:31 +01:00
|
|
|
func isAnyEndpointLocal(eps []*url.URL) bool {
|
|
|
|
anyLocalEp := false
|
|
|
|
for _, ep := range eps {
|
|
|
|
if isLocalStorage(ep) {
|
|
|
|
anyLocalEp = true
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return anyLocalEp
|
|
|
|
}
|
|
|
|
|
2017-01-11 22:59:51 +01:00
|
|
|
// Returned when there are no ports.
|
|
|
|
var errEmptyPort = errors.New("Port cannot be empty or '0', please use `--address` to pick a specific port")
|
|
|
|
|
|
|
|
// Convert an input address of form host:port into, host and port, returns if any.
|
|
|
|
func getHostPort(address string) (host, port string, err error) {
|
|
|
|
// Check if requested port is available.
|
|
|
|
host, port, err = net.SplitHostPort(address)
|
|
|
|
if err != nil {
|
|
|
|
return "", "", err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Empty ports.
|
|
|
|
if port == "0" || port == "" {
|
|
|
|
// Port zero or empty means use requested to choose any freely available
|
|
|
|
// port. Avoid this since it won't work with any configured clients,
|
|
|
|
// can lead to serious loss of availability.
|
|
|
|
return "", "", errEmptyPort
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parse port.
|
|
|
|
if _, err = strconv.Atoi(port); err != nil {
|
|
|
|
return "", "", err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check if port is available.
|
|
|
|
if err = checkPortAvailability(port); err != nil {
|
|
|
|
return "", "", err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Success.
|
|
|
|
return host, port, nil
|
|
|
|
}
|
|
|
|
|
2016-07-13 08:21:18 +02:00
|
|
|
// serverMain handler called for 'minio server' command.
|
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 04:19:44 +02:00
|
|
|
func serverMain(c *cli.Context) {
|
2016-10-05 21:48:07 +02:00
|
|
|
if !c.Args().Present() || c.Args().First() == "help" {
|
|
|
|
cli.ShowCommandHelpAndExit(c, "server", 1)
|
|
|
|
}
|
2016-07-01 23:32:53 +02:00
|
|
|
|
2016-11-28 21:15:36 +01:00
|
|
|
// Initialization routine, such as config loading, enable logging, ..
|
2017-01-11 22:59:51 +01:00
|
|
|
minioInit(c)
|
2016-11-28 21:15:36 +01:00
|
|
|
|
2017-01-17 02:05:00 +01:00
|
|
|
// Check for new updates from dl.minio.io.
|
2016-11-28 21:15:36 +01:00
|
|
|
checkUpdate()
|
2016-11-24 00:48:10 +01: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 04:19:44 +02:00
|
|
|
// Server address.
|
2016-10-10 08:03:10 +02:00
|
|
|
serverAddr := c.String("address")
|
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 04:19:44 +02:00
|
|
|
|
2017-01-11 22:59:51 +01:00
|
|
|
var err error
|
|
|
|
globalMinioHost, globalMinioPort, err = getHostPort(serverAddr)
|
|
|
|
fatalIf(err, "Unable to extract host and port %s", serverAddr)
|
2016-10-27 12:30:52 +02:00
|
|
|
|
2016-10-28 17:45:32 +02:00
|
|
|
// Check server syntax and exit in case of errors.
|
2017-01-17 02:05:00 +01:00
|
|
|
// Done after globalMinioHost and globalMinioPort is set
|
|
|
|
// as parseStorageEndpoints() depends on it.
|
2016-10-28 17:45:32 +02:00
|
|
|
checkServerSyntax(c)
|
|
|
|
|
2017-01-17 02:05:00 +01:00
|
|
|
// Initialize server config.
|
|
|
|
initServerConfig(c)
|
|
|
|
|
2016-07-10 23:38:15 +02:00
|
|
|
// Disks to be used in server init.
|
2016-10-27 12:30:52 +02:00
|
|
|
endpoints, err := parseStorageEndpoints(c.Args())
|
2016-10-18 21:49:24 +02:00
|
|
|
fatalIf(err, "Unable to parse storage endpoints %s", c.Args())
|
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 00:27:10 +01:00
|
|
|
|
2016-12-15 05:42:19 +01:00
|
|
|
// Should exit gracefully if none of the endpoints passed
|
|
|
|
// as command line args are local to this server.
|
2016-12-13 20:18:31 +01:00
|
|
|
if !isAnyEndpointLocal(endpoints) {
|
2016-12-15 05:42:19 +01:00
|
|
|
fatalIf(errInvalidArgument, "None of the disks passed as command line args are local to this server.")
|
2016-12-13 20:18:31 +01:00
|
|
|
}
|
|
|
|
|
2016-12-20 02:04:31 +01:00
|
|
|
// Sort endpoints for consistent ordering across multiple
|
|
|
|
// nodes in a distributed setup. This is to avoid format.json
|
|
|
|
// corruption if the disks aren't supplied in the same order
|
|
|
|
// on all nodes.
|
|
|
|
sort.Sort(byHostPath(endpoints))
|
|
|
|
|
fs: Break fs package to top-level and introduce ObjectAPI interface.
ObjectAPI interface brings in changes needed for XL ObjectAPI layer.
The new interface for any ObjectAPI layer is as below
```
// ObjectAPI interface.
type ObjectAPI interface {
// Bucket resource API.
DeleteBucket(bucket string) *probe.Error
ListBuckets() ([]BucketInfo, *probe.Error)
MakeBucket(bucket string) *probe.Error
GetBucketInfo(bucket string) (BucketInfo, *probe.Error)
// Bucket query API.
ListObjects(bucket, prefix, marker, delimiter string, maxKeys int) (ListObjectsResult, *probe.Error)
ListMultipartUploads(bucket string, resources BucketMultipartResourcesMetadata) (BucketMultipartResourcesMetadata, *probe.Error)
// Object resource API.
GetObject(bucket, object string, startOffset int64) (io.ReadCloser, *probe.Error)
GetObjectInfo(bucket, object string) (ObjectInfo, *probe.Error)
PutObject(bucket string, object string, size int64, data io.Reader, metadata map[string]string) (ObjectInfo, *probe.Error)
DeleteObject(bucket, object string) *probe.Error
// Object query API.
NewMultipartUpload(bucket, object string) (string, *probe.Error)
PutObjectPart(bucket, object, uploadID string, partID int, size int64, data io.Reader, md5Hex string) (string, *probe.Error)
ListObjectParts(bucket, object string, resources ObjectResourcesMetadata) (ObjectResourcesMetadata, *probe.Error)
CompleteMultipartUpload(bucket string, object string, uploadID string, parts []CompletePart) (ObjectInfo, *probe.Error)
AbortMultipartUpload(bucket, object, uploadID string) *probe.Error
}
```
2016-03-31 01:15:28 +02:00
|
|
|
// Configure server.
|
2016-10-05 21:48:07 +02:00
|
|
|
srvConfig := serverCmdConfig{
|
2017-01-17 02:05:00 +01:00
|
|
|
serverAddr: serverAddr,
|
|
|
|
endpoints: endpoints,
|
2016-07-31 23:11:14 +02:00
|
|
|
}
|
2016-08-31 04:22:27 +02:00
|
|
|
|
2017-01-17 02:05:00 +01:00
|
|
|
// Check if endpoints are part of distributed setup.
|
|
|
|
globalIsDistXL = isDistributedSetup(endpoints)
|
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 00:27:10 +01:00
|
|
|
|
2016-10-05 21:48:07 +02:00
|
|
|
// Set nodes for dsync for distributed setup.
|
2016-11-07 21:09:24 +01:00
|
|
|
if globalIsDistXL {
|
2017-01-17 02:05:00 +01:00
|
|
|
fatalIf(initDsyncNodes(endpoints), "Unable to initialize distributed locking clients")
|
2016-10-05 21:48:07 +02:00
|
|
|
}
|
|
|
|
|
2017-01-23 09:32:55 +01:00
|
|
|
// Set globalIsXL if erasure code backend is about to be
|
|
|
|
// initialized for the given endpoints.
|
|
|
|
if len(endpoints) > 1 {
|
|
|
|
globalIsXL = true
|
|
|
|
}
|
|
|
|
|
2016-10-05 21:48:07 +02:00
|
|
|
// Initialize name space lock.
|
2016-11-07 21:09:24 +01:00
|
|
|
initNSLock(globalIsDistXL)
|
2016-10-05 21:48:07 +02:00
|
|
|
|
2017-01-17 02:05:00 +01:00
|
|
|
// Configure server.
|
|
|
|
handler, err := configureServerHandler(srvConfig)
|
|
|
|
fatalIf(err, "Unable to configure one of server's RPC services.")
|
|
|
|
|
2016-10-05 21:48:07 +02:00
|
|
|
// Initialize a new HTTP server.
|
2016-10-10 08:03:10 +02:00
|
|
|
apiServer := NewServerMux(serverAddr, handler)
|
2016-08-12 06:33:55 +02:00
|
|
|
|
2017-01-11 01:43:48 +01:00
|
|
|
// Set the global minio addr for this server.
|
|
|
|
globalMinioAddr = getLocalAddress(srvConfig)
|
2016-10-28 17:45:32 +02:00
|
|
|
|
2017-01-19 20:32:13 +01:00
|
|
|
// Initialize S3 Peers inter-node communication only in distributed setup.
|
|
|
|
initGlobalS3Peers(endpoints)
|
|
|
|
|
|
|
|
// Initialize Admin Peers inter-node communication only in distributed setup.
|
|
|
|
initGlobalAdminPeers(endpoints)
|
|
|
|
|
2017-01-11 01:43:48 +01:00
|
|
|
// Determine API endpoints where we are going to serve the S3 API from.
|
2017-01-11 22:59:51 +01:00
|
|
|
apiEndPoints, err := finalizeAPIEndpoints(apiServer.Server)
|
|
|
|
fatalIf(err, "Unable to finalize API endpoints for %s", apiServer.Server.Addr)
|
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 00:27:10 +01:00
|
|
|
|
2017-01-11 01:43:48 +01:00
|
|
|
// Set the global API endpoints value.
|
|
|
|
globalAPIEndpoints = apiEndPoints
|
2016-10-18 01:38:29 +02:00
|
|
|
|
2016-10-10 08:03:10 +02:00
|
|
|
// Start server, automatically configures TLS if certs are available.
|
2017-01-11 22:59:51 +01:00
|
|
|
go func() {
|
2016-11-06 04:32:13 +01:00
|
|
|
cert, key := "", ""
|
2017-01-11 22:59:51 +01:00
|
|
|
if globalIsSSL {
|
2016-11-06 04:32:13 +01:00
|
|
|
cert, key = mustGetCertFile(), mustGetKeyFile()
|
2016-10-10 08:03:10 +02:00
|
|
|
}
|
2017-01-11 22:59:51 +01:00
|
|
|
fatalIf(apiServer.ListenAndServe(cert, key), "Failed to start minio server.")
|
|
|
|
}()
|
2016-09-14 10:11:03 +02:00
|
|
|
|
2017-01-23 09:32:55 +01:00
|
|
|
// Set endpoints of []*url.URL type to globalEndpoints.
|
|
|
|
globalEndpoints = endpoints
|
|
|
|
|
2017-01-17 02:05:00 +01:00
|
|
|
newObject, err := newObjectLayer(srvConfig)
|
|
|
|
fatalIf(err, "Initializing object layer failed")
|
2016-09-13 20:00:40 +02:00
|
|
|
|
2016-10-10 08:03:10 +02:00
|
|
|
globalObjLayerMutex.Lock()
|
2016-08-31 04:22:27 +02:00
|
|
|
globalObjectAPI = newObject
|
2016-10-10 08:03:10 +02:00
|
|
|
globalObjLayerMutex.Unlock()
|
2016-08-05 22:48:31 +02:00
|
|
|
|
2016-10-05 21:48:07 +02:00
|
|
|
// Prints the formatted startup message once object layer is initialized.
|
2017-01-11 01:43:48 +01:00
|
|
|
printStartupMessage(apiEndPoints)
|
2016-10-05 21:48:07 +02:00
|
|
|
|
2016-09-14 10:11:03 +02:00
|
|
|
// Waits on the server.
|
2016-10-10 08:03:10 +02:00
|
|
|
<-globalServiceDoneCh
|
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 00:27:10 +01:00
|
|
|
}
|
2017-01-17 02:05:00 +01:00
|
|
|
|
|
|
|
// Initialize object layer with the supplied disks, objectLayer is nil upon any error.
|
|
|
|
func newObjectLayer(srvCmdCfg serverCmdConfig) (newObject ObjectLayer, err error) {
|
|
|
|
// For FS only, directly use the disk.
|
|
|
|
isFS := len(srvCmdCfg.endpoints) == 1
|
|
|
|
if isFS {
|
|
|
|
// Unescape is needed for some UNC paths on windows
|
|
|
|
// which are of this form \\127.0.0.1\\export\test.
|
|
|
|
var fsPath string
|
|
|
|
fsPath, err = url.QueryUnescape(srvCmdCfg.endpoints[0].String())
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize new FS object layer.
|
|
|
|
newObject, err = newFSObjectLayer(fsPath)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// FS initialized, return.
|
|
|
|
return newObject, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// First disk argument check if it is local.
|
|
|
|
firstDisk := isLocalStorage(srvCmdCfg.endpoints[0])
|
|
|
|
|
|
|
|
// Initialize storage disks.
|
|
|
|
storageDisks, err := initStorageDisks(srvCmdCfg.endpoints)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Wait for formatting disks for XL backend.
|
|
|
|
var formattedDisks []StorageAPI
|
|
|
|
formattedDisks, err = waitForFormatXLDisks(firstDisk, srvCmdCfg.endpoints, storageDisks)
|
|
|
|
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
|
|
|
|
}
|