Skip to content

Commit

Permalink
remove cluster_ prefix from export api
Browse files Browse the repository at this point in the history
  • Loading branch information
liuqing6767 committed Oct 20, 2021
1 parent f4ca1c6 commit 389ba85
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
output
dist
api-server
1 change: 0 additions & 1 deletion conf/i18n/zh.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Lang = "zh"
"Authorizate Fail" = "鉴权失败"
"Unknown Exception" = "未知异常"

"^Health Check Job$" = "健康检查任务"
"^Product Not Exist$" = "产品线不存在"
"^Not Cluste Existed$" = "暂无集群"
"^Want Prefix (.+).$" = "期望前缀 %s."
Expand Down
3 changes: 2 additions & 1 deletion docs/zh_cn/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ BFE控制面包含如下组件:
- 方式一:通过源码编译:clone本仓库后进入项目根目录,执行 `make`,output文件夹包括了可执行文件和初始配置文件
- 方式二:直接进入 [releases](https://github.com/bfenetworks/api-server/releases) 页面下载相应的编译产出
1. 修改初始配置文件,详见[配置文件说明](./config_param.md)
- 特别注意:绝大多数配置可以使用默认配置,最小修改集合为 **数据库用户名和密码**
1. 启动 API Server。执行`./api-server -c ./conf -sc api_server.toml -l ./log `。如果不需要指定启动参数,直接执行 `./api-server` 即可

## Dashboard 部署
Expand All @@ -60,5 +61,5 @@ Conf Agent和 BFE 转发引擎同机部署。
1. 获取Conf Agent可执行程序
- 方式一:通过源码编译:clone [bfenetwork/conf-agent](https://github.com/bfenetworks/conf-agent) 仓库后进入项目根目录,执行 `make`, output文件夹包括了可执行文件和初始配置文件
- 方式二:直接进入 [release](https://github.com/bfenetworks/conf-agent/releases) 页面下载相应的编译产出
1. 修改配置,详见 [配置文件说明](https://github.com/bfenetworks/conf-agent/docs/zh-cn/config.md),使其能访问API Server导出最新的配置
1. 修改配置,详见 [配置文件说明](https://github.com/bfenetworks/conf-agent/blob/develop/docs/zh_cn/config.md),使其能访问API Server导出最新的配置
1. 启动 Conf Agent。执行 `./conf-agent`
2 changes: 1 addition & 1 deletion model/icluster_conf/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ func NewBfeClusterConf(version string, clusters []*Cluster) *cluster_conf.BfeClu
continue
}

clusterConfMap["cluster_"+cluster.Name] = cluster_conf.ClusterConf{
clusterConfMap[cluster.Name] = cluster_conf.ClusterConf{
BackendConf: &cluster_conf.BackendBasic{
Protocol: lib.PString("http"),
TimeoutConnSrv: int322intp(cluster.Basic.Timeouts.TimeoutConnServ),
Expand Down
13 changes: 2 additions & 11 deletions model/iroute_conf/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,12 @@ func newRouteTableFile(version string, productMapID2Name map[int64]string,
basicRule := route_rule_conf.ProductBasicRouteRuleFile{}
advanceRule := route_rule_conf.ProductAdvancedRouteRuleFile{}

clusterName := func(cn string) *string {
if cn == icluster_conf.RouteAdvancedModeClusterName4DP {
return &cn
}

tmp := "cluster_" + cn
return &tmp
}

newBasicRouteRuleFiles := func(brrs []*BasicRouteRule) (bs []route_rule_conf.BasicRouteRuleFile) {
for _, brr := range brrs {
bs = append(bs, route_rule_conf.BasicRouteRuleFile{
Hostname: brr.HostNames,
Path: brr.Paths,
ClusterName: clusterName(brr.ClusterName),
ClusterName: &brr.ClusterName,
})
}

Expand All @@ -141,7 +132,7 @@ func newRouteTableFile(version string, productMapID2Name map[int64]string,
for _, arr := range arrs {
as = append(as, route_rule_conf.AdvancedRouteRuleFile{
Cond: &arr.Expression,
ClusterName: clusterName(arr.ClusterName),
ClusterName: &arr.ClusterName,
})
}

Expand Down
4 changes: 4 additions & 0 deletions stateful/config_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func NewDB(dbConfig *DbConfig) (*sql.DB, error) {
return nil, err
}

if err := db.Ping(); err != nil {
return nil, err
}

db.SetMaxOpenConns(dbConfig.MaxOpenConns)
db.SetMaxIdleConns(dbConfig.MaxIdleConns)
db.SetConnMaxIdleTime(time.Duration(dbConfig.ConnMaxIdleTimeMs) * time.Millisecond)
Expand Down

0 comments on commit 389ba85

Please sign in to comment.