开发者社区> 问答> 正文

Swarm mode 集群服务编排的日志

反向一觉 2017-10-30 15:11:31 1156


模板版本的支持


Compose V1/V2 和 Compose V3 版本的编排模板均支持 log 标签,且语法相同。

功能概述


和阿里云日志服务集成,采集容器日志并且发送到阿里云日志服务。更多详细信息,参见 开启日志服务
[backcolor=transparent]编排示例:
[backcolor=transparent]Compose V1/V2 示例:
  1. [backcolor=transparent]mysql[backcolor=transparent]:
  2. [backcolor=transparent]    image[backcolor=transparent]:[backcolor=transparent] mysql
  3. [backcolor=transparent]    ports[backcolor=transparent]:
  4. [backcolor=transparent]        [backcolor=transparent]-[backcolor=transparent] [backcolor=transparent]80
  5. [backcolor=transparent]    labels[backcolor=transparent]:
  6. [backcolor=transparent]        aliyun[backcolor=transparent].[backcolor=transparent]scale[backcolor=transparent]:[backcolor=transparent] [backcolor=transparent]"1"
  7. [backcolor=transparent]    environment[backcolor=transparent]:
  8. [backcolor=transparent]        [backcolor=transparent]-[backcolor=transparent] MYSQL_ROOT_PASSWORD[backcolor=transparent]=[backcolor=transparent]password
  9. [backcolor=transparent]wordpress[backcolor=transparent]:
  10. [backcolor=transparent]    image[backcolor=transparent]:[backcolor=transparent] registry[backcolor=transparent].[backcolor=transparent]aliyuncs[backcolor=transparent].[backcolor=transparent]com[backcolor=transparent]/[backcolor=transparent]jiangjizhong[backcolor=transparent]/[backcolor=transparent]wordpress
  11. [backcolor=transparent]    ports[backcolor=transparent]:
  12. [backcolor=transparent]        [backcolor=transparent]-[backcolor=transparent] [backcolor=transparent]80
  13. [backcolor=transparent]    labels[backcolor=transparent]:
  14. [backcolor=transparent]        aliyun[backcolor=transparent].[backcolor=transparent]routing[backcolor=transparent].[backcolor=transparent]port_80[backcolor=transparent]:[backcolor=transparent] wordpress[backcolor=transparent]-[backcolor=transparent]with[backcolor=transparent]-[backcolor=transparent]log
  15. [backcolor=transparent]        aliyun[backcolor=transparent].[backcolor=transparent]log_store_dbstdout[backcolor=transparent]:[backcolor=transparent] stdout   [backcolor=transparent]#注意这里
  16. [backcolor=transparent]    links[backcolor=transparent]:
  17. [backcolor=transparent]        [backcolor=transparent]-[backcolor=transparent] mysql

[backcolor=transparent]Compose V3 示例:
  1. [backcolor=transparent]version[backcolor=transparent]:[backcolor=transparent] [backcolor=transparent]'3'
  2. [backcolor=transparent]services[backcolor=transparent]:
  3. [backcolor=transparent]  web[backcolor=transparent]:
  4. [backcolor=transparent]    image[backcolor=transparent]:[backcolor=transparent] wordpress[backcolor=transparent]:[backcolor=transparent]4
  5. [backcolor=transparent]    ports[backcolor=transparent]:
  6. [backcolor=transparent]      [backcolor=transparent]-[backcolor=transparent] [backcolor=transparent]80
  7. [backcolor=transparent]    depends_on[backcolor=transparent]:
  8. [backcolor=transparent]      [backcolor=transparent]-[backcolor=transparent] mysql
  9. [backcolor=transparent]    deploy[backcolor=transparent]:
  10. [backcolor=transparent]      replicas[backcolor=transparent]:[backcolor=transparent] [backcolor=transparent]3
  11. [backcolor=transparent]      restart_policy[backcolor=transparent]:
  12. [backcolor=transparent]        condition[backcolor=transparent]:[backcolor=transparent] on[backcolor=transparent]-[backcolor=transparent]failure
  13. [backcolor=transparent]    labels[backcolor=transparent]:
  14. [backcolor=transparent]      aliyun[backcolor=transparent].[backcolor=transparent]routing[backcolor=transparent].[backcolor=transparent]port_80[backcolor=transparent]:[backcolor=transparent] wordpress
  15. [backcolor=transparent]      aliyun[backcolor=transparent].[backcolor=transparent]log_store_dbstdout[backcolor=transparent]:[backcolor=transparent] stdout   [backcolor=transparent]#注意这里
  16. [backcolor=transparent]  mysql[backcolor=transparent]:
  17. [backcolor=transparent]    image[backcolor=transparent]:[backcolor=transparent] mysql[backcolor=transparent]:[backcolor=transparent]5.7
  18. [backcolor=transparent]    environment[backcolor=transparent]:
  19. [backcolor=transparent]      [backcolor=transparent]-[backcolor=transparent] MYSQL_ROOT_PASSWORD[backcolor=transparent]=[backcolor=transparent]password
  20. [backcolor=transparent]    deploy[backcolor=transparent]:
  21. [backcolor=transparent]      restart_policy[backcolor=transparent]:
  22. [backcolor=transparent]        condition[backcolor=transparent]:[backcolor=transparent] on[backcolor=transparent]-[backcolor=transparent]failure
分享到
取消 提交回答
全部回答(0)
+ 订阅

时时分享云计算技术内容,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。

推荐文章