apollo配置搭建整合入门window环境idea工具

1.配置中心部署
1.1运行数据库创建脚本创建数据库
1.2.修改配置脚本script/build.bat,修改内容主要是配置数据库连接,运行脚本,无报错后查看target目录下配置文件数据库连接是否修改成功
注意:避免手工修改每个项目配置文件,防止出错

@echo off

rem apollo config db info
set apollo_config_db_url="jdbc:mysql://localhost:3306/apolloconfigdb?characterEncoding=utf8"
set apollo_config_db_username="root"
set apollo_config_db_password="666666"

rem apollo portal db info
set apollo_portal_db_url="jdbc:mysql://localhost:3306/apolloportaldb?characterEncoding=utf8"
set apollo_portal_db_username="root"
set apollo_portal_db_password="666666"

rem meta server url, different environments should have different meta server addresses
set dev_meta="http://localhost:8080"
set fat_meta="http://localhost:8080"
set uat_meta="http://localhost:8080"
set pro_meta="http://localhost:8080"

1.3.ConfigServiceApplication确认下是否配置为@EnableEurekaClient

1.4.启动顺序
一定要先启动 configserver, 然后是 adminserver, 然后是 portal
打开注册中心,检查服务有没有注册成功
http://localhost:8080/

1.5.启动apollo
localhost:8070
登录验证
apollo默认登录账号密码:
apollo/admin

2.apollo客户端整合
2.配置客户端
在这里插入图片描述

app:
  id: springboot-apollo
apollo:
  bootstrap:
    enabled: true
    eagerLoad:
      enabled: true
    # will inject 'application' and 'TEST1.apollo' namespaces in bootstrap phase
    namespaces: application
  meta: http://127.0.0.1:8080

logging:
  level:
    com:
      gf:
        controller: debug

timeout: 200
batch: 100

@RestController
public class DemoController {
    @Value("${timeout}")
    private String timeout;
    @GetMapping("/test")
    public String test(){
        return "111"+timeout;
    }
}

官方链接:
https://github.com/ctripcorp/apollo

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值