以github上的apollo-quick-start搭建运行为例
本地win10上安装jdk和mysql,apollo跑在虚拟机Centos上;
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](http://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]#
[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://blog.csdn.net/sndayYU/article/details/96421964
内容来源于网络,如有侵权,请联系作者删除!