SpringCloud简单搭建(Erueka、Feign、Gateway)

2023-11-20

父工程:SpringCloud

请添加图片描述
配置文件 pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <modules>
        <module>SpringCloud_provider</module>
        <module>SpringCloud_consumer</module>
        <module>SpringCloud_eureka</module>
        <module>SpringCloud_provider_balance</module>
        <module>SpringCloud_gateway</module>
    </modules>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.6.RELEASE</version>
        <relativePath/>
    </parent>

    <groupId>org.example</groupId>
    <artifactId>SpringCloud</artifactId>
    <version>1.0-SNAPSHOT</version>


    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <packaging>jar</packaging>
    </properties>

    <!--SpringCloud包依赖管理-->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Greenwich.SR1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>

服务注册中心:Erueka

**pom.xml**
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>SpringCloud</artifactId>
        <groupId>org.example</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>SpringCloud_eureka</artifactId>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <packaging>jar</packaging>
    </properties>

    <!--依赖包-->
    <dependencies>
        <!--eureka-server依赖-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

application.yml

server:
  port: 1111

spring:
  application:
    name: SpringCloudeureka #应用名称,会在Eureka中作为服务的id标识(serviceId)

eureka:
  client:
    register-with-eureka: false #是否将自己注册到Eureka中
    fetch-registry: false #是否从eureka中获取服务信息
    service-url:
      defaultZone: http://localhost:1111/eureka #EurekaServer的地址

启动类

开启E

package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

@SpringBootApplication
@EnableEurekaServer //开启Eureka服务
public class EurekaServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(EurekaServerApplication.class,args);
    }
}

服务的提供者:SpringCloud_provider

那个 SpringCloud_provider_balance 也是一样的,唯一不同的是application.yml的server端口号
需要引入 Erueka 的客户端包

配置文件 pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>SpringCloud</artifactId>
        <groupId>org.example</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>SpringCloud_provider</artifactId>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <packaging>jar</packaging>
    </properties>

    <!--依赖包-->
    <dependencies>
        <!--JPA包-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <!--web起步包-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!--eureka-server依赖-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>

        <!--MySQL驱动包-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!--测试包-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.22</version>
        </dependency>

    </dependencies>
</project>

application.yml

server:
  port: 2222
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: 数据库用户名
    password: 数据库密码
    url: jdbc:mysql://localhost:3306/springcloud?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
  application:
    name: SpringCloudprovider #服务的名字,不同的应用,名字不同,如果是集群,名字需要相同
#指定eureka服务地址
eureka:
  client:
    service-url:
      # EurekaServer的地址
      defaultZone: http://localhost:1111/eureka

启动类

package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

@SpringBootApplication
@EnableEurekaClient //开启Eureka客户端发现功能,注册中心只能是Eureka
@EnableDiscoveryClient //开启Eureka客户端发现功能
public class UserProviderApplication {
    public static void main(String[] args) {
        SpringApplication.run(UserProviderApplication.class,args);
    }
}

@EnableEurekaClient 将 Erueka 客户端发现功能配置进启动类
@EnableDiscoveryClient 并开启 Eureka 客户端发现功能

接下来从 dao 到 controller

pojo

package com.example.pojo;

import lombok.Data;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "tb_user")
@Data
public class User {
    //@id 标识该字段对应的是表中的主键
    @Id
    //  @GeneratedValue设置主键的生成策略
    // strategy 指定策略类型: GenerationType.IDENTITY 标识自增
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;//主键id

    //@Column将POJO的属性 映射给数据表的某一个列  name用于指定列的名称,如果是列名和属性名一致可以不写。
    @Column
    private String username;//用户名
    @Column
    private String password;//密码
    @Column
    private String name;//姓名
    @Column
    private Integer age;//年龄
    @Column
    private Integer sex;//性别 1男性,2女性
    @Column
    private Date birthday; //出生日期
    @Column
    private Date created; //创建时间
    @Column
    private Date updated; //更新时间
    @Column
    private String note;//备注
}

Dao

直接继承 JpaRepository,会自动生成 没用Mapper注解是因为没用Mybatis

package com.example.dao;

import com.example.pojo.User;
import org.springframework.data.jpa.repository.JpaRepository;

public interface UserDao extends JpaRepository<User,Integer> {
}

Service
接口

package com.example.service;

import com.example.pojo.User;

public interface UserService {
    User findByUser(Integer id);
}

实现类
@Autowired注入dao

package com.example.service.Impl;

import com.example.dao.UserDao;
import com.example.pojo.User;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User findByUser(Integer id) {
        User user = userDao.findById(id).get();
        return user;
    }
}

Controller

这里用 @RestController 可以自动以 json 格式返回值 如果用 @Controller 则需要搭配
@ResponesBody

package com.example.controller;

import com.example.pojo.User;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/find/{id}")
    public User findById(@PathVariable("id")Integer id){
        return userService.findByUser(id);
    }
}

服务的消费者:SpringCloud_consumer

消费端需要配置服务通信:fegin
熔断器:hystrix
Eureka的客户端包

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>SpringCloud</artifactId>
        <groupId>org.example</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>SpringCloud_consumer</artifactId>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <packaging>jar</packaging>
    </properties>

    <!--依赖包-->
    <dependencies>
        <!--web起步依赖-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!--eureka-server依赖-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>

        <!--熔断器-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
        </dependency>

        <!--配置feign-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
        </dependency>
    </dependencies>

</project>

applicaion.yml

server:
  port: 3333
spring:
  application:
    name: SpringCloucconsumer  #服务名字,不能有下划线
#指定eureka服务地址
eureka:
  client:
    service-url:
      # EurekaServer的地址
      defaultZone: http://localhost:1111/eureka

# 配置熔断策略:
hystrix:
  command:
    default:
      circuitBreaker:
        # 强制打开熔断器 默认false关闭的。测试配置是否生效
        forceOpen: false
        # 触发熔断错误比例阈值,默认值50%
        errorThresholdPercentage: 50
        # 熔断后休眠时长,默认值5秒
        sleepWindowInMilliseconds: 10000
        # 熔断触发最小请求次数,默认值是20
        requestVolumeThreshold: 10
      execution:
        isolation:
          thread:
            # 熔断超时设置,默认为1秒
            timeoutInMilliseconds: 2000

启动类

要注册进Erueka:@EnableEurekaClient
要发现:@EnableDiscoveryClient
要熔断:@EnableCircuitBreaker
要通信:@EnableFeignClients
因为Fdign集成l了Ribbon,可以直接在RestTemple上写 @LoadBalanced开启负载均衡

package com.example;

import com.netflix.discovery.DiscoveryClient;
import com.netflix.ribbon.proxy.annotation.Hystrix;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient //开启Eureka客户端发现功能
@EnableCircuitBreaker
@EnableFeignClients
public class UserConsumerApplication {
    public static void main(String[] args) {
        SpringApplication.run(UserConsumerApplication.class);
    }

    @Bean
    @LoadBalanced
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}

消费端要有和提供方相同的 pojo 和 一个Controller

pojo

package com.example.pojo;

import java.util.Date;

public class User {
    private Integer id;//主键id
    private String username;//用户名
    private String password;//密码
    private String name;//姓名

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Date getUpdated() {
        return updated;
    }

    public void setUpdated(Date updated) {
        this.updated = updated;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    private Integer age;//年龄
    private Integer sex;//性别 1男性,2女性
    private Date birthday; //出生日期
    private Date created; //创建时间
    private Date updated; //更新时间
    private String note;//备注
}

Controller(普通)

package com.example.controller;

import com.example.pojo.User;
import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
@RequestMapping("/consumer")
@DefaultProperties(defaultFallback = "defaultFailBack")
public class UserController {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private DiscoveryClient discoveryClient;

    @RequestMapping("/{id}")
    @HystrixCommand
    //HystrixCommand(fallbackMethod = "failBack") //在有可能发生问题的方法上添加降级处理调用
    public User queryById(@PathVariable("id")Integer id){
        List<ServiceInstance> springcloud_provider = discoveryClient.getInstances("SPRINGCLOUD_PROVIDER");
        int port = 0;
        for (ServiceInstance serviceInstance : springcloud_provider) {
            port = serviceInstance.getPort();
        }
        String url = "http://springCloudprovider:"+port+"/user/find/" + id;
        User user = restTemplate.getForObject(url, User.class);
        return user;
    }

    /**
     * 服务降级处理方法
     */
    public User failBack(Integer id){
        User user = new User();
        user.setUsername("服务降级,默认处理");
        return user;
    }

    /**
     * 全局的服务器降级处理方法
     */
    public User defaultFailBack(){
        User user = new User();
        user.setUsername("Default-服务降级,默认处理!");
        return  user;
    }
}

Controller(Feign负载分担)
负载分担接口

package com.example.feign;

import com.example.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@FeignClient("springCloudprovider") //服务的名字
public interface UserClient {

    /**
     * 根据ID获取用户信息
     */
    @RequestMapping("/user/find/{id}")
    User findById(@PathVariable("id")Integer id);
}

负载分担控制类

package com.example.controller;


import com.example.feign.UserClient;
import com.example.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/feign")
public class ConsumerFeignController {

    @Autowired
    private UserClient userClient;

    /**
     * 使用Feign调用springcloudprovider
     */
    @RequestMapping("/{id}")
    public User queryById(@PathVariable("id")Integer id){
        return userClient.findById(id);
    }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

SpringCloud简单搭建(Erueka、Feign、Gateway) 的相关文章

  • 在 Javascript 中动态添加事件处理程序

    我在使用 Javascript 时遇到了一个奇怪的问题 我得到的是一个特定格式的字符串 我将尝试用它创建一个表 该表每行只有一个单元格 字符串的格式为 每个单元格 行 需要显示内容 将传递给的参数onmouseover当用户将鼠标移动到显示
  • Java 表达式树 [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 是否有相当于 net的 LINQ 下的表达式树JVM 我想实现一些类似 LINQ 的代码结构Scala
  • Java - 调整图像大小而不损失质量

    我有 10 000 张照片需要调整大小 因此我有一个 Java 程序来执行此操作 不幸的是 图像的质量损失很大 而且我无法访问未压缩的图像 import java awt Graphics import java awt AlphaComp
  • Java 客户端到服务器未知来源

    我有一个简单的乒乓球游戏 需要通过网络工作 服务器将创建一个带有球和 2 个球棒位置的游戏 当客户端连接到服务器时 服务器将创建一个名为 PongPlayerThread 的新类 它将处理客户端到服务器的输入和输出流 我的服务器工作100
  • Eclipse Oxygen - 该项目未构建,因为其构建路径不完整

    我刚刚安装了 Eclipse Oxygen 并尝试在工作台中打开现有项目 但收到此错误 该项目未构建 因为其构建路径不完整 不能 找到 java lang Object 的类文件 修复构建路径然后尝试 建设这个项目 我尝试右键单击该项目 转
  • 如何在java中从包含.0的浮点数中删除小数部分

    我只想删除包含的浮点数的小数部分 0 所有其他数字都是可以接受的 例如 I P 1 0 2 2 88 0 3 56666 4 1 45 00 99 560 O P 1 2 2 88 3 567 4 1 45 99 560 有什么方法可以做到
  • Java 声音可视化器

    我正在尝试制作一个java声音可视化工具 但我完全不知道如何在实时处理音频后立即从提取的音频中获取字节 我可以将程序与 wav 文件同步 但这不是我想要做的 我想用程序生成声音 然后播放它 而不将其保存在任何地方 谢谢您的帮助 本文可以帮助
  • Log4j 2.0 中发现 ClassNotFoundException

    我已经设置了 log4j12 api beta2 jar 的构建路径 但它给出了 以下错误请帮我解决这个问题我的代码如下 java 文件 package com sst log4j class Product private int pro
  • SQlite 获取最近的位置(带有纬度和经度)

    我的 SQLite 数据库中存储有纬度和经度的数据 我想获取距我输入的参数最近的位置 例如我当前的位置 纬度 经度等 我知道这在 MySQL 中是可能的 并且我已经做了相当多的研究 SQLite 需要一个自定义外部函数来实现半正弦公式 计算
  • 为什么 document.getelementbyId 在 Firefox 中不起作用?

    我不明白为什么 document getElementById 在 Firefox 中不起作用 document getElementById main style width 100 当我检查 Firebug 时 它说 类型错误 docu
  • 按钮悬停和按下效果 CSS Javafx

    我是 CSS 新手 为按钮定义了以下 CSS 样式 其中id并且应用了自定义样式 但不应用悬停和按下效果 bevel grey fx background color linear gradient f2f2f2 d6d6d6 linear
  • 对于双核手机,availableProcessors() 返回 1

    我最近购买了一部 Moto Atrix 2 手机 当我尝试查看手机中的处理器规格时 Runtime getRuntime availableProcessors 返回 1 proc cpuinfo 也仅包含有关处理器 0 的信息 出于好奇
  • 一个接一个地淡入div

    大家好 我很擅长 HTML 和 CSS 但才刚刚开始接触 jQuery 的皮毛 我希望让 3 个 div 在页面加载时逐渐淡入 到目前为止我有这个 我听说使用 css 将显示设置为 none 对于任何使用非 JavaScript 浏览器的人
  • Android - 从渲染线程内结束活动

    下午好 我不熟悉 android 中的活动生命周期 并且一直在尽可能地阅读 但我不知道如何以良好的方式解决以下问题 我有一个使用 GLSurfaceView 的活动来在屏幕上绘制各种内容 在这个 GLSurfaceView 的渲染线程中 我
  • 背景图像隐藏其他组件,例如按钮标签等,反之亦然

    如何解决此代码中组件的隐藏问题 代码运行没有错误 但背景图片不显示 如何更改代码以获取背景图像 使用验证方法时 它在validation 中创建错误 public class TEST public TEST String strm Jan
  • 在 servlet 会话和 java.io.NotSerializedException 中保存对象

    SEVERE IOException while loading persisted sessions java io WriteAbortedException writing aborted java io NotSerializabl
  • 需要在没有wsdl的情况下调用soap ws

    我是网络服务的新手 这个网络服务是由 siebel 提供的 我需要调用一项网络服务 我的客户向我提供了以下详细信息 这是 SOAP 对于产品 请使用它作为端点 Request
  • 如何解决此错误:属性 rel 的原始源值错误

    我正在尝试使用 w3c 验证我的网站 但出现错误 Bad value original source for attribute rel on element link The string original source is not a
  • 将其元素添加到另一个列表后清除列表

    我正在做一个程序 它获取更多句子作为参数 我制作了 2 个列表 一个称为 propozitie 其中包含每个句子 另一个称为 propozitii 其中包含所有句子 问题是 当我在遇到 后清除 propozitie 列表时 它也会清除 pr
  • 从顶部开始在同一水平线上显示同一行中的两个 div

    这是我的代码 floating box display inline block width 150px margin 10px border 3px solid 73AD21 after box border 3px solid red

随机推荐

  • 微信小程序瀑布流布局

  • Spring Boot:从入门到实践的全面指南

    文章目录 1 Spring Boot简介及特性 1 1 简介 什么是Spring Boot 1 2 特性 Spring Boot的优势与特点 1 3 四大核心 Spring Boot的核心组成 2 Spring Boot入门案例 2 1 S
  • 重启CDH服务

    找到cm的目录 cd opt cm 5 13 2 etc init d 查看sever状态 cloudera scm server status 重启server cloudera scm server restart 再次查看sever状
  • Micropython开发篇三--基于F411 CE的移植编译

    Micropython开发篇三 基于F411 CE的移植编译 最近在学操作系统 RTOS与Linux 对Micropython有些新的认知 回头又复习了一下Micropython 简直要不要这么优秀 希望通过这篇文章能带给大家不一样的Mic
  • Python - 函数注解

    Python3提供一种语法 用于为函数声明中的参数和返回值附加元数据 或者也可以称之为注释 def my function Something about your function pass 文档注释可以通过下面这种方式查看 print
  • MyBatis高级查询:一对多映射collection集合实现机构-用户-角色-菜单三级嵌套查询

    学习自MyBatis从入门到精通 嵌套查询 会执行额外的SQL语句 团队网站的结构关系我是做成了机构用户角色菜单三层嵌套查询 今天一天进行了实现 遇到的错误真的很多 我们知道association collection关联的嵌套查询这种方式
  • TCP协议、VLSM、CIDR思维导图

    ICMP 网络层协议 用来在网络设备间传递各种差错 控制 查询等信息 对于收集各种网络信息 诊断和排除各种网络故障
  • CocosCreator列表scrollview滑动速度的修改,鼠标滚动速度修改

    由于cocos creator 在pc端 使用scrollview 鼠标滚动速度太慢 原文地址 CocosCreator列表滑动速度的修改 简书CocosCreator列表滑动速度的修改 简书引擎版本 2 2 2 之后升级的2 4 0直接可
  • Android发送POST网络请求

    参考链接 Android 网络请求 网络请求 Okhttp 51CTO博客 android 网络请求 项目中需要通过发送网络请求获取需要显示的数据内容 请求地址和requestbody如上图所示 网络请求用 implementation c
  • Java顺序表

    1 顺序表的定义 顺序表是用物理地址连续存储单元依次存储元素的线性数据结构 一般底层采用数组存储 其中Arraylist也是一个动态修改的数组 于此大致相同 在计算机科学中 数组是由一组元素 值或变量 组成的数据结构 每个元素有至少一个索引
  • JSONUtils

    package com xiolift mdm common util import com alibaba druid util StringUtils import com alibaba fastjson JSON import co
  • SpringBoot 集成 Mybatis

    SpringBoot 集成 Mybatis 详细教程 只有操作 没有理论 仅供参考学习 一 操作部分 1 准备数据库 1 1 数据库版本 C WINDOWS system32 gt mysql V mysql Ver 8 0 25 for
  • Python:sklearn数据预处理中fit(),transform()与fit_transform()的区别

    一 前提 sklearn里的封装好的各种算法使用前都要fit fit相对于整个代码而言 为后续API服务 fit之后 然后调用各种API方法 transform只是其中一个API方法 所以当你调用transform之外的方法 也必须要先fi
  • 送书|入门Python之后还是搞不定面试、做不来项目,推荐读读这本书

    又到了每周三送书的时刻啦 本周送书 Python工匠 Python 能干的事情实在太多了 掰着指头数有点不够用 Web 开发 数据分析 网络爬虫 自动化运维 后台开发 机器学习 如果你知道主攻哪个方向 只需重点去学习 不过 不论哪个方向 P
  • 阿里云sls日志服务的简单监控 php实现

    欢迎加入 新群号码 99640845 由于工作需要最近接触了阿里云的sls日志服务 写了一个基于阿里云sls日志服务和SDK的简单的监控脚本 首先需要开通阿里云的日志服务并且可以通过控制台读取相应日志 这里不就不详细说了 http blog
  • Qemu-KVM基本工作原理分析

    1 理解KVM与Qemu的关系 我们都知道开源虚拟机KVM 并且知道它总是跟Qemu结合出现 那这两者之间有什么关系呢 首先 Qemu本身并不是KVM的一部分 而是一整套完整的虚拟化解决方案 它是纯软件实现的 包括处理器虚拟化 内存虚拟化以
  • 斜体文本测试

    加粗样式
  • Spring:基本概念

    Spring是一款全栈式轻量级开源框架 主要解决的是程序间耦合的问题 两大核心 控制反转IOC 面向切面编程AOP 能够整合众多著名的第三方框架和类库 是实际开发中使用最多的企业应用级开源框架 2017年9月发布了spring的最新版本sp
  • 以太网(Ethenet)协议

    1 定义 以太网协议用于实现链路层的数据传输和地址封装 MAC 由DIX联盟 Digital Intel Xerox 开发 2 封装 原理 由Ethenet II 封装 三个字段 Destination 目的字段 标识目的通信方的MAC地址
  • SpringCloud简单搭建(Erueka、Feign、Gateway)

    父工程 SpringCloud 配置文件 pom xml