diff --git a/deploy/config/obs-zh.example.toml b/deploy/config/obs-zh.example.toml index 0474391bd..0ada41aff 100644 --- a/deploy/config/obs-zh.example.toml +++ b/deploy/config/obs-zh.example.toml @@ -5,7 +5,7 @@ sample_ratio = 2.0 # 采样率,表示每 2 条数据采样 1 meter_interval = 30 # 指标收集间隔,单位为秒 service_name = "rustfs" # 服务名称,用于标识当前服务 service_version = "0.1.0" # 服务版本号 -environments = "develop" # 运行环境,如开发环境 (develop) +environment = "develop" # 运行环境,如开发环境 (develop) logger_level = "debug" # 日志级别,可选 debug/info/warn/error 等 local_logging_enabled = true # 是否启用本地 stdout 日志记录,true 表示启用,false 表示禁用 diff --git a/ecstore/src/store.rs b/ecstore/src/store.rs index fd89bd00d..43f8ef9d1 100644 --- a/ecstore/src/store.rs +++ b/ecstore/src/store.rs @@ -53,6 +53,7 @@ use madmin::heal_commands::HealResultItem; use rand::Rng; use s3s::dto::{BucketVersioningStatus, ObjectLockConfiguration, ObjectLockEnabled, VersioningConfiguration}; use std::cmp::Ordering; +use std::net::SocketAddr; use std::process::exit; use std::slice::Iter; use std::time::SystemTime; @@ -100,7 +101,7 @@ pub struct ECStore { impl ECStore { #[allow(clippy::new_ret_no_self)] #[tracing::instrument(level = "debug", skip(endpoint_pools))] - pub async fn new(_address: String, endpoint_pools: EndpointServerPools) -> Result> { + pub async fn new(address: SocketAddr, endpoint_pools: EndpointServerPools) -> Result> { // let layouts = DisksLayout::from_volumes(endpoints.as_slice())?; let mut deployment_id = None; @@ -113,13 +114,17 @@ impl ECStore { let first_is_local = endpoint_pools.first_local(); let mut local_disks = Vec::new(); - - init_local_peer( - &endpoint_pools, - &GLOBAL_Rustfs_Host.read().await.to_string(), - &GLOBAL_Rustfs_Port.read().await.to_string(), - ) - .await; + info!("ECStore new address: {}", address.to_string()); + let mut host = address.ip().to_string(); + if host.is_empty() { + host = GLOBAL_Rustfs_Host.read().await.to_string() + } + let mut port = address.port().to_string(); + if port.is_empty() { + port = GLOBAL_Rustfs_Port.read().await.to_string() + } + info!("ECStore new host: {}, port: {}", host, port); + init_local_peer(&endpoint_pools, &host, &port).await; // debug!("endpoint_pools: {:?}", endpoint_pools); diff --git a/rustfs/src/main.rs b/rustfs/src/main.rs index 5629324ec..01d500ed8 100644 --- a/rustfs/src/main.rs +++ b/rustfs/src/main.rs @@ -497,7 +497,7 @@ async fn run(opt: config::Opt) -> Result<()> { }); // init store - let store = ECStore::new(server_address.clone(), endpoint_pools.clone()) + let store = ECStore::new(server_addr.clone(), endpoint_pools.clone()) .await .map_err(|err| { error!("ECStore::new {:?}", &err);