Govern Service 基于 Redis 的服務(wù)治理平臺(tái)安裝過(guò)程詳解
Govern Service 基于 Redis 的服務(wù)治理平臺(tái)(服務(wù)注冊(cè)/發(fā)現(xiàn) & 配置中心)
Govern Service 是一個(gè)輕量級(jí)、低成本的服務(wù)注冊(cè)、服務(wù)發(fā)現(xiàn)、 配置服務(wù) SDK,通過(guò)使用現(xiàn)有基礎(chǔ)設(shè)施中的 Redis (相信你已經(jīng)部署了Redis),不用給運(yùn)維部署帶來(lái)額外的成本與負(fù)擔(dān)。
借助于 Redis 的高性能, Govern Service 提供了超高TPS&QPS (10W+/s JMH 基準(zhǔn)測(cè)試)。Govern Service 結(jié)合本地進(jìn)程緩存策略 + Redis PubSub,實(shí)現(xiàn)實(shí)時(shí)進(jìn)程緩存刷新,兼具無(wú)與倫比的QPS性能、進(jìn)程緩存與 Redis 的實(shí)時(shí)一致性。
安裝
Gradle
Kotlin DSL
val governVersion = "0.9.13";
implementation("me.ahoo.govern:spring-cloud-starter-config:${governVersion}")
implementation("me.ahoo.govern:spring-cloud-starter-discovery:${governVersion}")
Maven
<?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>
<artifactId>demo</artifactId>
<properties>
<govern.version>0.9.13</govern.version>
</properties>
<dependencies>
<dependency>
<groupId>me.ahoo.govern</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
<version>${govern.version}</version>
</dependency>
<dependency>
<groupId>me.ahoo.govern</groupId>
<artifactId>spring-cloud-starter-discovery</artifactId>
<version>${govern.version}</version>
</dependency>
</dependencies>
</project>
bootstrap.yml (Spring-Cloud-Config)
spring:
application:
name: ${service.name:govern-rest-api}
cloud:
govern:
namespace: ${govern.namespace:govern-{system}}
config:
config-id: ${spring.application.name}.yml
redis:
mode: ${govern.mode:standalone}
url: ${govern.redis.uri:redis://localhost:6379}
logging:
file:
name: logs/${spring.application.name}.log
REST-API Server (Optional)
安裝 REST-API Server
方式一:下載可執(zhí)行文件
解壓 rest-api-0.9.13.tar
cd rest-api-0.9.13 # 工作目錄: rest-api-0.9.13 bin/rest-api --server.port=8080 --govern.redis.uri=redis://localhost:6379
方式二:Docker run
docker pull ahoowang/govern-service:0.9.13 docker run --name govern-service -d -p 8080:8080 --link redis -e GOVERN_REDIS_URI=redis://redis:6379 ahoowang/govern-service:0.9.13
MacBook Pro (M1)
請(qǐng)使用 ahoowang/govern-service:0.9.13-armv7
docker pull ahoowang/govern-service:0.9.13-armv7 docker run --name govern-service -d -p 8080:8080 --link redis -e GOVERN_REDIS_URI=redis://redis:6379 ahoowang/govern-service:0.9.13-armv7
http://localhost:8080/dashboard
Dashboard

命名空間管理

配置管理




服務(wù)管理


REST-API
http://localhost:8080/swagger-ui/index.html
Namespace

/v1/namespaces
GET
/v1/namespaces/{namespace}
PUT
GET
/v1/namespaces/current
GET
/v1/namespaces/current/{namespace}
PUT
Config

/v1/namespaces/{namespace}/configs
GET
/v1/namespaces/{namespace}/configs/{configId}
GET
PUT
DELETE
/v1/namespaces/{namespace}/configs/{configId}/versions
GET
/v1/namespaces/{namespace}/configs/{configId}/versions/{version}
GET
/v1/namespaces/{namespace}/configs/{configId}/to/{targetVersion}
PUT
Service

/v1/namespaces/{namespace}/services/
GET
/v1/namespaces/{namespace}/services/{serviceId}/instances
GET
PUT
/v1/namespaces/{namespace}/services/{serviceId}/instances/{instanceId}
DELETE
/v1/namespaces/{namespace}/services/{serviceId}/instances/{instanceId}/metadata
PUT
/v1/namespaces/{namespace}/services/{serviceId}/lb
GET
JMH-Benchmark
- 基準(zhǔn)測(cè)試運(yùn)行環(huán)境:筆記本開(kāi)發(fā)機(jī) ( MacBook Pro (M1) )
- 所有基準(zhǔn)測(cè)試都在開(kāi)發(fā)筆記本上執(zhí)行。
- Redis 部署環(huán)境也在該筆記本開(kāi)發(fā)機(jī)上。
ConfigService
gradle config:jmh
# JMH version: 1.29 # VM version: JDK 11.0.11, OpenJDK 64-Bit Server VM, 11.0.11+9-LTS # VM invoker: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java # VM options: -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/Users/ahoo/govern-service/config/build/tmp/jmh -Duser.country=CN -Duser.language=zh -Duser.variant # Blackhole mode: full + dont-inline hint # Warmup: 1 iterations, 10 s each # Measurement: 1 iterations, 10 s each # Timeout: 10 min per iteration # Threads: 50 threads, will synchronize iterations # Benchmark mode: Throughput, ops/time Benchmark Mode Cnt Score Error Units ConsistencyRedisConfigServiceBenchmark.getConfig thrpt 265321650.148 ops/s RedisConfigServiceBenchmark.getConfig thrpt 106991.476 ops/s RedisConfigServiceBenchmark.setConfig thrpt 103659.132 ops/s
ServiceDiscovery
gradle discovery:jmh
# JMH version: 1.29 # VM version: JDK 11.0.11, OpenJDK 64-Bit Server VM, 11.0.11+9-LTS # VM invoker: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/java # VM options: -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/Users/ahoo/govern-service/discovery/build/tmp/jmh -Duser.country=CN -Duser.language=zh -Duser.variant # Blackhole mode: full + dont-inline hint # Warmup: 1 iterations, 10 s each # Measurement: 1 iterations, 10 s each # Timeout: 10 min per iteration # Threads: 50 threads, will synchronize iterations # Benchmark mode: Throughput, ops/time Benchmark Mode Cnt Score Error Units ConsistencyRedisServiceDiscoveryBenchmark.getInstances thrpt 76894658.867 ops/s ConsistencyRedisServiceDiscoveryBenchmark.getServices thrpt 466036317.472 ops/s RedisServiceDiscoveryBenchmark.getInstances thrpt 107778.244 ops/s RedisServiceDiscoveryBenchmark.getServices thrpt 106920.412 ops/s RedisServiceRegistryBenchmark.deregister thrpt 114094.513 ops/s RedisServiceRegistryBenchmark.register thrpt 109085.694 ops/s RedisServiceRegistryBenchmark.renew thrpt 127003.104 ops/s
作者:Ahoo Wang (阿虎)
Github: https://github.com/Ahoo-Wang/
SmartSql(高性能、高生產(chǎn)力,超輕量級(jí)的ORM!): https://github.com/dotnetcore/SmartSql
SmartCode(不只是代碼生成器!): https://github.com/dotnetcore/SmartCode
Govern Service 基于 Redis 的服務(wù)治理平臺(tái)(服務(wù)注冊(cè)/發(fā)現(xiàn) & 配置中心): https://github.com/Ahoo-Wang/govern-service
Govern EventBus 歷經(jīng)多年生產(chǎn)環(huán)境驗(yàn)證的事件驅(qū)動(dòng)架構(gòu)框架: https://github.com/Ahoo-Wang/govern-eventbus
以上就是Govern Service 基于 Redis 的服務(wù)治理平臺(tái)的詳細(xì)內(nèi)容,更多關(guān)于Redis 服務(wù)治理的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
異步redis隊(duì)列實(shí)現(xiàn) 數(shù)據(jù)入庫(kù)的方法
今天小編就為大家分享一篇異步redis隊(duì)列實(shí)現(xiàn) 數(shù)據(jù)入庫(kù)的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-10-10
基于 Redis 的 JWT令牌失效處理方案(實(shí)現(xiàn)步驟)
當(dāng)用戶登錄狀態(tài)到登出狀態(tài)時(shí),對(duì)應(yīng)的JWT的令牌需要設(shè)置為失效狀態(tài),這時(shí)可以使用基于Redis 的黑名單方案來(lái)實(shí)現(xiàn)JWT令牌失效,本文給大家分享基于 Redis 的 JWT令牌失效處理方案,感興趣的朋友一起看看吧2024-03-03
Redis過(guò)期監(jiān)聽(tīng)機(jī)制,訂單超時(shí)自動(dòng)取消方式
這篇文章主要介紹了Redis過(guò)期監(jiān)聽(tīng)機(jī)制,訂單超時(shí)自動(dòng)取消方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-05-05
Redis實(shí)現(xiàn)Session持久化的示例代碼
Redis是內(nèi)存數(shù)據(jù)庫(kù),數(shù)據(jù)都是存儲(chǔ)在內(nèi)存中,為了避免服務(wù)器斷電等原因?qū)е翿edis進(jìn)程異常退出后數(shù)據(jù)的永久丟失,本文主要介紹了Redis實(shí)現(xiàn)Session持久化的示例代碼,感興趣的可以了解一下2023-09-09
關(guān)于redis Key淘汰策略的實(shí)現(xiàn)方法
下面小編就為大家?guī)?lái)一篇關(guān)于redis Key淘汰策略的實(shí)現(xiàn)方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-03-03
Redis有序集合類型的操作_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理
今天通過(guò)本文給大家說(shuō)一下Redis中最后一個(gè)數(shù)據(jù)類型 “有序集合類型”,需要的的朋友參考下吧2017-08-08
Redis全文搜索教程之創(chuàng)建索引并關(guān)聯(lián)源數(shù)據(jù)的教程
RediSearch提供了一種簡(jiǎn)單快速的方法對(duì) hash 或者 json 類型數(shù)據(jù)的任何字段建立二級(jí)索引,然后就可以對(duì)被索引的 hash 或者 json 類型數(shù)據(jù)字段進(jìn)行搜索和聚合操作,這篇文章主要介紹了Redis全文搜索教程之創(chuàng)建索引并關(guān)聯(lián)源數(shù)據(jù),需要的朋友可以參考下2023-12-12
使用redis分布式鎖解決并發(fā)線程資源共享問(wèn)題
這篇文章主要介紹了使用redis分布式鎖解決并發(fā)線程資源共享問(wèn)題,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-07-07

