change es cluster version of system cluster support from 7.3 to 5.3
This commit is contained in:
parent
2c8ee843f1
commit
d57e9cf476
|
@ -77,12 +77,12 @@ func checkElasticsearchRequirements() error{
|
||||||
} else if distribution != "" {
|
} else if distribution != "" {
|
||||||
return fmt.Errorf("unkonw cluster distribution: %v", distribution)
|
return fmt.Errorf("unkonw cluster distribution: %v", distribution)
|
||||||
}
|
}
|
||||||
cr, err := util.VersionCompare(versionNumber, "7.3")
|
cr, err := util.VersionCompare(versionNumber, "5.3")
|
||||||
if err !=nil {
|
if err !=nil {
|
||||||
return fmt.Errorf("check system cluster requirement error: %v", err)
|
return fmt.Errorf("check system cluster requirement error: %v", err)
|
||||||
}
|
}
|
||||||
if cr == -1 {
|
if cr == -1 {
|
||||||
return fmt.Errorf("system cluster version with distribution elasticsearch required to be version 7.3 and above, but got %s", versionNumber)
|
return fmt.Errorf("system cluster version with distribution elasticsearch required to be version 5.3 and above, but got %s", versionNumber)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
|
@ -5,6 +5,8 @@ import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
log "github.com/cihub/seelog"
|
||||||
|
"github.com/valyala/fasttemplate"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
"infini.sh/framework/core/api"
|
"infini.sh/framework/core/api"
|
||||||
"infini.sh/framework/core/api/rbac"
|
"infini.sh/framework/core/api/rbac"
|
||||||
|
@ -21,8 +23,8 @@ import (
|
||||||
"infini.sh/framework/core/util"
|
"infini.sh/framework/core/util"
|
||||||
elastic2 "infini.sh/framework/modules/elastic"
|
elastic2 "infini.sh/framework/modules/elastic"
|
||||||
"infini.sh/framework/modules/elastic/adapter"
|
"infini.sh/framework/modules/elastic/adapter"
|
||||||
elastic1 "infini.sh/framework/modules/elastic/common"
|
|
||||||
elastic3 "infini.sh/framework/modules/elastic/api"
|
elastic3 "infini.sh/framework/modules/elastic/api"
|
||||||
|
elastic1 "infini.sh/framework/modules/elastic/common"
|
||||||
"infini.sh/framework/modules/security"
|
"infini.sh/framework/modules/security"
|
||||||
"infini.sh/framework/plugins/replay"
|
"infini.sh/framework/plugins/replay"
|
||||||
"io"
|
"io"
|
||||||
|
@ -31,8 +33,6 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"github.com/valyala/fasttemplate"
|
|
||||||
log "github.com/cihub/seelog"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -184,14 +184,12 @@ func (module *Module) validate(w http.ResponseWriter, r *http.Request, ps httpro
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if ver.Major() >= 7 {
|
if ver.Major() == 5 && ver.Minor() < 3 {
|
||||||
if ver.Major() == 7 && ver.Minor() < 3 {
|
|
||||||
errType = VersionTooOld
|
|
||||||
panic(errors.Errorf("elasticsearch version(%v) should greater than v7.3", verInfo.Version.Number))
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
errType = VersionTooOld
|
errType = VersionTooOld
|
||||||
panic(errors.Errorf("elasticsearch version(%v) should greater than v7.3", verInfo.Version.Number))
|
panic(errors.Errorf("elasticsearch version(%v) should greater than v5.3", verInfo.Version.Number))
|
||||||
|
} else if ver.Major() < 5 {
|
||||||
|
errType = VersionTooOld
|
||||||
|
panic(errors.Errorf("elasticsearch version(%v) should greater than v5.3", verInfo.Version.Number))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if verInfo.Version.Distribution != elastic.Easysearch && verInfo.Version.Distribution != elastic.Opensearch {
|
}else if verInfo.Version.Distribution != elastic.Easysearch && verInfo.Version.Distribution != elastic.Opensearch {
|
||||||
|
@ -402,7 +400,19 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http
|
||||||
//处理生命周期
|
//处理生命周期
|
||||||
//TEMPLATE_NAME
|
//TEMPLATE_NAME
|
||||||
//INDEX_PREFIX
|
//INDEX_PREFIX
|
||||||
dslTplFile:=path.Join(global.Env().GetConfigDir(),"initialization.tpl")
|
ver := elastic.GetClient(GlobalSystemElasticsearchID).GetVersion()
|
||||||
|
dslTplFileName := "initialization.tpl"
|
||||||
|
if ver.Distribution == "" {
|
||||||
|
majorVersion := elastic.GetClient(GlobalSystemElasticsearchID).GetMajorVersion()
|
||||||
|
if majorVersion == 6 {
|
||||||
|
dslTplFileName = "initialization_v6.tpl"
|
||||||
|
}else if majorVersion <= 5 {
|
||||||
|
dslTplFileName = "initialization_v5.tpl"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dslTplFile:=path.Join(global.Env().GetConfigDir(), dslTplFileName)
|
||||||
dslFile:=path.Join(global.Env().GetConfigDir(),"initialization.dsl")
|
dslFile:=path.Join(global.Env().GetConfigDir(),"initialization.dsl")
|
||||||
|
|
||||||
if !util.FileExists(dslTplFile){
|
if !util.FileExists(dslTplFile){
|
||||||
|
@ -461,6 +471,10 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
//处理索引
|
//处理索引
|
||||||
elastic2.InitSchema()
|
elastic2.InitSchema()
|
||||||
//init security
|
//init security
|
||||||
|
|
Loading…
Reference in New Issue