Golang微服务
Go · 7 篇笔记
- consulhistorical
1. 是什么 服务注册与发现的组件 2. 单机集群搭建 2.1. 下载 Download Consul \ Consul by HashiCorp 2.2. 配置文件 2.2.1. 创建目录 2.2.2. 配置文件 server1 server2 server3 2.3. 启动 server1 server2 server3 2.4. 测试 增加服务配置文件 增加服务 web ui 3. 参考 Consul集群搭建 \ 简书 WEHou
- etcdhistorical
1. 安装 下载 Releases · etcd\ io/etcd 解压配置环境变量 2. web ui Releases · evildecay/etcdkeeper 3. 参考 etcd \ Home
- hystrixhistorical
1. circuit golang版本的hystrix实现,用于服务熔断(降级的一种措施,其他如开关熔断等) 2. 使用 hystrix.go main.go 3. 参考 cep21/circuit: An efficient and feature complete Hystrix like Go implementation of the circuit breaker pattern\. expvar \ The Go Progr
- microhistorical
1. 安装micro 1.1. 方案一 下载 Releases · micro/micro 解压配置环境变量 1.2. 方案二 前提是配置好GOBIN环境变量 下载源码 安装到GOBIN中 2. 参考 micro/micro: Micro is a distributed systems runtime for the Cloud Micro \ The fastest way to build services in the Clou
- protobufhistorical
1. 是什么 高效的序列化、反序列化方式 1.1. 普通序列化 Teacher Test 结果 可以看出字节数挺大的 1.2. protobuf序列化 TearchSerializer.proto 生成Java Test 结果 可以看出生成的字节数小 1.3. 对比 protobuf序列化的时候减少了一些额外的信息 比如int占用4个字节,而protobuf则是根据长度占用1 5个字节 1.3.1. 普通的序列化反序列化 1.3.2.
- retryhistorical
1. 是什么 调用远程服务失败,重新调用一次有可能就成功了 2. 什么时候需要重试 网络错误能重试,逻辑错误没必要 当网络错误长时间持续的时候不能使用重试,防止进一步压垮服务 不是幂等请求,不能重试 3. 重试策略 快速失败和重试的权衡 如果重试多次之后还是失败,那么不应该继续重试。参考断路器模式 4. Golang重试 4.1. retry 相当于golang版本的ribbon,定义重试策略 5. 参考 avast/retry\ go