谷粒商城将nacos放进虚拟机的docker管理
服务注册不进去虚拟机的nacos:
仔细看报错,依旧注册到localhost:8848里面去,
所以盲猜是yml文件的问题,果然,服务名要写在注册中心的后面,是配置启动的问题。

1.4.2的centos7的nacos版本,搞来了2.2.6.RELEAES版本来对应,依旧会是这个报错,所以修改yml文件即可:

原来的application.yml:

# 数据库的连接信息
spring:
  application:
    name: mall-member
  datasource:
    username: root
    password: root
    url: jdbc:mysql://192.168.1.129:3306/mall-ums
    driver-class-name: com.mysql.cj.jdbc.Driver

    cloud:
      nacos:
        discovery:
          server-addr: 192.168.1.129:8848
      inetutils:
        ignored-interfaces: 'VMware Virtual Ethernet Adapter for VMnet1,VMware Virtual Ethernet Adapter for VMnet8'

mybatis-plus:
  mapper-locations: classpath*:/mapper/**/*.xml
  global-config:
    db-config:
      id-type: auto #  主键自增

server:
  port: 8020

修改后的yml文件:

# 数据库的连接信息
spring:
  datasource:
    username: root
    password: root
    url: jdbc:mysql://192.168.1.129:3306/mall-pms
    driver-class-name: com.mysql.cj.jdbc.Driver
  cloud:
      nacos:
        discovery:
          server-addr: 192.168.1.129:8848
  application:
    name: mall-product

mybatis-plus:
  mapper-locations: classpath*:/mapper/**/*.xml
  global-config:
    db-config:
      id-type: auto #  主键自增

server:
  port: 8040
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐