25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cluster.md 1.9 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. ---
  2. id: cluster
  3. title: Clusters
  4. ---
  5. Cluster allows you group (or clustering) the nodes in an isolated group.
  6. ## Basic
  7. Cluster represents a local cluster context.
  8. You can create a cluster context with Cluster class. And you can also connect the nodes in a cluster to other nodes outside a cluster.
  9. ```python
  10. from diagrams import Cluster, Diagram
  11. from diagrams.aws.compute import ECS
  12. from diagrams.aws.database import RDS
  13. from diagrams.aws.network import Route53
  14. with Diagram("Simple Web Service with DB Cluster", show=False):
  15. dns = Route53("dns")
  16. web = ECS("service")
  17. with Cluster("DB Cluster"):
  18. db_master = RDS("master")
  19. db_master - [RDS("slave1"),
  20. RDS("slave2")]
  21. dns >> web >> db_master
  22. ```
  23. ![simple web service with db cluster diagram](/img/simple_web_service_with_db_cluster_diagram.png)
  24. ## Nested Clusters
  25. Nested clustering is also possible.
  26. ```python
  27. from diagrams import Cluster, Diagram
  28. from diagrams.aws.compute import ECS, EKS, Lambda
  29. from diagrams.aws.database import Redshift
  30. from diagrams.aws.integration import SQS
  31. from diagrams.aws.storage import S3
  32. with Diagram("Event Processing", show=False):
  33. source = EKS("k8s source")
  34. with Cluster("Event Flows"):
  35. with Cluster("Event Workers"):
  36. workers = [ECS("worker1"),
  37. ECS("worker2"),
  38. ECS("worker3")]
  39. queue = SQS("event queue")
  40. with Cluster("Processing"):
  41. handlers = [Lambda("proc1"),
  42. Lambda("proc2"),
  43. Lambda("proc3")]
  44. store = S3("events store")
  45. dw = Redshift("analytics")
  46. source >> workers >> queue >> handlers
  47. handlers >> store
  48. handlers >> dw
  49. ```
  50. ![event processing diagram](/img/event_processing_diagram.png)
  51. > There is no depth limit of nesting. Feel free to create nested clusters as deep as you want.