Skip to content

Commit

Permalink
add custom configuration file support for each component in bare-meta…
Browse files Browse the repository at this point in the history
…l mode

Signed-off-by: sh2 <[email protected]>
  • Loading branch information
shawnh2 committed Sep 21, 2023
1 parent b6ee366 commit caedc59
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 4 deletions.
8 changes: 8 additions & 0 deletions examples/bare-metal/cluster-with-s3-storage.datanode.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# More options for storage: https://docs.greptime.com/user-guide/operations/configuration#storage-options

[storage]
type = "S3"
bucket = "test_greptimedb"
root = "/greptimedb"
access_key_id = "<access key id>"
secret_access_key = "<secret access key>"
21 changes: 21 additions & 0 deletions examples/bare-metal/cluster-with-s3-storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cluster:
name: mycluster # name of the cluster
artifact:
version: latest
frontend:
replicas: 1
datanode:
replicas: 3
rpcAddr: 0.0.0.0:14100
mysqlAddr: 0.0.0.0:14200
httpAddr: 0.0.0.0:14300
config: 'examples/bare-metal/cluster-with-s3-storage.datanode.toml'
meta:
replicas: 1
storeAddr: 127.0.0.1:2379
serverAddr: 0.0.0.0:3002
httpAddr: 0.0.0.0:14001

etcd:
artifact:
version: v3.5.7
5 changes: 5 additions & 0 deletions pkg/deployer/baremetal/component/datanode.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ func (d *datanode) BuildArgs(ctx context.Context, params ...interface{}) []strin
fmt.Sprintf("--data-home=%s", dataHomeDir),
fmt.Sprintf("--wal-dir=%s", walDir),
}

if len(d.config.Config) > 0 {
args = append(args, fmt.Sprintf("-c %s", d.config.Config))
}

return args
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/deployer/baremetal/component/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,17 @@ func (f *frontend) BuildArgs(ctx context.Context, params ...interface{}) []strin
if logLevel == "" {
logLevel = config.DefaultLogLevel
}

args := []string{
fmt.Sprintf("--log-level=%s", logLevel),
f.Name(), "start",
fmt.Sprintf("--metasrv-addr=%s", f.metaSrvAddr),
}

if len(f.config.Config) > 0 {
args = append(args, fmt.Sprintf("-c %s", f.config.Config))
}

return args
}

Expand Down
13 changes: 9 additions & 4 deletions pkg/deployer/baremetal/component/metasrv.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,16 @@ func (m *metaSrv) BuildArgs(ctx context.Context, params ...interface{}) []string
args := []string{
fmt.Sprintf("--log-level=%s", logLevel),
m.Name(), "start",
"--store-addr", m.config.StoreAddr,
"--server-addr", m.config.ServerAddr,
"--http-addr", generateMetaSrvAddr(m.config.HTTPAddr, nodeID),
"--bind-addr", generateMetaSrvAddr(bindAddr, nodeID),
fmt.Sprintf("--store-addr=%s", m.config.StoreAddr),
fmt.Sprintf("--server-addr=%s", m.config.ServerAddr),
fmt.Sprintf("--http-addr=%s", generateMetaSrvAddr(m.config.HTTPAddr, nodeID)),
fmt.Sprintf("--bind-addr=%s", generateMetaSrvAddr(bindAddr, nodeID)),
}

if len(m.config.Config) > 0 {
args = append(args, fmt.Sprintf("-c %s", m.config.Config))
}

return args
}

Expand Down
1 change: 1 addition & 0 deletions pkg/deployer/baremetal/config/datanode.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type Datanode struct {
DataDir string `yaml:"dataDir" validate:"omitempty,dirpath"`
WalDir string `yaml:"walDir" validate:"omitempty,dirpath"`
ProcedureDir string `yaml:"procedureDir" validate:"omitempty,dirpath"`
Config string `yaml:"config" validate:"omitempty,filepath"`

LogLevel string `yaml:"logLevel"`
}
2 changes: 2 additions & 0 deletions pkg/deployer/baremetal/config/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ type Frontend struct {
PostgresAddr string `yaml:"postgresAddr" validate:"omitempty,hostname_port"`
MetaAddr string `yaml:"metaAddr" validate:"omitempty,hostname_port"`

Config string `yaml:"config" validate:"omitempty,filepath"`

LogLevel string `yaml:"logLevel"`
}
2 changes: 2 additions & 0 deletions pkg/deployer/baremetal/config/metasrv.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ type MetaSrv struct {
BindAddr string `yaml:"bindAddr" validate:"omitempty,hostname_port"`
HTTPAddr string `yaml:"httpAddr" validate:"required,hostname_port"`

Config string `yaml:"config" validate:"omitempty,filepath"`

LogLevel string `yaml:"logLevel"`
}

0 comments on commit caedc59

Please sign in to comment.