SpringCloud-Eureka-服务对应的实例的名字及ip地址配置显示

一、修改支付模块8001、8002的yml文件

(1)8001

在这里插入图片描述

server:
  port: 8001

spring:
  application:
    name: cloud-payment-service
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: org.gjt.mm.MysqL.Driver
    url: jdbc:MysqL://localhost:3306/springcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
    username: root
    password: wsh666

mybatis:
  mapperLocations: classpath:mapper/*.xml
  type-aliases-package: com.wsh.springcloud.entity

eureka:
  client:
#    客户端设置为true
    register-with-eureka: true
#    客户端设置为true
    fetch-registry: true
    service-url:
#      defaultZone: http://localhost:7001/eureka
      defaultZone: http://eureka1.com:7001/eureka, http://eureka2.com:7002/eureka
  instance:
    instance-id: payment8001
    prefer-ip-address: true

(2)8002

在这里插入图片描述

server:
  port: 8002

spring:
  application:
    name: cloud-payment-service
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: org.gjt.mm.MysqL.Driver
    url: jdbc:MysqL://localhost:3306/springcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
    username: root
    password: wsh666

mybatis:
  mapperLocations: classpath:mapper/*.xml
  type-aliases-package: com.wsh.springcloud.entity

eureka:
  client:
    #    客户端设置为true
    register-with-eureka: true
    #    客户端设置为true
    fetch-registry: true
    service-url:
      #      defaultZone: http://localhost:7001/eureka
      defaultZone: http://eureka1.com:7001/eureka, http://eureka2.com:7002/eureka
  instance:
    instance-id: payment8002
    prefer-ip-address: true

(3)测试

在这里插入图片描述


在这里插入图片描述


在这里插入图片描述

相关文章

显卡天梯图2024最新版,显卡是电脑进行图形处理的重要设备,...
初始化电脑时出现问题怎么办,可以使用win系统的安装介质,连...
todesk远程开机怎么设置,两台电脑要在同一局域网内,然后需...
油猴谷歌插件怎么安装,可以通过谷歌应用商店进行安装,需要...
虚拟内存这个名词想必很多人都听说过,我们在使用电脑的时候...
win11本地账户怎么改名?win11很多操作都变了样,用户如果想要...