Specify componet ip (#27161)

Signed-off-by: lixinguo <xinguo.li@zilliz.com>
Co-authored-by: lixinguo <xinguo.li@zilliz.com>
This commit is contained in:
smellthemoon 2023-09-20 11:49:25 +08:00 committed by GitHub
parent 9baff1b81c
commit d1f6825b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 1 deletions

View File

@ -168,6 +168,9 @@ rootCoord:
importTaskExpiration: 900 # (in seconds) Duration after which an import task will expire (be killed). Default 900 seconds (15 minutes).
importTaskRetention: 86400 # (in seconds) Milvus will keep the record of import tasks for at least `importTaskRetention` seconds. Default 86400, seconds (24 hours).
enableActiveStandby: false
# can specify ip for example
# ip: 127.0.0.1
ip: # if not specify address, will use the first unicastable address as local ip
port: 53100
grpc:
serverMaxSendSize: 536870912
@ -199,6 +202,9 @@ proxy:
http:
enabled: true # Whether to enable the http server
debug_mode: false # Whether to enable http server debug mode
# can specify ip for example
# ip: 127.0.0.1
ip: # if not specify address, will use the first unicastable address as local ip
port: 19530
internalPort: 19529
grpc:
@ -225,6 +231,9 @@ queryCoord:
heartbeatAvailableInterval: 10000 # 10s, Only QueryNodes which fetched heartbeats within the duration are available
loadTimeoutSeconds: 600
checkHandoffInterval: 5000
# can specify ip for example
# ip: 127.0.0.1
ip: # if not specify address, will use the first unicastable address as local ip
port: 19531
grpc:
serverMaxSendSize: 536870912
@ -292,6 +301,9 @@ queryNode:
enableCrossUserGrouping: false # false by default Enable Cross user grouping when using user-task-polling policy. (close it if task of any user can not merge others).
maxPendingTaskPerUser: 1024 # 50 by default, max pending task in scheduler per user.
# can specify ip for example
# ip: 127.0.0.1
ip: # if not specify address, will use the first unicastable address as local ip
port: 21123
grpc:
serverMaxSendSize: 536870912
@ -313,6 +325,9 @@ indexNode:
buildParallel: 1
enableDisk: true # enable index node build disk vector index
maxDiskUsagePercentage: 95
# can specify ip for example
# ip: 127.0.0.1
ip: # if not specify address, will use the first unicastable address as local ip
port: 21121
grpc:
serverMaxSendSize: 536870912
@ -365,6 +380,9 @@ dataCoord:
missingTolerance: 3600 # file meta missing tolerance duration in seconds, 3600
dropTolerance: 10800 # file belongs to dropped entity tolerance duration in seconds. 10800
enableActiveStandby: false
# can specify ip for example
# ip: 127.0.0.1
ip: # if not specify address, will use the first unicastable address as local ip
port: 13333
grpc:
serverMaxSendSize: 536870912
@ -382,6 +400,9 @@ dataNode:
insertBufSize: 16777216 # Max buffer size to flush for a single segment.
deleteBufBytes: 67108864 # Max buffer size to flush del for a single channel
syncPeriod: 600 # The period to sync segments if buffer is not empty.
# can specify ip for example
# ip: 127.0.0.1
ip: # if not specify address, will use the first unicastable address as local ip
port: 21124
grpc:
serverMaxSendSize: 536870912

View File

@ -49,6 +49,14 @@ func CheckGrpcReady(ctx context.Context, targetCh chan error) {
}
}
// GetIP return the ip address
func GetIP(ip string) string {
if len(ip) == 0 {
return GetLocalIP()
}
return ip
}
// GetLocalIP return the local ip address
func GetLocalIP() string {
addrs, err := net.InterfaceAddrs()

View File

@ -55,6 +55,14 @@ func Test_GetLocalIP(t *testing.T) {
assert.NotZero(t, len(ip))
}
func Test_GetIP(t *testing.T) {
ip := GetIP("")
assert.NotNil(t, ip)
assert.NotZero(t, len(ip))
ip = GetIP("127.0.0")
assert.Equal(t, ip, "127.0.0")
}
func Test_ParseIndexParamsMap(t *testing.T) {
num := 10
keys := make([]string, 0)

View File

@ -67,7 +67,14 @@ type grpcConfig struct {
func (p *grpcConfig) init(domain string, base *BaseTable) {
p.Domain = domain
p.IP = funcutil.GetLocalIP()
ipItem := ParamItem{
Key: p.Domain + ".ip",
Version: "2.3.3",
DefaultValue: "",
Export: true,
}
ipItem.Init(base.mgr)
p.IP = funcutil.GetIP(ipItem.GetValue())
p.Port = ParamItem{
Key: p.Domain + ".port",