安装APIGateway Server前,请先安装ESB Governor!
本节包含以下几部分内容。
- 安装
- 放置License许可文件
- 配置
- 启动服务
- 卸载
# 安装
创建“D:\primeton\APIGateway\Primeton_APIGateway_9.0.0_Server”目录。
用解压工具将 “Primeton_APIGateway_9.0.0_Server.zip” 解压至 “Primeton_APIGateway_9.0.0_Server” 目录。
# 放置License许可文件
APIGateway Server缺省带的许可有五个并发限制,可满足项目开发需要;若项目做性能测试,默认许可不满足要求时,请联系普元客服(cservice@primeton.com)申请临时License。
将申请到的许可证“primetonlicense.xml”文件拷贝到${API_GATEWAY安装目录}\license文件夹下,例如:D:\Primeton_APIGateway_9.0.0_Server\license\primetonlicense.xml。
# 配置
1.首先配置redis开启监听,修改redis中的redis.conf配置文件修改notify-keyspace-events属性,修改为如下配置: notify-keyspace-events AKE。
2.重启redis。
3.修改${API_GATEWAY安装目录}\config目录下application.properties配置文件。 具体修改项如下:
server.port=6201
management.endpoints.web.exposure.include=*
management.endpoints.web.exposure.exclude=service-registry
spring.application.name=API-GATEWAY
spring.cloud.discovery.enabled=true
spring.cloud.gateway.discovery.locator.enabled=false
spring.cloud.gateway.discovery.locator.route-id-prefix=
spring.cloud.gateway.enabled=true
spring.cloud.gateway.loadbalancer.use404=true
#Whether to allow direct backend https access
spring.cloud.gateway.httpclient.ssl.useInsecureTrustManager=false
#Configuration of redis
spring.redis.lettuce.pool.max-active=100
spring.redis.lettuce.pool.max-idle=${spring.redis.lettuce.pool.max-active}
spring.redis.lettuce.pool.max-wait=10s
spring.redis.lettuce.pool.min-idle=10
spring.redis.lettuce.shutdown-timeout=5s
spring.redis.timeout=10s
spring.redis.host=127.0.0.1
spring.redis.password=
spring.redis.port=6379
spring.profiles.active=eureka,nacos
esb.collector.global.intervalTime = 10000
elasticsearch.enabled=true
elasticsearch.ioThreadCount=50
elasticsearch.connectTimeout=600
elasticsearch.maxTotal=10000
elasticsearch.maxPerRoute=1000
elasticsearch.numberOfShards=1
elasticsearch.numberOfReplicas=0
elasticsearch.refreshInterval=10s
elasticsearch.username=elastic
elasticsearch.password=000000
elasticsearch.certificate=F:/http_ca.crt
elasticsearch.hosts[0].ip=0.0.0.0
elasticsearch.hosts[0].port=9200
elasticsearch.hosts[0].protocol=https
elasticsearch.types.log = primeton_esb_log_
elasticsearch.types.nodeLog = primeton_esb_node_log_
elasticsearch.types.systemResource = primeton_esb_system_resource_
elasticsearch.types.systemThread = primeton_esb_system_thread_
elasticsearch.types.module = primeton_esb_module_
elasticsearch.types.moduleThread = primeton_esb_thread_
elasticsearch.types.endpointState = primeton_esb_endpoint_state_
elasticsearch.types.mgState = primeton_esb_mg_state_
#Whether to enable alert notification
gateway.exception.notification.enable=true
#Alert notification address
gateway.exception.notification.path=127.0.0.1:8080
参数 | 说明 |
---|---|
spring.redis.enable | 是否使用Redis,集群模式下使用频度控制并需要统一计数时配置true,否则false。 |
spring.redis.timeout | Redis连接超时时间。 |
spring.redis.host | Redis服务IP。 |
spring.redis.port | Redis服务端口。 |
elasticsearch.enabled | 是否使用ElasticSearch作为日志存储,默认为false。 |
elasticsearch.hosts.ip | 配置成安装ElasticSearch的机器IP地址。 |
elasticsearch.hosts.port | ElasticSearch 的启动端口号。默认为9200,需要和1.2 Elasticsearch |
elasticsearch.hosts.port | ElasticSearch 的启动端口号。默认为9200,需要和01.2 Elasticsearch“elasticsearch-8.1.2/config/elasticsearch.yml”文件中配置的http.port一致。 |
elasticsearch.username | ElasticSearch 的访问用户名,默认为elastic |
elasticsearch.password | ElasticSearch 的访问密码,密码为安装elasticsearch时设置的密码 |
elasticsearch.certificate | ElasticSearch的访问证书的存储位置,位置配置为绝对路径。该证书可以从%elasticsearch安装目录%/config/certs/http_ca.crt获取。 |
esb.collector.global.intervalTime | ESB Server的日志采集时间默认10000ms,单位毫秒 |
esb.collector.sys.resource.enabled | 是否采集系统的资源数据(CPU、内存等),默认为true。 |
esb.collector.sys.thread.enabled | 是否采集系统的线程数据,默认为true。 |
esb.collector.module.state.enabled | 是否采集模型的统计数据,默认为true。 |
esb.collector.module.thread.enabled | 是否采集模型的线程数据,默认为true。 |
esb.collector.module.endpoint.enabled | 是否采集模型的endpoint数据,默认为true。 |
esb.collector.mq.state.enabled | 是否采集MQ的统计数据,默认为true。 |
gateway.exception.notification.path | 需配置成ESB Governor的ip和端口, 主要用于网关异常通知。 |
# 启动服务
1.在"${API_GATEWAY安装目录}/bin"下,执行如下命令,启动API_GATEWAY。
startup.bat
启动成功后,控制台会显示具体日志,如下图所示:。
# 卸载
- 在"${API_GATEWAY安装目录}/bin"目录下,执行如下命令,停止API_GATEWAY服务。
./shutdown.bat
- 停止服务后,可以直接删除${API_GATEWAY安装目录}进行卸载。