diff --git a/config/config.md b/config/config.md index de44c6de89..6c2104a953 100644 --- a/config/config.md +++ b/config/config.md @@ -245,6 +245,16 @@ | `grpc.tls.cert_path` | String | Unset | Certificate file path. | | `grpc.tls.key_path` | String | Unset | Private key file path. | | `grpc.tls.watch` | Bool | `false` | Watch for Certificate and key file change and auto reload.
For now, gRPC tls config does not support auto reload. | +| `internal_grpc` | -- | -- | The internal gRPC server options. Internal gRPC port for nodes inside cluster to access frontend. | +| `internal_grpc.bind_addr` | String | `127.0.0.1:4010` | The address to bind the gRPC server. | +| `internal_grpc.server_addr` | String | `127.0.0.1:4010` | The address advertised to the metasrv, and used for connections from outside the host.
If left empty or unset, the server will automatically use the IP address of the first network interface
on the host, with the same port number as the one specified in `grpc.bind_addr`. | +| `internal_grpc.runtime_size` | Integer | `8` | The number of server worker threads. | +| `internal_grpc.flight_compression` | String | `arrow_ipc` | Compression mode for frontend side Arrow IPC service. Available options:
- `none`: disable all compression
- `transport`: only enable gRPC transport compression (zstd)
- `arrow_ipc`: only enable Arrow IPC compression (lz4)
- `all`: enable all compression.
Default to `none` | +| `internal_grpc.tls` | -- | -- | internal gRPC server TLS options, see `mysql.tls` section. | +| `internal_grpc.tls.mode` | String | `disable` | TLS mode. | +| `internal_grpc.tls.cert_path` | String | Unset | Certificate file path. | +| `internal_grpc.tls.key_path` | String | Unset | Private key file path. | +| `internal_grpc.tls.watch` | Bool | `false` | Watch for Certificate and key file change and auto reload.
For now, gRPC tls config does not support auto reload. | | `mysql` | -- | -- | MySQL server options. | | `mysql.enable` | Bool | `true` | Whether to enable. | | `mysql.addr` | String | `127.0.0.1:4002` | The addr to bind the MySQL server. | diff --git a/config/frontend.example.toml b/config/frontend.example.toml index b2b1c598b0..933e82e431 100644 --- a/config/frontend.example.toml +++ b/config/frontend.example.toml @@ -79,6 +79,42 @@ key_path = "" ## For now, gRPC tls config does not support auto reload. watch = false +## The internal gRPC server options. Internal gRPC port for nodes inside cluster to access frontend. +[internal_grpc] +## The address to bind the gRPC server. +bind_addr = "127.0.0.1:4010" +## The address advertised to the metasrv, and used for connections from outside the host. +## If left empty or unset, the server will automatically use the IP address of the first network interface +## on the host, with the same port number as the one specified in `grpc.bind_addr`. +server_addr = "127.0.0.1:4010" +## The number of server worker threads. +runtime_size = 8 +## Compression mode for frontend side Arrow IPC service. Available options: +## - `none`: disable all compression +## - `transport`: only enable gRPC transport compression (zstd) +## - `arrow_ipc`: only enable Arrow IPC compression (lz4) +## - `all`: enable all compression. +## Default to `none` +flight_compression = "arrow_ipc" + +## internal gRPC server TLS options, see `mysql.tls` section. +[internal_grpc.tls] +## TLS mode. +mode = "disable" + +## Certificate file path. +## @toml2docs:none-default +cert_path = "" + +## Private key file path. +## @toml2docs:none-default +key_path = "" + +## Watch for Certificate and key file change and auto reload. +## For now, gRPC tls config does not support auto reload. +watch = false + + ## MySQL server options. [mysql] ## Whether to enable. diff --git a/src/cmd/tests/load_config_test.rs b/src/cmd/tests/load_config_test.rs index 55a457317a..e8b85b7c2a 100644 --- a/src/cmd/tests/load_config_test.rs +++ b/src/cmd/tests/load_config_test.rs @@ -146,6 +146,7 @@ fn test_load_frontend_example_config() { grpc: GrpcOptions::default() .with_bind_addr("127.0.0.1:4001") .with_server_addr("127.0.0.1:4001"), + internal_grpc: Some(GrpcOptions::internal_default()), http: HttpOptions { cors_allowed_origins: vec!["https://example.com".to_string()], ..Default::default() diff --git a/src/servers/src/grpc.rs b/src/servers/src/grpc.rs index 18254e9ec7..4205b7debc 100644 --- a/src/servers/src/grpc.rs +++ b/src/servers/src/grpc.rs @@ -56,6 +56,7 @@ use crate::tls::TlsOption; type TonicResult = std::result::Result; #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[serde(default)] pub struct GrpcOptions { /// The address to bind the gRPC server. pub bind_addr: String, @@ -141,7 +142,7 @@ impl GrpcOptions { Self { bind_addr: format!("127.0.0.1:{}", DEFAULT_INTERNAL_GRPC_ADDR_PORT), // If hostname is not set, the server will use the local ip address as the hostname. - server_addr: String::new(), + server_addr: format!("127.0.0.1:{}", DEFAULT_INTERNAL_GRPC_ADDR_PORT), max_recv_message_size: DEFAULT_MAX_GRPC_RECV_MESSAGE_SIZE, max_send_message_size: DEFAULT_MAX_GRPC_SEND_MESSAGE_SIZE, flight_compression: FlightCompression::ArrowIpc,