开发者社区> 问答> 正文

Swarm mode 集群服务编排的日志



模板版本的支持


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

展开
收起
反向一觉 2017-10-30 15:11:31 1778 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
PostgresChina2018_赖思超_PostgreSQL10_hash索引的WAL日志修改版final 立即下载
Kubernetes下日志实时采集、存储与计算实践 立即下载
日志数据采集与分析对接 立即下载