springboot启动脚本

一.我们没有使用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中向我咨询

关注我的公众号,获取更多关于后端、大数据的知识

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值