java - 如何将尤里卡客户端指向部署在不同 IP 地址中的尤里卡服务器,而不是在本地主机中
问题描述
我有一个问题,我有一个 Spring Boot eureka 服务器在 URL http://192.168.3.177:8761/eureka的服务器上运行。现在我有 eureka 客户端(一些服务)在其他 IP 地址上运行,即192.168.1.123。但是现在的问题是当 eureka 客户端启动它时,它将 eureka 服务器 IP 作为localhost:8761/eureka并给出连接被拒绝异常。如果我在运行 eureka 服务器的同一台服务器上运行 eureka 客户端应用程序,它会按预期工作。
以下是我在 application.properties 中的 eureka 客户端配置
eureka.client.service-url.default-zone=http://192.168.3.174:8761/eureka
我的尤里卡客户端应用程序
@SpringBootApplication
@EnableFeignClients("com.samsan.currencyconversionservice")
@EnableDiscoveryClient
public class CurrencyConversionServiceApplication {
public static void main(String[] args) {
SpringApplication.run(CurrencyConversionServiceApplication.class, args);
}
}
我正在使用功能区连接到尤里卡服务器以获取服务
@Component
@FeignClient(name="currency-exchange-service")
@RibbonClient(name="currency-exchange-service")
public interface CurrencyExchangeService {
@GetMapping("/currency-exchange/from/{from}/to/{to}")
public CurrencyConversionBean getExchangeValue(@PathVariable("from") String from, @PathVariable("to") String to);
}
请帮我解决这个问题?
解决方案
推荐阅读
- c++ - 如何将数组中的连续数字设置为0 C++
- maven - 如何正确导入我更改并重新构建到现有项目中的 Maven 依赖项?
- c++ - 如果唯一的输入是一个字符串并且创建了一个额外的字符串,那么函数的空间复杂度是 O(n) 吗?
- php - Extracting data from protect TXT file and turning it into a table via PHP
- javascript - 当我旋转它时,如何将图像保持在模态体内部或内部?
- reactjs - 将带有参数的 onClick 分配给地图函数 React 内部的组件
- neuron-simulator - 在神经元上没有这样的文件或目录?
- reactjs - reactJS中不同用户的不同视图
- python - 如何将 .docx 文件保存到 S3 中?
- python - 尝试将小数点添加到浮点数时出现键错误