doushan1850 2019-06-25 16:51
浏览 93
已采纳

我应该在哪里存储服务注册服务器的端点?

I'm learning about microservices recently. I tried using consul for service discovery. I wonder if I deploy the consul server, so where should i store endpoint of that server? Is it good to hard code in env variable of each services?

  • 写回答

1条回答 默认 最新

  • doudi8519 2019-06-26 00:33
    关注

    All of the 3 following options are supported in the following precedence order:

    1. Command line arguments
    2. Environment Variables
    3. Configuration files

    For the Linux Configuration File Option

    Create

    /etc/consul.d/config.json

    The key is start_join with value of the IP of Consul server e.g.,

    "start_join": [ "10.128.0.2" ]
    

    For a cluster solution of more than one Consul instances:

    "start_join": [ "10.128.0.2", "10.128.0.3" ]
    

    The default server port is 8300 but you may override with the ports object offering multiple ports to override e.g.,

    "ports": {
       "server": 8300
    }
    

    For a full reference of the available options, you may check the Consul Documentation, and all the available ports options

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮