其他分享
首页 > 其他分享> > |NO.Z.00347|——————————|^^ 报错 ^^|——|KuberNetes&运维.V64|---------------------------------------------

|NO.Z.00347|——————————|^^ 报错 ^^|——|KuberNetes&运维.V64|---------------------------------------------

作者:互联网



[CloudNative:KuberNetes&运维.V64]                                                                      [Applications.KuberNetes][|DevOps|k8s|k8s运维|**3节点.V1**|Micrometer|Prometheus监控JVM|服务发现|]








附录一:服务发现:编译打包失败
### --- 编译打包失败:

~~~     使用spring-cloud-user这个项目当做服务发现检测服务发现应用;
~~~     通过euraka的console自动发现,监控该JVM项目
### --- 在启动一个容器;运行spring-cloud-user项目

[root@k8s-master01 spring-cloud-demo2]# docker run -ti --rm -v /opt/m2:/root/.m2 -v `pwd`:/opt/ -p 28080:8080 maven:3.5.3 bash
~~~     # 修改配置一:添加JVM监控

root@9e3a56c9868e:/# cd /opt/spring-cloud-user/
root@9e3a56c9868e:/opt/spring-cloud-user#  vim pom.xml    
        </dependency>                  # 此行下添加如下内容
        <!-- Micrometer Prometheus registry  -->
        <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
          </dependency>
         <dependency>
                <groupId>io.micrometer</groupId>
                 <artifactId>micrometer-core</artifactId>
         </dependency>
         <dependency>
                <groupId>io.micrometer</groupId>
                <artifactId>micrometer-registry-prometheus</artifactId>
         </dependency>
        <!-- finished -->

        <dependency>                    # 此行上添加如上内容
~~~     # 修改配置二:打开端口

root@9e3a56c9868e:/opt/spring-cloud-user# vim src/main/resources/application.yml  
server:
  port: 8080                                         # 端口更改为8080
 
eureka:
  client:
    serviceUrl:
      defaultZone: http://192.168.1.11:18761/eureka/ # eureka模拟的是一个其它的应用,所以不能写入localhost,写入宿主机地址即可,这样就可以注册到eureka中
 
spring:
  application:
    name: cloud-user
  profiles:
    active: peer2                                    # 此行下添加如下参数

management:
  endpoints:
    web:
      exposure:
        include: '*'
    shutdown:
      enable: false
  metrics:
    tags:
      application: "${spring.application.name}"      # 添加此内容
### --- 编译spring-cloud-user

root@9e3a56c9868e:/opt/spring-cloud-user# mvn clean package -DskipTests








===============================END===============================


Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart                                                                                                                                                   ——W.S.Landor



来自为知笔记(Wiz)

标签:opt,v06,KuberNetes,spring,application,报错,user,root,cloud
来源: https://www.cnblogs.com/yanqivip/p/16086442.html