Library Search
结果页

服务注册发现与健康检查

在 元器件 / 技术栈 / 知识库 中找到 14 个匹配结果。

返回文档库
技术栈

技术栈

6 个
查看全部
HashiCorp Consul # Consul 服务注册发现与健康检查 ## 目标 使用 Python consul 库注册服务、查询服务、配置健康检查。 ## 环境准备 ```bash pip install python-consul # 确保 Consul 运行中 docker run -d --name consul -p 8500:8500 consul:latest agent -dev -client=0.0… 2% Nacos | 模式 | 适用场景 | 取舍 | |------|----------|------| | **AP** | 一般微服务注册发现 | 网络分区时各节点可独立工作,恢复后自动合并 | | **CP** | 金融/支付等强一致场景 | 网络分区时少数节点拒绝写入 | > 这是 Nacos 相比 Eureka(纯 AP)和 ZooKeeper(纯 CP)的核心优势。 ### 2.3 健康检查机制… 1% etcd ```bash # 节点1 etcd --name infra0 \ --initial-advertise-peer-urls http://10.0.1.10:2380 \ --listen-peer-urls http://10.0.1.10:2380 \ --listen-client-urls http://10.0.1.10:2379,http://127.0.0.1:23… 1% Spring Boot @Modifying @Query("UPDATE User u SET u.email = :email WHERE u.id = :id") int updateEmail(@Param("id") Long id, @Param("email") String email); } ``` ## 第四章:Actuator 监控 ### 4.1 启用端点 ```proper… 1% FastAPI @app.get("/public/health") async def health_check(): """公开接口 —— 无需认证""" return {"status": "healthy", "users_count": len(fake_users_db)} ``` ## 测试 ```bash # 1. 获取 Token(alice / secret123) cur… 1% GraphQL // ── Resolver ── const resolvers = { Query: { books: () => books, book: (_, { id }) => books.find(b => b.id === id), authors: () => authors, author: (_, { id }) => authors.find(a =>… 1%
知识库

知识库

8 个
服务注册发现与健康检查 # Consul 服务注册发现与健康检查 ## 目标 使用 Python consul 库注册服务、查询服务、配置健康检查。 ## 环境准备 ```bash pip install python-consul # 确保 Consul 运行中 docker run -d --name consul -p 8500:8500 consul:latest agent -dev -client=0.0… 2% 入门教程 - 服务网格与多数据中心 # Consul 入门教程:服务网格与多数据中心 ## 1. Consul vs ZooKeeper vs etcd | 维度 | Consul | ZooKeeper | etcd | |------|--------|-----------|------| | 协议 | Raft + Gossip | ZAB | Raft | | 服务发现 | 原生 DNS/HTTP API | 需框架封… 2% Nacos 微服务注册与配置中心入门 | 模式 | 适用场景 | 取舍 | |------|----------|------| | **AP** | 一般微服务注册发现 | 网络分区时各节点可独立工作,恢复后自动合并 | | **CP** | 金融/支付等强一致场景 | 网络分区时少数节点拒绝写入 | > 这是 Nacos 相比 Eureka(纯 AP)和 ZooKeeper(纯 CP)的核心优势。 ### 2.3 健康检查机制… 1% 入门到进阶教程 @Modifying @Query("UPDATE User u SET u.email = :email WHERE u.id = :id") int updateEmail(@Param("id") Long id, @Param("email") String email); } ``` ## 第四章:Actuator 监控 ### 4.1 启用端点 ```proper… 1% 02-dependency-injection-auth @app.get("/public/health") async def health_check(): """公开接口 —— 无需认证""" return {"status": "healthy", "users_count": len(fake_users_db)} ``` ## 测试 ```bash # 1. 获取 Token(alice / secret123) cur… 1% 03-实战数据处理与Web-API # 搜索 curl "http://localhost:8000/api/books?keyword=Python&page=1&per_page=5" # 更新 curl -X PUT http://localhost:8000/api/books/1 \ -H "Content-Type: application/json" \ -d '{"title":"Python编程从入门到实… 1% etcd 分布式锁与服务发现实战 # 3. 测试服务发现(终端1) python service_discovery.py server # [Register] hostname:8080 registered (TTL=10s) # 4. 测试服务发现(终端2) python service_discovery.py discover # [Discover] Found 1 instances: # - hostnam… 1% 图书 API——Query、Mutation 与嵌套类型 // ── Resolver ── const resolvers = { Query: { books: () => books, book: (_, { id }) => books.find(b => b.id === id), authors: () => authors, author: (_, { id }) => authors.find(a =>… 1%