博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Nacos Discovery Starter Configurations
阅读量:2155 次
发布时间:2019-05-01

本文共 3415 字,大约阅读时间需要 11 分钟。

 

 

The following shows the other configurations of the starter of Nacos Discovery:

Configuration

Key

Default Value

Description

Server address

spring.cloud.nacos.discovery.server-addr

 

IP and port of the Nacos Server listener

Service name

spring.cloud.nacos.discovery.service

${spring.application.name}

Name the current service

Weight

spring.cloud.nacos.discovery.weight

1

Value range: 1 to 100. The bigger the value, the greater the weight

Network card name

spring.cloud.nacos.discovery.network-interface

 

If the IP address is not specified, the registered IP address is the IP address of the network card. If this is not specified either, the IP address of the first network card will be used by default.

Registered IP address

spring.cloud.nacos.discovery.ip

 

Highest priority

Registered port

spring.cloud.nacos.discovery.port

-1

Will be detected automatically by default. Do not need to be configured.

Namespace

spring.cloud.nacos.discovery.namespace

 

A typical scenario is to isolate the service registration for different environment, such as resource (configurations, services etc.) isolation between testing and production environment

AccessKey

spring.cloud.nacos.discovery.access-key

 

Alibaba Cloud account accesskey

SecretKey

spring.cloud.nacos.discovery.secret-key

 

Alibaba Cloud account secretkey

Metadata

spring.cloud.nacos.discovery.metadata

 

You can define some of the metadata for your services in the Map format

Log file name

spring.cloud.nacos.discovery.log-name

   

Cluster Name

spring.cloud.nacos.discovery.cluster-name

DEFAULT

Cluster name of Nacos

Endpoint

spring.cloud.nacos.discovery.endpoint

 

The domain name of a certain service in a specific region. You can retrieve the server address dynamically with this domain name

Integrate Ribbon or not

ribbon.nacos.enabled

true

Set to true in most cases

Enable Nacos Watch

spring.cloud.nacos.discovery.watch.enabled

true

set to false to close watch

 

NacosDiscoveryProperties

@ConfigurationProperties("spring.cloud.nacos.discovery")public class NacosDiscoveryProperties {}

 

处理ip逻辑

@PostConstructpublic void init() throws SocketException {	metadata.put(PreservedMetadataKeys.REGISTER_SOURCE, "SPRING_CLOUD");	if (secure) {		metadata.put("secure", "true");	}	serverAddr = Objects.toString(serverAddr, "");	if (serverAddr.endsWith("/")) {		serverAddr = serverAddr.substring(0, serverAddr.length() - 1);	}	endpoint = Objects.toString(endpoint, "");	namespace = Objects.toString(namespace, "");	logName = Objects.toString(logName, "");	if (StringUtils.isEmpty(ip)) {		// traversing network interfaces if didn't specify a interface		if (StringUtils.isEmpty(networkInterface)) {			ip = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();		}		else {			NetworkInterface netInterface = NetworkInterface					.getByName(networkInterface);			if (null == netInterface) {				throw new IllegalArgumentException(						"no such interface " + networkInterface);			}			Enumeration
inetAddress = netInterface.getInetAddresses(); while (inetAddress.hasMoreElements()) { InetAddress currentAddress = inetAddress.nextElement(); if (currentAddress instanceof Inet4Address && !currentAddress.isLoopbackAddress()) { ip = currentAddress.getHostAddress(); break; } } if (StringUtils.isEmpty(ip)) { throw new RuntimeException("cannot find available ip from" + " network interface " + networkInterface); } } } this.overrideFromEnv(environment);}

 

 

 

 

 

 

 

 

 

 

转载地址:http://zkawb.baihongyu.com/

你可能感兴趣的文章
[Jmeter]jmeter之脚本录制与回放,优化(windows下的jmeter)
查看>>
Jmeter之正则
查看>>
【JMeter】1.9上考试jmeter测试调试
查看>>
【虫师】【selenium】参数化
查看>>
【Python练习】文件引用用户名密码登录系统
查看>>
学习网站汇总
查看>>
【Python】用Python打开csv和xml文件
查看>>
【Loadrunner】性能测试报告实战
查看>>
【自动化测试】自动化测试需要了解的的一些事情。
查看>>
【selenium】selenium ide的安装过程
查看>>
【手机自动化测试】monkey测试
查看>>
【英语】软件开发常用英语词汇
查看>>
Fiddler 抓包工具总结
查看>>
【雅思】雅思需要购买和准备的学习资料
查看>>
【雅思】雅思写作作业(1)
查看>>
【雅思】【大作文】【审题作业】关于同不同意的审题作业(重点)
查看>>
【Loadrunner】通过loadrunner录制时候有事件但是白页无法出来登录页怎么办?
查看>>
【English】【托业】【四六级】写译高频词汇
查看>>
【托业】【新东方全真模拟】01~02-----P5~6
查看>>
【托业】【新东方全真模拟】03~04-----P5~6
查看>>