All Projects → hb-go → Micro

hb-go / Micro

Licence: mit
go-micro 微服务实践,更多请关注Micro中国站☞

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Micro

micro-starter
Micro 微服务实践
Stars: ✭ 391 (+2.09%)
Mutual labels:  consul, micro, k8s, go-micro, istio
Micro Starter Kit
Cloud Native GoLang Microservices - gRPC, GraphQL
Stars: ✭ 167 (-56.4%)
Mutual labels:  microservices, go-micro, micro
Dew
微服务一站式解决方案,提供:架构指南、容器优先/兼容Spring Cloud与Service Mesh的框架、最佳实践及Devops标准化流程。
Stars: ✭ 285 (-25.59%)
Mutual labels:  microservices, k8s, istio
Microservices
micro 微服务实例教程,包含JWT鉴权、熔断、监控、链路追踪、健康检查、跨域等
Stars: ✭ 341 (-10.97%)
Mutual labels:  microservices, go-micro, micro
Admiral
Admiral provides automatic configuration generation, syncing and service discovery for multicluster Istio service mesh
Stars: ✭ 323 (-15.67%)
Mutual labels:  microservices, k8s, istio
micro-plugins
go-micro plugins, auth(JWT+Casbin)、go-micro服务加入istio服务网格
Stars: ✭ 27 (-92.95%)
Mutual labels:  micro, go-micro, istio
Wl Micro Frontends
Micro front end practical project tutorial. 微前端项目实战vue项目。基于vue3.0&qiankun2.0进阶版:https://github.com/wl-ui/wl-mfe
Stars: ✭ 366 (-4.44%)
Mutual labels:  microservices, micro
protoc-gen-micro
Protobuf code generation
Stars: ✭ 287 (-25.07%)
Mutual labels:  micro, go-micro
Micro Open Graph
A tiny Node.js microservice to scrape open graph data with joy.
Stars: ✭ 371 (-3.13%)
Mutual labels:  microservices, micro
Protoc Gen Micro
Protobuf code generation for Micro. Moved to go-micro/cmd/protoc-gen-micro.
Stars: ✭ 270 (-29.5%)
Mutual labels:  go-micro, micro
istio-lab
《Istio 入门与实战》官方配套实验代码库
Stars: ✭ 87 (-77.28%)
Mutual labels:  k8s, istio
Microservices Traffic Management Using Istio
Istio is an open platform that provides a uniform way to connect, manage, and secure microservices. In this code we show how we can enable your microservices with advanced traffic management, routing and tracing capabilities leveraging Istio
Stars: ✭ 257 (-32.9%)
Mutual labels:  microservices, istio
Go Micro
A pluggable Go framework for distributed systems development
Stars: ✭ 17,350 (+4430.03%)
Mutual labels:  microservices, micro
meshery-operator
The service mesh operator.
Stars: ✭ 41 (-89.3%)
Mutual labels:  consul, istio
k8s-istio-demo
Demo showing the capabilities of Istio
Stars: ✭ 22 (-94.26%)
Mutual labels:  k8s, istio
service-mesh-labs
Lab scenarios for learning how to service mesh.
Stars: ✭ 22 (-94.26%)
Mutual labels:  consul, istio
short
URL shortening service. 高性能短链接服务。
Stars: ✭ 14 (-96.34%)
Mutual labels:  k8s, go-micro
K8s For Docker Desktop
为Docker Desktop for Mac/Windows开启Kubernetes和Istio。
Stars: ✭ 3,863 (+908.62%)
Mutual labels:  k8s, istio
Vertx Zero
Zero Framework:http://www.vertxup.cn
Stars: ✭ 320 (-16.45%)
Mutual labels:  microservices, istio
kserve
Serverless Inferencing on Kubernetes
Stars: ✭ 1,621 (+323.24%)
Mutual labels:  k8s, istio

Micro github.com/micro

Slack

Go Micro 应用服务化治理实践

go-micro

Service Mesh

go-micro服务加入service mesh

运行示例

依赖安装

go mod

GFWgoproxy.io

服务发现-Consul

$ consul agent -dev -advertise 127.0.0.1

运行

$ micro api
$ micro web

# Auth SRV
$ cd auth/srv/ && go run main.go

# Account API
$ cd account/api/ && go run main.go
$ curl -H 'Content-Type: application/json' \
            -H "Authorization: Bearer VALID_TOKEN" \
            -d '{"nickname": "Hobo", "pwd": "pwd"}' \
             http://localhost:8080/login
             
# Account Web
$ cd account/web/ && go run main.go
http://localhost:8082/accout

# Post SRV
$ cd post/srv/ && go run main.go

# Post API
$ cd post/api/ && go run main.go
http://localhost:8080/post?id=1
http://localhost:8080/post/comments?id=1

# Post Web
$ cd post/web/ && go run main.go
http://localhost:8082/post

Echo做Web框架

插件替换

需要替换的插件import到plugins.go

micro工具需要手动编译

# 编译micro
$ go build -i -o micro ./main.go ./plugins.go

# 运行micro api/web
$ micro --transport=tcp api
$ micro --transport=tcp web

# 运行go-micro服务
$ go run main.go plugins.go --transport=tcp
// plugins.go

package main

import (
	// registry
	// k8s
	_ "github.com/micro/go-plugins/registry/kubernetes"
	// etcd v3
	//_ "github.com/micro/go-plugins/registry/etcdv3"

	// transport
	// tcp
	_ "github.com/micro/go-plugins/transport/tcp"
	// nats
	//_ "github.com/micro/go-plugins/transport/nats"

	// broker
	// kafka
	//_ "github.com/micro/go-plugins/broker/kafka"
)

框架使用

模块创建

$ micro new --type srv --alias auth github.com/hb-go/micro/auth/srv
$ micro new --type api --alias account github.com/hb-go/micro/account/api
$ micro new --type web --alias account github.com/hb-go/micro/account/web

$ micro new --type srv --alias post github.com/hb-go/micro/post/srv
$ micro new --type api --alias post github.com/hb-go/micro/post/api
$ micro new --type web --alias post github.com/hb-go/micro/post/web

Protobuf protoc-gen-micro

$ go get github.com/micro/protoc-gen-micro

$ protoc --proto_path=$GOPATH/src:. --micro_out=. --go_out=. post/srv/proto/example/example.proto
.proto批量处理
# 批处理工具打包
$ go build -i -o build/bin/proto_batch tools/proto/batch.go

# ./build/bin/proto_batch -h
$ ./build/bin/proto_batch -r auth:account:post

API

$ micro api
$ micro --enable_stats api
    http://localhost:8080/stats
$ micro api --namespace=com.example.api

    Make a HTTP call
    curl "http://localhost:8080/greeter/say/hello?name=Asim+Aslam"

    Make an RPC call via the /rpc
    curl -d 'service=go.micro.srv.greeter' \
        -d 'method=Say.Hello' \
        -d 'request={"name": "Asim Aslam"}' \
        http://localhost:8080/rpc

    Make an RPC call via /rpc with content-type set to json
    $ curl -H 'Content-Type: application/json' \
        -d '{"service": "go.micro.srv.greeter", "method": "Say.Hello", "request": {"name": "Asim Aslam"}}' \
        http://localhost:8080/rpc

Web

$ micro --enable_stats web

Trace

Jaeger

$ docker run -d --name=jaeger -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 -p5775:5775/udp -p6831:6831/udp -p6832:6832/udp   -p5778:5778 -p16686:16686 -p14268:14268 -p9411:9411 jaegertracing/all-in-one:latest
#http://localhost:16686 查看Trace信息
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].