diff --git a/console/src/main/resources/application.properties b/console/src/main/resources/application.properties index 96e24c904..bce0d38c8 100644 --- a/console/src/main/resources/application.properties +++ b/console/src/main/resources/application.properties @@ -29,7 +29,7 @@ server.port=8848 #*************** Config Module Related Configurations ***************# -### If user MySQL as datasource: +### If use MySQL as datasource: # spring.datasource.platform=mysql ### Count of DB: @@ -37,8 +37,8 @@ server.port=8848 ### Connect URL of DB: # db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC -# db.user=root -# db.password=1017 +# db.user=nacos +# db.password=nacos #*************** Naming Module Related Configurations ***************# @@ -154,6 +154,12 @@ nacos.istio.mcp.server.enabled=false ## for AddressServerMemberLookup # Maximum number of retries to query the address server upon initialization # nacos.core.address-server.retry=5 +## Server domain name address of [address-server] mode +# address.server.domain=jmenv.tbsite.net +## Server port of [address-server] mode +# address.server.port=8080 +## Request address of [address-server] mode +# address.server.url=/nacos/serverlist #*************** JRaft Related Configurations ***************# diff --git a/core/src/main/java/com/alibaba/nacos/core/cluster/lookup/AddressServerMemberLookup.java b/core/src/main/java/com/alibaba/nacos/core/cluster/lookup/AddressServerMemberLookup.java index 6028d3337..f87a98208 100644 --- a/core/src/main/java/com/alibaba/nacos/core/cluster/lookup/AddressServerMemberLookup.java +++ b/core/src/main/java/com/alibaba/nacos/core/cluster/lookup/AddressServerMemberLookup.java @@ -79,17 +79,22 @@ public class AddressServerMemberLookup extends AbstractMemberLookup { private void initAddressSys() { String envDomainName = System.getenv("address_server_domain"); if (StringUtils.isBlank(envDomainName)) { - domainName = System.getProperty("address.server.domain", "jmenv.tbsite.net"); + domainName = ApplicationUtils.getProperty("address.server.domain", "jmenv.tbsite.net"); } else { domainName = envDomainName; } String envAddressPort = System.getenv("address_server_port"); if (StringUtils.isBlank(envAddressPort)) { - addressPort = System.getProperty("address.server.port", "8080"); + addressPort = ApplicationUtils.getProperty("address.server.port", "8080"); } else { addressPort = envAddressPort; } - addressUrl = System.getProperty("address.server.url", ApplicationUtils.getContextPath() + "/" + "serverlist"); + String envAddressUrl = System.getenv("address_server_url"); + if (StringUtils.isBlank(envAddressUrl)) { + addressUrl = ApplicationUtils.getProperty("address.server.url", ApplicationUtils.getContextPath() + "/" + "serverlist"); + } else { + addressUrl = envAddressUrl; + } addressServerUrl = "http://" + domainName + ":" + addressPort + addressUrl; envIdUrl = "http://" + domainName + ":" + addressPort + "/env"; diff --git a/distribution/conf/application.properties b/distribution/conf/application.properties index cc660bdd4..bce0d38c8 100644 --- a/distribution/conf/application.properties +++ b/distribution/conf/application.properties @@ -98,7 +98,7 @@ management.metrics.export.influx.enabled=false server.tomcat.accesslog.enabled=true ### The access log pattern: -server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i +server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i ### The directory of access log: server.tomcat.basedir= @@ -148,15 +148,18 @@ nacos.istio.mcp.server.enabled=false ### MemberLookup ### Addressing pattern category, If set, the priority is highest -# nacos.core.member.lookup.type=[file,address-server,discovery] +# nacos.core.member.lookup.type=[file,address-server] ## Set the cluster list with a configuration file or command-line argument # nacos.member.list=192.168.16.101:8847?raft_port=8807,192.168.16.101?raft_port=8808,192.168.16.101:8849?raft_port=8809 -## for DiscoveryMemberLookup -# If you want to use cluster node self-discovery, turn this parameter on -# nacos.member.discovery=false ## for AddressServerMemberLookup # Maximum number of retries to query the address server upon initialization # nacos.core.address-server.retry=5 +## Server domain name address of [address-server] mode +# address.server.domain=jmenv.tbsite.net +## Server port of [address-server] mode +# address.server.port=8080 +## Request address of [address-server] mode +# address.server.url=/nacos/serverlist #*************** JRaft Related Configurations ***************# @@ -164,13 +167,11 @@ nacos.istio.mcp.server.enabled=false # nacos.core.protocol.raft.data.election_timeout_ms=5000 ### Sets the amount of time the Raft snapshot will execute periodically, default is 30 minute # nacos.core.protocol.raft.data.snapshot_interval_secs=30 -### Requested retries, default value is 1 -# nacos.core.protocol.raft.data.request_failoverRetries=1 ### raft internal worker threads # nacos.core.protocol.raft.data.core_thread_num=8 ### Number of threads required for raft business request processing # nacos.core.protocol.raft.data.cli_service_thread_num=4 -### raft linear read strategy, defaults to index +### raft linear read strategy. Safe linear reads are used by default, that is, the Leader tenure is confirmed by heartbeat # nacos.core.protocol.raft.data.read_index_type=ReadOnlySafe ### rpc request timeout, default 5 seconds # nacos.core.protocol.raft.data.rpc_request_timeout_ms=5000 diff --git a/distribution/conf/application.properties.example b/distribution/conf/application.properties.example index 56642f0ca..bce0d38c8 100644 --- a/distribution/conf/application.properties.example +++ b/distribution/conf/application.properties.example @@ -29,7 +29,7 @@ server.port=8848 #*************** Config Module Related Configurations ***************# -### If user MySQL as datasource: +### If use MySQL as datasource: # spring.datasource.platform=mysql ### Count of DB: @@ -98,7 +98,7 @@ management.metrics.export.influx.enabled=false server.tomcat.accesslog.enabled=true ### The access log pattern: -server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i +server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i ### The directory of access log: server.tomcat.basedir= @@ -148,15 +148,18 @@ nacos.istio.mcp.server.enabled=false ### MemberLookup ### Addressing pattern category, If set, the priority is highest -# nacos.core.member.lookup.type=[file,address-server,discovery] +# nacos.core.member.lookup.type=[file,address-server] ## Set the cluster list with a configuration file or command-line argument # nacos.member.list=192.168.16.101:8847?raft_port=8807,192.168.16.101?raft_port=8808,192.168.16.101:8849?raft_port=8809 -## for DiscoveryMemberLookup -# If you want to use cluster node self-discovery, turn this parameter on -# nacos.member.discovery=false ## for AddressServerMemberLookup # Maximum number of retries to query the address server upon initialization # nacos.core.address-server.retry=5 +## Server domain name address of [address-server] mode +# address.server.domain=jmenv.tbsite.net +## Server port of [address-server] mode +# address.server.port=8080 +## Request address of [address-server] mode +# address.server.url=/nacos/serverlist #*************** JRaft Related Configurations ***************# @@ -164,13 +167,11 @@ nacos.istio.mcp.server.enabled=false # nacos.core.protocol.raft.data.election_timeout_ms=5000 ### Sets the amount of time the Raft snapshot will execute periodically, default is 30 minute # nacos.core.protocol.raft.data.snapshot_interval_secs=30 -### Requested retries, default value is 1 -# nacos.core.protocol.raft.data.request_failoverRetries=1 ### raft internal worker threads # nacos.core.protocol.raft.data.core_thread_num=8 ### Number of threads required for raft business request processing # nacos.core.protocol.raft.data.cli_service_thread_num=4 -### raft linear read strategy, defaults to index +### raft linear read strategy. Safe linear reads are used by default, that is, the Leader tenure is confirmed by heartbeat # nacos.core.protocol.raft.data.read_index_type=ReadOnlySafe ### rpc request timeout, default 5 seconds # nacos.core.protocol.raft.data.rpc_request_timeout_ms=5000