Apollo分布式注册和配置中心的安装和配置

550 字
3 分钟
Apollo分布式注册和配置中心的安装和配置
  • Github地址

  • 快速部署教程

    一、准备工作#

    1、配置JDK环境#

    2、安装MySQL5.7.29#

    3、下载Quick Start安装包#

    1. 从Github下载
    2. 从百度网盘下载
      • 通过网盘链接下载
      • 下载到本地后,在本地解压apollo-quick-start.zip
  • 安装zip解压软件

    Terminal window
    yum install zip
    yum install unzip
  • 将从网盘下载的apollo-quick-start.zip包上传到/opt/apollo下并解压

    Terminal window
    cd /opt
    mkdir apollo
    chmod 755 apollo
    #解压
    unzip apollo-quick-start-1.5.0.zip
    #将包移走
    mv apollo-quick-start-1.5.0.zip ../
  • 创建ApolloPortalDB通过各种MySQL客户端导入sql/apolloportaldb.sql即可

  • 创建ApolloConfigDB通过各种MySQL客户端导入sql/apolloconfigdb.sql即可

  • 配置数据库连接信息

    Terminal window
    #编辑启动脚本文件 注意:不要修改demo.sh的其它部分 最好把localhost改成你的IP 这里不改了
    vim demo.sh
    apollo_config_db_url=jdbc:mysql://localhost:3306/ApolloconfigDB?characterEncoding=utf8
    apollo_config_db_username=root
    apollo_config_db_password=root
    # apollo portal db info
    apollo_portal_db_url=jdbc:mysql://localhost:3306/ApolloportalDB?characterEncoding=utf8
    apollo_portal_db_username=root
    apollo_portal_db_password=root
    # meta server url
    config_server_url=http://localhost:8080
    admin_server_url=http://localhost:8090
    eureka_service_url=$config_server_url/eureka/
    portal_url=http://localhost:8070
  • 确保端口未被占用

    Terminal window
    yum install lsof
    lsof -i:8070
    lsof -i:8080
    lsof -i:8090
  • 启动Apollo配置中心

    Terminal window
    #执行启动脚本
    ./demo.sh start
    #当看到如下输出后,就说明启动成功了
    ==== starting service ====
    Service logging file is ./service/apollo-service.log
    Started [21476]
    Waiting for config service startup......
    Config service started. You may visit http://localhost:8080 for service status now!
    Waiting for admin service startup..
    Admin service started
    ==== starting portal ====
    Portal logging file is ./portal/apollo-portal.log
    Started [21734]
    Waiting for portal startup......
    Portal started. You can visit http://localhost:8070 now!
  • 初始化Apollo配置中心 打开http://192.168.123.5:8070 用户名apollo,密码admin

    image-20200314003114699
    image-20200314003114699

    image-20200314003154318
    image-20200314003154318

    如果遇到提示系统出错,请重试或联系系统负责人,请稍后几秒钟重试一下,因为通过Eureka注册的服务有一个刷新的延时

  • 如果启动遇到了异常,可以分别查看service和portal目录下的log文件排查问题。

    注:在启动apollo-configservice的过程中会在日志中输出eureka注册失败的信息,如com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused。需要注意的是,这个是预期的情况,因为apollo-configservice需要向Meta Server(它自己)注册服务,但是因为在启动过程中,自己还没起来,所以会报这个错。后面会进行重试的动作,所以等自己服务起来后就会注册正常了。

文章分享

如果这篇文章对你有帮助,欢迎分享给更多人!

Apollo分布式注册和配置中心的安装和配置
https://tianch.com.cn/posts/tutorials/apollo-fen-bu-shi-zhu-ce-he-pei-zhi-zhong-xin-de-an-zhuang-he-pei-zhi/
作者
田小晖
发布于
2020-03-14
许可协议
CC BY-NC-SA 4.0
Profile Image of the Author
田小晖
记录技术成长,分享运维与开发经验。
公告
分类
标签
站点统计
文章
134
分类
9
标签
29
总字数
203,962
运行时长
0
最后活动
0 天前
站点信息
构建平台
Cloudflare Pages
博客版本
Firefly v6.15.6
文章许可
CC BY-NC-SA 4.0