Pivotal( Biwei ) has been established by VMware and EMC .
RabbitMQ is a concurrency -oriented programming language developed by ERlang(Ericsson ), installing RabbitMQ First ERlang.
Package Com.itmuch.cloud;import Org.springframework.beans.factory.annotation.value;import Org.springframework.cloud.context.config.annotation.refreshscope;import Org.springframework.web.bind.annotation.getmapping;import Org.springframework.web.bind.annotation.RestController; @RestController//Configure automatic refresh, config server does not change, config client to change. @RefreshScope//add configuration to automatically refresh annotations, when the configuration changes, the bean will//each micro-service started, config client has been loaded configuration, even if the config server is hung can. Public classConfigclientcontroller {@Value ("${profile}") PrivateString profile; @GetMapping ("/profile") PublicString GetProfile () {return This. Profile; }}
Package Com.itmuch.cloud;import Org.springframework.boot.springapplication;import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication Public Class configserverapplication { publicstaticvoid main (string[] args) { springapplication.run (configserverapplication. class , args);} }
Application.yml
Server: 8082
Bootstrap.yml
Spring: Cloud: config: #config server address uri:http://localhost:8080 Profile:dev label:master # when the backend store for Configserver is git, the default is Master bus: Trace: true application: name:foobar #连接rabbitmq rabbitmq: Host: localhost 5672 username:guest password:guest
<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> <parent> <groupId>com.itmuch.cloud</groupId> <artifactid>mi Croservice-spring-cloud</artifactid> <version>0.0.1-snapshot</version> </parent> <artifactid>microservice-config-client-refresh</artifactid > <packaging>jar</packaging> <properties> <project.build.sourceencoding>utf-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactid>spring-cloud-starter-config</arti factid> </dependency> <dependency> <groupid>org.springframework.boot</gro Upid> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- Configure automatic refresh dependency-<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency > <groupId>org.springframework.cloud</groupId> <artifactid>spring-cloud-starter -bus-amqp</artifactid> </dependency> </dependencies></project>
the transaction between MicroServices is a distributed transaction ( TCC, compensation mechanism for reliable transactions, maximum effort-based transactions). Eureka,zk,consul,etcd are All services found words are the same different products just. With Docker , you can start all microservices at once,Java-jar only one micro-service at a time.
The call chain is as short as possible, or a timeout occurs.
Www.itmuch.com
microservices can be called between http or RPC . the SOAP protocol is heavy, and microservices can be cross-platform or cross-lingual.
Client Side Load Balancing: The client can figure out which server to hit, so there is no need for the server to load balance.
Nanoservices: A smaller nano-service framework than microservices.
Sidecar: component.
SPRINGCLOUD21---config-bus for automatic refresh configuration