1、从git上将apollo代码clone下来
git init
git clone https://github.com/ctripcorp/apollo.git
Checking out files: 100% (1311/1311), done.
2、导入脚本到对应数据库这里用自己linux服务中的mysql
脚本是在clone下的项目scripts/sql下的两个脚本,未避免执行脚本报错,修改mysql的sql_mode值
[root@VM_0_11_centos etc]# vi /etc/my.cnf
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
##没有sql_mode则添加,有则修改删除ONLY_FULL_GROUP_BY
[root@VM_0_11_centos etc]# systemctl restart mysqld.service
--可查看apollo部署的环境
select `Id`, `Key`, `Value`, `Comment` from `ApolloPortalDB`.`ServerConfig` limit 1;
3、查看8070、8080、8090端口是否被占用
netstat -anp |grep 8070
netstat -anp |grep 8080
netstat -anp |grep 8090
4、获取安装包:GitHub地址:https://github.com/ctripcorp/apollo/releases
5、放置到服务器的home目录下
Apollo服务端安装包共有3个:apollo-configservice, apollo-adminservice, apollo-portal
#解压zip包 例如apollo-configservice-1.6.1-github
[root@VM_0_11_centos soft]# mv apollo-configservice-1.6.1-github /home/soft/apollo-configservice-1.6.1-github
[root@VM_0_11_centos apollo-configservice-1.6.1-github]# unzip apollo-configservice-1.6.1-github.zip
6、修改ApolloConfigDB数据库里的ServerConfig表里的eureka.service.url=http://127.0.0.1:8080/eureka/,http://127.0.0.1:5001/eureka/
这里可以修改成自己服务的注册中心
7、修改各个服务对应的数据库以及环境等,这里只记录configService服务的服务端和客户端的开启和关闭
[root@VM_0_11_centos config]# vi application-github.properties
# DataSource
spring.datasource.url = jdbc:mysql://localhost:3306/ApolloConfigDB?characterEncoding=utf8
spring.datasource.username = root
spring.datasource.password = root
apollo.eureka.server.enabled=false
apollo.eureka.client.enabled=true
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"application-github.properties" 8L, 242C
8、启动顺序 configservice – adminservice-- portalservice --http://localhost:8070,访问 Web 管理页面。账号:apollo,密码:admin。localhost换成自己的ip