feat: frontend internal grpc port (#6784)

* feat: frontend internal grpc port

Signed-off-by: discord9 <discord9@163.com>

* fix: grpc server naming

Signed-off-by: discord9 <discord9@163.com>

* test: sqlness test fix

Signed-off-by: discord9 <discord9@163.com>

* fix: internal not use process manager

Signed-off-by: discord9 <discord9@163.com>

* test: test integration port alloc

Signed-off-by: discord9 <discord9@163.com>

* feat: skip auth for internal grpc

Signed-off-by: discord9 <discord9@163.com>

* test: is distributed

Signed-off-by: discord9 <discord9@163.com>

* what:

Signed-off-by: discord9 <discord9@163.com>

---------

Signed-off-by: discord9 <discord9@163.com>
Co-authored-by: Ning Sun <sunning@greptime.com>
This commit is contained in:
discord9
2025-08-22 10:46:35 +08:00
committed by GitHub
parent cdc168e753
commit eaceae4c91
8 changed files with 111 additions and 15 deletions

View File

@@ -60,6 +60,7 @@ pub enum ServerMode {
Frontend {
http_addr: String,
rpc_bind_addr: String,
internal_rpc_bind_addr: String,
mysql_addr: String,
postgres_addr: String,
metasrv_addr: String,
@@ -100,6 +101,8 @@ struct ConfigContext {
metasrv_addr: String,
// for frontend and standalone
grpc_addr: String,
// for frontend in distributed mode
internal_grpc_addr: String,
// for standalone
mysql_addr: String,
// for standalone
@@ -124,12 +127,14 @@ impl ServerMode {
pub fn random_frontend(metasrv_port: u16) -> Self {
let http_port = get_unique_random_port();
let rpc_port = get_unique_random_port();
let internal_rpc_port = get_unique_random_port();
let mysql_port = get_unique_random_port();
let postgres_port = get_unique_random_port();
ServerMode::Frontend {
http_addr: format!("127.0.0.1:{http_port}"),
rpc_bind_addr: format!("127.0.0.1:{rpc_port}"),
internal_rpc_bind_addr: format!("127.0.0.1:{internal_rpc_port}"),
mysql_addr: format!("127.0.0.1:{mysql_port}"),
postgres_addr: format!("127.0.0.1:{postgres_port}"),
metasrv_addr: format!("127.0.0.1:{metasrv_port}"),
@@ -324,6 +329,15 @@ impl ServerMode {
instance_id: id,
metasrv_addr,
grpc_addr,
internal_grpc_addr: if let ServerMode::Frontend {
internal_rpc_bind_addr,
..
} = self
{
internal_rpc_bind_addr.clone()
} else {
String::new()
},
mysql_addr,
postgres_addr,
};
@@ -381,6 +395,7 @@ impl ServerMode {
ServerMode::Frontend {
http_addr,
rpc_bind_addr,
internal_rpc_bind_addr: _,
mysql_addr,
postgres_addr,
metasrv_addr,