报告服务

guochao ae59dbe7ac 修改traceId以及获取jsonObject 4 lat temu
.idea ae59dbe7ac 修改traceId以及获取jsonObject 4 lat temu
.mvn 63fc09dd14 first 5 lat temu
src ae59dbe7ac 修改traceId以及获取jsonObject 4 lat temu
target ae59dbe7ac 修改traceId以及获取jsonObject 4 lat temu
.DS_Store 63fc09dd14 first 5 lat temu
HELP.md 63fc09dd14 first 5 lat temu
README.md 63fc09dd14 first 5 lat temu
demo.iml 63fc09dd14 first 5 lat temu
gateway-demo.iml 7b0ce04862 修改移动应用测试的类 4 lat temu
mooctestOrgBackend 7b0ce04862 修改移动应用测试的类 4 lat temu
mvnw 63fc09dd14 first 5 lat temu
mvnw.cmd 63fc09dd14 first 5 lat temu
pom.xml 7b0ce04862 修改移动应用测试的类 4 lat temu

README.md

nacos启动

启动说明:https://github.com/alibaba/nacos

Step 1: Download the binary package

1. 下载地址: https://github.com/alibaba/nacos/releases/download/1.1.4/nacos-server-1.1.4.zip
2. 解压:unzip nacos-server-1.0.0.zip
3. 进入bin目录:cd nacos/bin 

Step 2: Start Server

sh startup.sh -m standalone(On the Linux/Unix/Mac platform)
OR
cmd startup.cmd -m standalone(cmd startup.cmd -m standalone)

Step 3: Access Server

http://127.0.0.1:8848/nacos
用户名和密码均为:nacos

服务配置

服务模板git clone 链接:git@github.com:guo00guo/nacos-registry-template.git

  1. 需要的依赖

    <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-gateway</artifactId>
    </dependency>
    
    <!-- Nacos Client -->
    <dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
    </dependency>
    <!-- actuator -->
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    
  2. 新建application.yml

    sleep: 0
    
    # 配置输出日志
    logging:
    level:
    org.springframework.cloud.gateway: TRACE
    org.springframework.http.server.reactive: DEBUG
    org.springframework.web.reactive: DEBUG
    reactor.ipc.netty: DEBUG
    
    #开启端点
    management:
    endpoints:
    web:
      exposure:
        include: '*'
    security:
    enabled: false
    
  3. bootstrap.yaml

    server:
    port: 8082
    spring:
    application:
        #注册到nacos时的服务名称
        name: nacos-registry-template 
    cloud:
        nacos:
            discovery:
                # 指定nacos server的地址
                server-addr: 127.0.0.1:8848
    
    # actuator相关配置
    management:
    endpoints:
        web:
            exposure:
                # 暴露所有监控端点
                include: '*'
    endpoint:
        health:
            # 总是显示健康检测详情
            show-details: always
    
  4. 启动服务控制台显示

    2019-11-11 14:48:02.167  INFO 31299 --- [           main] c.a.c.n.registry.NacosServiceRegistry    : nacos registry, nacos-registry-template 10.0.0.38:8082 register finished
    
    
  5. 打开nacos控制台查看是否注册成功

    进入http://127.0.0.1:8848/nacos
    点击左侧“服务管理”---“服务列表”
    若出现刚启动服务的信息则接入成功