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
|
|
|
/*
|
|
|
|
* Minio Cloud Storage, (C) 2015, 2016 Minio, Inc.
|
|
|
|
*
|
|
|
|
* 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 (
|
2016-10-18 15:49:24 -04: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-12 18:27:10 -05:00
|
|
|
"fmt"
|
|
|
|
"net"
|
|
|
|
"net/http"
|
|
|
|
"os"
|
2016-10-18 15:49:24 -04: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-12 18:27:10 -05:00
|
|
|
"strconv"
|
|
|
|
"strings"
|
2016-05-31 14:53:21 -04:00
|
|
|
"time"
|
config/main: Re-write config files - add to new config v3
- New config format.
```
{
"version": "3",
"address": ":9000",
"backend": {
"type": "fs",
"disk": "/path"
},
"credential": {
"accessKey": "WLGDGYAQYIGI833EV05A",
"secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF"
},
"region": "us-east-1",
"logger": {
"file": {
"enable": false,
"fileName": "",
"level": "error"
},
"syslog": {
"enable": false,
"address": "",
"level": "debug"
},
"console": {
"enable": true,
"level": "fatal"
}
}
}
```
New command lines in lieu of supporting XL.
Minio initialize filesystem backend.
~~~
$ minio init fs <path>
~~~
Minio initialize XL backend.
~~~
$ minio init xl <url1>...<url16>
~~~
For 'fs' backend it starts the server.
~~~
$ minio server
~~~
For 'xl' backend it waits for servers to join.
~~~
$ minio server
... [PROGRESS BAR] of servers connecting
~~~
Now on other servers execute 'join' and they connect.
~~~
....
minio join <url1> -- from <url2> && minio server
minio join <url1> -- from <url3> && minio server
...
...
minio join <url1> -- from <url16> && minio server
~~~
2016-02-12 18:27:10 -05:00
|
|
|
|
2016-10-18 15:49:24 -04:00
|
|
|
"regexp"
|
|
|
|
|
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"
|
|
|
|
)
|
|
|
|
|
2016-09-01 18:12:49 -04:00
|
|
|
var serverFlags = []cli.Flag{
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "address",
|
|
|
|
Value: ":9000",
|
|
|
|
Usage: "Specify custom server \"ADDRESS:PORT\", defaults to \":9000\".",
|
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "ignore-disks",
|
|
|
|
Usage: "Specify comma separated list of disks that are offline.",
|
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 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:
|
|
|
|
minio {{.Name}} - {{.Usage}}
|
|
|
|
|
|
|
|
USAGE:
|
2016-08-28 23:04:47 -04: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-12 18:27:10 -05:00
|
|
|
|
2016-08-28 23:04:47 -04: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-12 18:27:10 -05:00
|
|
|
{{range .Flags}}{{.}}
|
|
|
|
{{end}}
|
|
|
|
ENVIRONMENT VARIABLES:
|
2016-07-10 17:38:15 -04:00
|
|
|
ACCESS:
|
|
|
|
MINIO_ACCESS_KEY: Access key string of 5 to 20 characters in length.
|
|
|
|
MINIO_SECRET_KEY: Secret key string of 8 to 40 characters in length.
|
|
|
|
|
|
|
|
CACHING:
|
|
|
|
MINIO_CACHE_SIZE: Set total cache size in NN[GB|MB|KB]. Defaults to 8GB.
|
|
|
|
MINIO_CACHE_EXPIRY: Set cache expiration duration in NN[h|m|s]. Defaults to 72 hours.
|
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-10-05 15:48:07 -04:00
|
|
|
SECURITY:
|
|
|
|
MINIO_SECURE_CONSOLE: Set secure console to '0' to disable printing secret key. Defaults to '1'.
|
|
|
|
|
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:
|
|
|
|
1. Start minio server.
|
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
|
|
|
$ minio {{.Name}} /home/shared
|
|
|
|
|
|
|
|
2. Start minio server bound to a specific IP:PORT, when you have multiple network interfaces.
|
|
|
|
$ 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-12 18:27:10 -05: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
|
|
|
3. Start minio server on Windows.
|
|
|
|
$ minio {{.Name}} C:\MyShare
|
2016-03-28 00:52:38 -04:00
|
|
|
|
2016-07-10 17:38:15 -04:00
|
|
|
4. Start minio server on 12 disks to enable erasure coded layer with 6 data and 6 parity.
|
2016-09-01 16:29:26 -04: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 17:38:15 -04:00
|
|
|
|
|
|
|
5. Start minio server on 12 disks while ignoring two disks for initialization.
|
2016-09-01 16:29:26 -04:00
|
|
|
$ minio {{.Name}} --ignore-disks=/mnt/export1/ /mnt/export1/ /mnt/export2/ \
|
2016-09-21 22:58:50 -04:00
|
|
|
/mnt/export3/ /mnt/export4/ /mnt/export5/ /mnt/export6/ /mnt/export7/ \
|
2016-09-01 16:29:26 -04:00
|
|
|
/mnt/export8/ /mnt/export9/ /mnt/export10/ /mnt/export11/ /mnt/export12/
|
2016-08-18 17:29:23 -04:00
|
|
|
|
2016-09-09 18:32:08 -04:00
|
|
|
6. Start minio server on a 4 node distributed setup. Type the following command on all the 4 nodes.
|
2016-08-18 17:29:23 -04:00
|
|
|
$ export MINIO_ACCESS_KEY=minio
|
|
|
|
$ export MINIO_SECRET_KEY=miniostorage
|
2016-09-01 16:29:26 -04:00
|
|
|
$ minio {{.Name}} 192.168.1.11:/mnt/export/ 192.168.1.12:/mnt/export/ \
|
|
|
|
192.168.1.13:/mnt/export/ 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
|
|
|
`,
|
|
|
|
}
|
|
|
|
|
2016-04-12 15:45:15 -04:00
|
|
|
type serverCmdConfig struct {
|
2016-10-18 15:49:24 -04:00
|
|
|
serverAddr string
|
|
|
|
endPoints []storageEndPoint
|
|
|
|
ignoredEndPoints []storageEndPoint
|
|
|
|
isDistXL bool // True only if its distributed XL.
|
|
|
|
storageDisks []StorageAPI
|
|
|
|
}
|
|
|
|
|
|
|
|
// End point is specified in the command line as host:port:path or host:path or path
|
|
|
|
// host:port:path or host:path - for distributed XL. Default port is 9000.
|
|
|
|
// just path - for single node XL or FS.
|
|
|
|
type storageEndPoint struct {
|
|
|
|
host string // Will be empty for single node XL and FS
|
|
|
|
port int // Will be valid for distributed XL
|
|
|
|
path string // Will be valid for all configs
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns string form.
|
|
|
|
func (ep storageEndPoint) String() string {
|
|
|
|
var str []string
|
|
|
|
if ep.host != "" {
|
|
|
|
str = append(str, ep.host)
|
|
|
|
}
|
|
|
|
if ep.port != 0 {
|
|
|
|
str = append(str, strconv.Itoa(ep.port))
|
|
|
|
}
|
|
|
|
if ep.path != "" {
|
|
|
|
str = append(str, ep.path)
|
|
|
|
}
|
|
|
|
return strings.Join(str, ":")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns if ep is present in the eps list.
|
|
|
|
func (ep storageEndPoint) presentIn(eps []storageEndPoint) bool {
|
|
|
|
for _, entry := range eps {
|
|
|
|
if entry == ep {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parse end-point (of the form host:port:path or host:path or path)
|
|
|
|
func parseStorageEndPoint(ep string, defaultPort int) (storageEndPoint, error) {
|
|
|
|
if runtime.GOOS == "windows" {
|
2016-10-24 11:26:28 -04:00
|
|
|
// Try to match path, ex. C:\export or export
|
|
|
|
matched, err := regexp.MatchString(`^([a-zA-Z]:\\[^:]+|[^:]+)$`, ep)
|
2016-10-18 15:49:24 -04:00
|
|
|
if err != nil {
|
|
|
|
return storageEndPoint{}, err
|
|
|
|
}
|
|
|
|
if matched {
|
|
|
|
return storageEndPoint{path: ep}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Try to match host:path ex. 127.0.0.1:C:\export
|
|
|
|
re, err := regexp.Compile(`^([^:]+):([a-zA-Z]:\\[^:]+)$`)
|
|
|
|
if err != nil {
|
|
|
|
return storageEndPoint{}, err
|
|
|
|
}
|
|
|
|
result := re.FindStringSubmatch(ep)
|
|
|
|
if len(result) != 0 {
|
|
|
|
return storageEndPoint{host: result[1], port: defaultPort, path: result[2]}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Try to match host:port:path ex. 127.0.0.1:443:C:\export
|
|
|
|
re, err = regexp.Compile(`^([^:]+):([0-9]+):([a-zA-Z]:\\[^:]+)$`)
|
|
|
|
if err != nil {
|
|
|
|
return storageEndPoint{}, err
|
|
|
|
}
|
|
|
|
result = re.FindStringSubmatch(ep)
|
|
|
|
if len(result) != 0 {
|
|
|
|
portInt, err := strconv.Atoi(result[2])
|
|
|
|
if err != nil {
|
|
|
|
return storageEndPoint{}, err
|
|
|
|
}
|
|
|
|
return storageEndPoint{host: result[1], port: portInt, path: result[3]}, nil
|
|
|
|
}
|
|
|
|
return storageEndPoint{}, errors.New("Unable to parse endpoint " + ep)
|
|
|
|
}
|
|
|
|
// For *nix OSes
|
|
|
|
parts := strings.Split(ep, ":")
|
|
|
|
var parsedep storageEndPoint
|
|
|
|
switch len(parts) {
|
|
|
|
case 1:
|
|
|
|
parsedep = storageEndPoint{path: parts[0]}
|
|
|
|
case 2:
|
|
|
|
parsedep = storageEndPoint{host: parts[0], port: defaultPort, path: parts[1]}
|
|
|
|
case 3:
|
|
|
|
port, err := strconv.Atoi(parts[1])
|
|
|
|
if err != nil {
|
|
|
|
return storageEndPoint{}, err
|
|
|
|
}
|
|
|
|
parsedep = storageEndPoint{host: parts[0], port: port, path: parts[2]}
|
|
|
|
default:
|
|
|
|
return storageEndPoint{}, errors.New("Unable to parse " + ep)
|
|
|
|
}
|
|
|
|
return parsedep, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parse an array of end-points (passed on the command line)
|
|
|
|
func parseStorageEndPoints(eps []string, defaultPort int) (endpoints []storageEndPoint, err error) {
|
|
|
|
for _, ep := range eps {
|
|
|
|
if ep == "" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
var endpoint storageEndPoint
|
|
|
|
endpoint, err = parseStorageEndPoint(ep, defaultPort)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
endpoints = append(endpoints, endpoint)
|
|
|
|
}
|
|
|
|
return endpoints, nil
|
2016-04-12 15:45:15 -04:00
|
|
|
}
|
|
|
|
|
2016-05-07 00:18:29 -04:00
|
|
|
// getListenIPs - gets all the ips to listen on.
|
2016-10-24 02:55:12 -04:00
|
|
|
func getListenIPs(httpServerConf *http.Server) (hosts []string, port string, err error) {
|
|
|
|
var host string
|
|
|
|
host, port, err = net.SplitHostPort(httpServerConf.Addr)
|
|
|
|
if err != nil {
|
|
|
|
return nil, port, fmt.Errorf("Unable to parse host address %s", err)
|
2016-07-13 02:21:18 -04:00
|
|
|
}
|
2016-10-24 02:55:12 -04:00
|
|
|
if host == "" {
|
|
|
|
var addrs []net.Addr
|
|
|
|
addrs, err = net.InterfaceAddrs()
|
|
|
|
if err != nil {
|
|
|
|
return nil, port, fmt.Errorf("Unable to determine network interface address. %s", err)
|
|
|
|
}
|
|
|
|
for _, addr := range addrs {
|
|
|
|
if addr.Network() == "ip+net" {
|
|
|
|
hostname := strings.Split(addr.String(), "/")[0]
|
|
|
|
if ip := net.ParseIP(hostname); ip.To4() != nil {
|
|
|
|
hosts = append(hosts, hostname)
|
|
|
|
}
|
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-10-24 02:55:12 -04:00
|
|
|
err = sortIPsByOctet(hosts)
|
|
|
|
if err != nil {
|
|
|
|
return nil, port, fmt.Errorf("Unable reverse sorted ips from hosts %s", err)
|
|
|
|
}
|
|
|
|
return hosts, port, nil
|
|
|
|
} // if host != "" {
|
|
|
|
// Proceed to append itself, since user requested a specific endpoint.
|
|
|
|
hosts = append(hosts, host)
|
|
|
|
return hosts, port, nil
|
2016-05-07 00:18:29 -04:00
|
|
|
}
|
|
|
|
|
2016-07-13 02:21:18 -04:00
|
|
|
// Finalizes the endpoints based on the host list and port.
|
|
|
|
func finalizeEndpoints(tls bool, apiServer *http.Server) (endPoints []string) {
|
|
|
|
// Verify current scheme.
|
|
|
|
scheme := "http"
|
|
|
|
if tls {
|
|
|
|
scheme = "https"
|
|
|
|
}
|
|
|
|
|
2016-10-24 02:55:12 -04:00
|
|
|
// Get list of listen ips and port.
|
|
|
|
hosts, port, err := getListenIPs(apiServer)
|
|
|
|
fatalIf(err, "Unable to get list of ips to listen on")
|
2016-07-13 09:34:59 -04:00
|
|
|
|
2016-07-13 02:21:18 -04:00
|
|
|
// Construct proper endpoints.
|
2016-10-24 02:55:12 -04:00
|
|
|
for _, host := range hosts {
|
|
|
|
endPoints = append(endPoints, fmt.Sprintf("%s://%s:%s", scheme, host, port))
|
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-07-13 02:21:18 -04:00
|
|
|
|
|
|
|
// Success.
|
|
|
|
return 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-12 18:27:10 -05: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
|
|
|
// initServerConfig initialize server config.
|
|
|
|
func initServerConfig(c *cli.Context) {
|
2016-07-30 17:55:20 -04:00
|
|
|
// Create certs path.
|
|
|
|
err := createCertsPath()
|
|
|
|
fatalIf(err, "Unable to create \"certs\" directory.")
|
|
|
|
|
2016-06-26 06:18:07 -04:00
|
|
|
// Fetch max conn limit from environment variable.
|
|
|
|
if maxConnStr := os.Getenv("MINIO_MAXCONN"); maxConnStr != "" {
|
|
|
|
// We need to parse to its integer value.
|
|
|
|
globalMaxConn, err = strconv.Atoi(maxConnStr)
|
|
|
|
fatalIf(err, "Unable to convert MINIO_MAXCONN=%s environment variable into its integer value.", maxConnStr)
|
|
|
|
}
|
|
|
|
|
2016-07-03 19:58:21 -04:00
|
|
|
// Fetch max cache size from environment variable.
|
|
|
|
if maxCacheSizeStr := os.Getenv("MINIO_CACHE_SIZE"); maxCacheSizeStr != "" {
|
|
|
|
// We need to parse cache size to its integer value.
|
|
|
|
globalMaxCacheSize, err = strconvBytes(maxCacheSizeStr)
|
|
|
|
fatalIf(err, "Unable to convert MINIO_CACHE_SIZE=%s environment variable into its integer value.", maxCacheSizeStr)
|
|
|
|
}
|
|
|
|
|
2016-07-08 23:34:27 -04:00
|
|
|
// Fetch cache expiry from environment variable.
|
|
|
|
if cacheExpiryStr := os.Getenv("MINIO_CACHE_EXPIRY"); cacheExpiryStr != "" {
|
|
|
|
// We need to parse cache expiry to its time.Duration value.
|
|
|
|
globalCacheExpiry, err = time.ParseDuration(cacheExpiryStr)
|
|
|
|
fatalIf(err, "Unable to convert MINIO_CACHE_EXPIRY=%s environment variable into its time.Duration value.", cacheExpiryStr)
|
|
|
|
}
|
|
|
|
|
2016-10-18 02:14:41 -04: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-02 19:48:21 -04:00
|
|
|
err = serverConfig.Save()
|
2016-10-18 02:14:41 -04: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-12 18:27:10 -05:00
|
|
|
}
|
2016-04-19 01:05:32 -04:00
|
|
|
|
|
|
|
// Set maxOpenFiles, This is necessary since default operating
|
|
|
|
// system limits of 1024, 2048 are not enough for Minio server.
|
|
|
|
setMaxOpenFiles()
|
2016-10-06 16:35:56 -04:00
|
|
|
|
2016-07-30 11:50:49 -04: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 01:05:32 -04: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-12 18:27:10 -05:00
|
|
|
}
|
|
|
|
|
2016-08-26 03:11:53 -04:00
|
|
|
// Validate if input disks are sufficient for initializing XL.
|
2016-10-18 15:49:24 -04:00
|
|
|
func checkSufficientDisks(eps []storageEndPoint) error {
|
2016-08-26 03:11:53 -04:00
|
|
|
// Verify total number of disks.
|
2016-10-18 15:49:24 -04:00
|
|
|
total := len(eps)
|
|
|
|
if total > maxErasureBlocks {
|
2016-08-26 03:11:53 -04:00
|
|
|
return errXLMaxDisks
|
|
|
|
}
|
2016-10-18 15:49:24 -04:00
|
|
|
if total < minErasureBlocks {
|
2016-08-26 03:11:53 -04: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 15:49:24 -04:00
|
|
|
if !isEven(total) {
|
2016-08-26 03:11:53 -04:00
|
|
|
return errXLNumDisks
|
|
|
|
}
|
|
|
|
|
|
|
|
// Success.
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2016-10-05 15:48:07 -04:00
|
|
|
// Validate input disks.
|
2016-10-18 15:49:24 -04:00
|
|
|
func validateDisks(endPoints []storageEndPoint, ignoredEndPoints []storageEndPoint) []StorageAPI {
|
|
|
|
isXL := len(endPoints) > 1
|
2016-10-05 15:48:07 -04:00
|
|
|
if isXL {
|
2016-08-26 03:11:53 -04:00
|
|
|
// Validate if input disks have duplicates in them.
|
2016-10-18 15:49:24 -04:00
|
|
|
err := checkDuplicateEndPoints(endPoints)
|
2016-08-26 03:11:53 -04:00
|
|
|
fatalIf(err, "Invalid disk arguments for server.")
|
|
|
|
|
|
|
|
// Validate if input disks are sufficient for erasure coded setup.
|
2016-10-18 15:49:24 -04:00
|
|
|
err = checkSufficientDisks(endPoints)
|
2016-08-26 03:11:53 -04:00
|
|
|
fatalIf(err, "Invalid disk arguments for server.")
|
|
|
|
}
|
2016-10-18 15:49:24 -04:00
|
|
|
storageDisks, err := initStorageDisks(endPoints, ignoredEndPoints)
|
2016-10-05 15:48:07 -04:00
|
|
|
fatalIf(err, "Unable to initialize storage disks.")
|
|
|
|
return storageDisks
|
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-08-23 22:19:24 -04:00
|
|
|
// Returns if slice of disks is a distributed setup.
|
2016-10-18 15:49:24 -04:00
|
|
|
func isDistributedSetup(eps []storageEndPoint) (isDist bool) {
|
2016-08-23 22:19:24 -04:00
|
|
|
// Port to connect to for the lock servers in a distributed setup.
|
2016-10-18 15:49:24 -04:00
|
|
|
for _, ep := range eps {
|
|
|
|
if !isLocalStorage(ep) {
|
2016-08-23 22:19:24 -04:00
|
|
|
// One or more disks supplied as arguments are not
|
|
|
|
// attached to the local node.
|
|
|
|
isDist = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return isDist
|
|
|
|
}
|
|
|
|
|
2016-07-13 02:21:18 -04: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-01 22:19:44 -04:00
|
|
|
func serverMain(c *cli.Context) {
|
2016-10-05 15:48:07 -04:00
|
|
|
if !c.Args().Present() || c.Args().First() == "help" {
|
|
|
|
cli.ShowCommandHelpAndExit(c, "server", 1)
|
|
|
|
}
|
2016-07-01 17:32:53 -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.
|
2016-10-10 02:03:10 -04: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-01 22:19:44 -04:00
|
|
|
|
2016-04-12 15:45:15 -04:00
|
|
|
// Check if requested port is available.
|
2016-10-18 15:49:24 -04:00
|
|
|
host, portStr, err := net.SplitHostPort(serverAddr)
|
|
|
|
fatalIf(err, "Unable to parse %s.", serverAddr)
|
|
|
|
|
|
|
|
portInt, err := strconv.Atoi(portStr)
|
|
|
|
fatalIf(err, "Invalid port number.")
|
|
|
|
|
|
|
|
fatalIf(checkPortAvailability(portInt), "Port unavailable %d", portInt)
|
2016-10-05 15:48:07 -04:00
|
|
|
|
2016-10-18 15:49:24 -04:00
|
|
|
// Saves host and port in a globally accessible value.
|
|
|
|
globalMinioPort = portInt
|
|
|
|
globalMinioHost = host
|
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
|
|
|
|
2016-07-10 17:38:15 -04:00
|
|
|
// Disks to be ignored in server init, to skip format healing.
|
2016-10-18 15:49:24 -04:00
|
|
|
ignoredDisks, err := parseStorageEndPoints(strings.Split(c.String("ignore-disks"), ","), portInt)
|
|
|
|
fatalIf(err, "Unable to parse storage endpoints %s", strings.Split(c.String("ignore-disks"), ","))
|
2016-07-10 17:38:15 -04:00
|
|
|
|
|
|
|
// Disks to be used in server init.
|
2016-10-18 15:49:24 -04:00
|
|
|
disks, err := parseStorageEndPoints(c.Args(), portInt)
|
|
|
|
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-12 18:27:10 -05:00
|
|
|
|
2016-10-05 15:48:07 -04:00
|
|
|
// Initialize server config.
|
|
|
|
initServerConfig(c)
|
|
|
|
|
2016-10-06 16:35:56 -04:00
|
|
|
// Check 'server' cli arguments.
|
|
|
|
storageDisks := validateDisks(disks, ignoredDisks)
|
|
|
|
|
2016-10-19 22:59:48 -04:00
|
|
|
// Cleanup objects that weren't successfully written into the namespace.
|
|
|
|
fatalIf(houseKeeping(storageDisks), "Unable to purge temporary files.")
|
|
|
|
|
2016-10-05 15:48:07 -04:00
|
|
|
// If https.
|
|
|
|
tls := isSSL()
|
|
|
|
|
|
|
|
// First disk argument check if it is local.
|
|
|
|
firstDisk := isLocalStorage(disks[0])
|
|
|
|
|
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-30 19:15:28 -04:00
|
|
|
// Configure server.
|
2016-10-05 15:48:07 -04:00
|
|
|
srvConfig := serverCmdConfig{
|
2016-10-18 15:49:24 -04:00
|
|
|
serverAddr: serverAddr,
|
|
|
|
endPoints: disks,
|
|
|
|
ignoredEndPoints: ignoredDisks,
|
|
|
|
storageDisks: storageDisks,
|
|
|
|
isDistXL: isDistributedSetup(disks),
|
2016-07-31 17:11:14 -04:00
|
|
|
}
|
2016-08-30 22:22:27 -04:00
|
|
|
|
2016-07-31 17:11:14 -04:00
|
|
|
// Configure server.
|
2016-10-13 02:13:24 -04:00
|
|
|
handler, err := configureServerHandler(srvConfig)
|
|
|
|
fatalIf(err, "Unable to configure one of server's RPC services.")
|
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-10-05 15:48:07 -04:00
|
|
|
// Set nodes for dsync for distributed setup.
|
2016-10-10 02:03:10 -04:00
|
|
|
if srvConfig.isDistXL {
|
2016-10-18 15:49:24 -04:00
|
|
|
fatalIf(initDsyncNodes(disks), "Unable to initialize distributed locking")
|
2016-10-05 15:48:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize name space lock.
|
2016-10-10 02:03:10 -04:00
|
|
|
initNSLock(srvConfig.isDistXL)
|
2016-10-05 15:48:07 -04:00
|
|
|
|
|
|
|
// Initialize a new HTTP server.
|
2016-10-10 02:03:10 -04:00
|
|
|
apiServer := NewServerMux(serverAddr, handler)
|
2016-08-12 00:33:55 -04:00
|
|
|
|
2016-07-13 02:21:18 -04:00
|
|
|
// Fetch endpoints which we are going to serve from.
|
2016-07-24 15:30:57 -04:00
|
|
|
endPoints := finalizeEndpoints(tls, &apiServer.Server)
|
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-10-17 19:38:29 -04:00
|
|
|
// Initialize local server address
|
|
|
|
globalMinioAddr = getLocalAddress(srvConfig)
|
|
|
|
|
|
|
|
// Initialize S3 Peers inter-node communication
|
|
|
|
initGlobalS3Peers(disks)
|
|
|
|
|
2016-10-10 02:03:10 -04:00
|
|
|
// Start server, automatically configures TLS if certs are available.
|
|
|
|
go func(tls bool) {
|
|
|
|
var lerr error
|
|
|
|
if tls {
|
|
|
|
lerr = apiServer.ListenAndServeTLS(mustGetCertFile(), mustGetKeyFile())
|
|
|
|
} else {
|
|
|
|
// Fallback to http.
|
|
|
|
lerr = apiServer.ListenAndServe()
|
|
|
|
}
|
|
|
|
fatalIf(lerr, "Failed to start minio server.")
|
|
|
|
}(tls)
|
2016-09-14 04:11:03 -04:00
|
|
|
|
|
|
|
// Wait for formatting of disks.
|
2016-10-13 02:13:24 -04:00
|
|
|
err = waitForFormatDisks(firstDisk, endPoints[0], storageDisks)
|
2016-10-05 15:48:07 -04:00
|
|
|
fatalIf(err, "formatting storage disks failed")
|
2016-09-14 04:11:03 -04:00
|
|
|
|
|
|
|
// Once formatted, initialize object layer.
|
2016-10-05 15:48:07 -04:00
|
|
|
newObject, err := newObjectLayer(storageDisks)
|
|
|
|
fatalIf(err, "intializing object layer failed")
|
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.
|
|
|
|
printStartupMessage(endPoints)
|
|
|
|
|
2016-09-14 04:11:03 -04:00
|
|
|
// Waits on the server.
|
2016-10-10 02:03:10 -04: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-12 18:27:10 -05:00
|
|
|
}
|