java -D 配置系统属性 

# 启动时加参数 -DDUBBO_IP_TO_REGISTRY= 192.168.1.1  该ip为dubbo所在服务器的公网ip即可。
java -jar  myDubboRpc-api.jar  -DDUBBO_IP_TO_REGISTRY= 192.168.1.1 

# xjar启动
nohup ./xjar java -DDUBBO_IP_TO_REGISTRY=11.22.33.44 -XX:+UseG1GC -jar $SERVER_NAME  --spring.profiles.active=$SERVER_ENV  &> nohup.out  &

 java -Ddubbo_ip_to_registry=192.168.99.230 -jar seller.jar

dcoker

finance-task:
  image: 192.168.99.182:8082/bessky-finance-task
  container_name: bessky-finance-task
  restart: always
  environment:
    - NACOS_CONFIG_SERVERADDR
    - NACOS_CONFIG_NAMESPACE
    - DUBBO_IP_TO_REGISTRY
    - XXL_JOB_EXECUTOR_IP
    - JASYPT_ENCRYPTOR_PASSWORD
    - JAVA_OPTS="-Xms4g -Xmx4g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump"
    - logging.appender.ref=FILE
    - logging.file=logs/debug.log
    - logging.level.root=ERROR
    - logging.level.com.bessky.finance=DEBUG
    - xxl.job.executor.log-path=logs/job
  volumes:
    - ./logs/task:/logs
    - ./dump/task:/dump
    - ./logs/task/job:/logs/job
  ports:
    - 20703:20703
    - 20704:20704

环境变量配置/etc/profile


export DUBBO_IP_TO_REGISTRY=192.168.99.11
export XXL_JOB_EXECUTOR_IP=192.168.99.11
export NACOS_CONFIG_SERVERADDR=192.168.99.57:8848
export NACOS_CONFIG_NAMESPACE=a7b74b8d-0eeb-4cbc
export JASYPT_ENCRYPTOR_PASSWORD=basdfs15
export AES_ENCRYPTOR_SEED=8740#aDxdasd211215
export SPRING_DATA_ELASTICSEARCH_CLUSTERNODES=192.168.99.59:9300
export LOGGING_APPENDER_REF=FILE
export LOGGING_FILE=logs/debug.log
export ZK_INSTANCE_IP=192.168.99.11

docker run -d \
  --name dubbo-nacos-provider \
  -e DUBBO_IP_TO_REGISTRY="192.168.28.130" \
  -p 20880:20880 \
  registry.cn-guangzhou.aliyuncs.com/zlt-test/nacos-provider:1.0-SNAPSHOT

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐