一.我们没有使用springcloud,只是将application.yml写在了应用外面。
rest-wechat.sh,指定了端口、启动级别、配置文件路径、启动的jar
kill -9 $(ps -ef | grep xichuan.wechat.jar | grep -v 'grep' | awk '{print $2}')
java -Djava.security.egd=file:/dev/./urandom
-server.port=80
-Dspring.profiles.active=dev
-Dspring.config.location=/root/configs/application.yml
-jar xichuan.wechat.jar &
二.我们使用到了springcloud,且需要从config-server中拉去配置文件。
rest-wechat.sh,指定了启动jar,eureka地址,启动级别,端口,bootstrap.yml启动配置文件。
kill -9 $(ps -ef | grep xichuan-wechat.jar | grep -v 'grep' | awk '{print $2}')
java -Djava.security.egd=file:/dev/./urandom
-jar xichuan-wechat.jar
-Deureka.client.serviceUrl.defaultZone=http://11.11.11.11:2001/eureka
-Dspring.profiles.active=prod
-server.port=80
-Dspring.config.location=/root/xichuan/bootstrap.yml &
bootstrap.yml配置文件如下:
server:
port: 80
eureka:
instance:
preferIpAddress: true
leaseRenewalIntervalInSeconds: 1
leaseExpirationDurationInSeconds: 2
nonSecurePort: ${server.port}
client:
serviceUrl:
defaultZone: http://11.11.11.11:2001/eureka/
spring:
application:
name: wechat
cloud:
config:
profile: dev
discovery:
enabled: true
serviceId: xichuan-config-server
github上有我更多的笔记:Raray-chuan (兮川) · GitHub,欢迎stars与following,如果有问题可以在issue中向我咨询
关注我的公众号,获取更多关于后端、大数据的知识