Guest User

Untitled

a guest
Jul 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. version: '3.2'
  2. services:
  3. shard1:
  4. hostname: shard1
  5. deploy:
  6. placement:
  7. constraints:
  8. - node.labels.label == server1
  9. image: mongo
  10. command: mongod --shardsvr --replSet mongo_shard --dbpath /data/db --bind_ip 0.0.0.0 --port 9603
  11. ports:
  12. - 9603:9603
  13. volumes:
  14. - /etc/localtime:/etc/localtime:ro
  15. - ./data1:/data/db
  16.  
  17. shard2:
  18. hostname: shard2
  19. deploy:
  20. placement:
  21. constraints:
  22. - node.labels.label == server2
  23. image: mongo
  24. command: mongod --shardsvr --replSet mongo_shard --dbpath /data/db --bind_ip 0.0.0.0 --port 9604
  25. ports:
  26. - 9604:9604
  27. volumes:
  28. - /etc/localtime:/etc/localtime:ro
  29. - ./data2:/data/db
  30.  
  31. shard3:
  32. hostname: shard3
  33. deploy:
  34. placement:
  35. constraints:
  36. - node.labels.label == server4
  37. image: mongo
  38. command: mongod --shardsvr --replSet mongo_shard --dbpath /data/db --bind_ip 0.0.0.0 --port 9605
  39. ports:
  40. - 9605:9605
  41. volumes:
  42. - /etc/localtime:/etc/localtime:ro
  43. - ./data3:/data/db
  44.  
  45.  
  46. config1:
  47. hostname: config1
  48. deploy:
  49. placement:
  50. constraints:
  51. - node.labels.label == server1
  52. image: mongo
  53. command: mongod --configsvr --replSet mongo_config --dbpath /data/db --bind_ip 0.0.0.0 --port 27017
  54. ports:
  55. - 27017:27017
  56. volumes:
  57. - /etc/localtime:/etc/localtime:ro
  58. - ./config1:/data/db
  59.  
  60. config2:
  61. hostname: config2
  62. deploy:
  63. placement:
  64. constraints:
  65. - node.labels.label == server2
  66. image: mongo
  67. command: mongod --configsvr --replSet mongo_config --dbpath /data/db --bind_ip 0.0.0.0 --port 27027
  68. ports:
  69. - 27027:27027
  70. volumes:
  71. - /etc/localtime:/etc/localtime:ro
  72. - ./config2:/data/db
  73.  
  74. config3:
  75. hostname: config3
  76. deploy:
  77. placement:
  78. constraints:
  79. - node.labels.label == server4
  80. image: mongo
  81. command: mongod --configsvr --replSet mongo_config --dbpath /data/db --bind_ip 0.0.0.0 --port 27037
  82. ports:
  83. - 27037:27037
  84. volumes:
  85. - /etc/localtime:/etc/localtime:ro
  86. - ./config3:/data/db
  87.  
  88.  
  89. mongos1:
  90. hostname: mongos1
  91. image: mongo
  92. depends_on:
  93. - config1
  94. - config2
  95. command: mongos --configdb mongo_config/config1:27017,config2:27027,config3:27037 --bind_ip 0.0.0.0 --port 9606
  96. ports:
  97. - 9606:9606
  98. volumes:
  99. - /etc/localtime:/etc/localtime:ro
  100.  
  101. mongos2:
  102. hostname: mongos2
  103. image: mongo
  104. depends_on:
  105. - config1
  106. - config2
  107. command: mongos --configdb mongo_config/config1:27017,config2:27027,config3:27037 --bind_ip 0.0.0.0 --port 9607
  108. ports:
  109. - 9607:9607
  110. volumes:
  111. - /etc/localtime:/etc/localtime:ro
  112.  
  113.  
  114.  
  115. # For Mongo Config
  116. # {
  117. # _id: "mongo_config",
  118. # configsvr: true,
  119. # members: [
  120. # { _id : 0, host : "config1:27017" },
  121. # { _id : 1, host : "config2:27027" },
  122. # { _id : 2, host : "config3:27037" }
  123. # ]
  124. # }
  125.  
  126.  
  127. # For Mongo Shard
  128. # {
  129. # _id: "mongo_shard",
  130. # members: [
  131. # { _id : 0, host : "shard1:9603" },
  132. # { _id : 1, host : "shard2:9604" },
  133. # { _id : 2, host : "shard3:9605" }
  134. # ]
  135. # }
Add Comment
Please, Sign In to add comment