Apollo(二)-单机环境搭建


以github上的apollo-quick-start搭建运行为例

前提

本地win10上安装jdk和mysql,apollo跑在虚拟机Centos上;

  • jdk1.8
  • mysql5.7、navicat
  • 虚拟机上Centos7

搭建

1)下载Demo:https://github.com/nobodyiam/apollo-build-scripts
2)解压到本地“E:\YDSource\appolo\apollo-quick-start”:
在这里插入图片描述

数据库配置

1)利用navicat运行sql文件夹下的两个sql文件
在这里插入图片描述
在这里插入图片描述
2)修改登录数据库,以便虚拟机能访问本地Mysql
在这里插入图片描述
并赋予ip访问权限
在这里插入图片描述

C:\WINDOWS\system32>mysql -uroot -p
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.23 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>

3)重启数据库
在这里插入图片描述
4)修改配置文件“E:\YDSource\appolo\apollo-quick-start\demo.sh”,其中192.168.0.137为本地服务器的ip,123456位mysql的登录密码;
在这里插入图片描述

虚拟机部署

1)关闭防火墙

systemctl stop firewalld

2)利用xftp复制项目到服务器
在这里插入图片描述
3)修改文件夹权限

[root@localhost apollo-quick-start]# chmod 777 -R /usr/local/apollo-quick-start
[root@localhost apollo-quick-start]# 

测试

启动apollo

[root@localhost ~]# cd /usr/local/apollo-quick-start/

[root@localhost apollo-quick-start]# ./demo.sh start
==== starting service ====
Service logging file is ./service/apollo-service.log
Started [8723]
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 [8949]
Waiting for portal startup.........
Portal started. You can visit http://localhost:8070 now!
[root@localhost apollo-quick-start]#

在这里插入图片描述

浏览器访问

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

客户端测试

启动并查看timeout的值:

Last login: Thu Jul 18 06:12:16 2019
[root@localhost ~]# cd /usr/local
[root@localhost local]# cd apollo-quick-start/
[root@localhost apollo-quick-start]# ./demo.sh client

[apollo-demo][main]2019-07-18 06:43:24,246 INFO  [com.ctrip.framework.foundation.internals.provider.DefaultApplicationProvider] App ID is set to SampleApp by app.id property from /META-INF/app.properties
[apollo-demo][main]2019-07-18 06:43:24,249 INFO  [com.ctrip.framework.foundation.internals.provider.DefaultServerProvider] Environment is set to [dev] by JVM system property 'env'.
[apollo-demo][main]2019-07-18 06:43:24,315 INFO  [com.ctrip.framework.apollo.internals.DefaultMetaServerProvider] Located meta services from apollo.meta configuration: http://localhost:8080!
[apollo-demo][main]2019-07-18 06:43:24,316 INFO  [com.ctrip.framework.apollo.core.MetaDomainConsts] Located meta server address http://localhost:8080 for env DEV from com.ctrip.framework.apollo.internals.DefaultMetaServerProvider
Apollo Config Demo. Please input key to get the value. Input quit to exit.
> timeout
Loading key : timeout with value: 100
> timeout
Loading key : timeout with value: 100
> 

修改值并观察客户端
在这里插入图片描述
在这里插入图片描述
可以看到最后,提示了修改:
在这里插入图片描述

参考

官网文档:https://github.com/ctripcorp/apollo/wiki/Quick-Start

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值