iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 14
1

Install

Docker

ubuntu

mac

Mongos Cluster yaml

    $ sudo echo "127.0.0.1 mongo1\n127.0.0.1 mongo2\n127.0.0.1 mongo3" >> /etc/hosts

docker-componse.yml

version: "3.7"
services:
  mongo1:
    container_name: mongo1
    image: mongo
    ports:
      - 27017:27017
    restart: always
    entrypoint: [ "mongod","--port","27017", "--bind_ip_all",   "--replSet", "rs0" ]
  mongo2:
    container_name: mongo2
    image: mongo
    ports:
      - 27027:27027
    restart: always
    entrypoint: [ "mongod","--port","27027", "--bind_ip_all",   "--replSet", "rs0" ]
  mongo3:
    container_name: mongo3
    image: mongo
    ports:
      - 27037:27037
    restart: always
    entrypoint: [ "mongod","--port","27037", "--bind_ip_all",   "--replSet", "rs0" ]
    healthcheck:
      test: ["CMD","mongo","--host","mongo1","--port","27017",  "--eval", 'rs.initiate( { _id : "rs0",members: [{ _id: 0,     host: "mongo1:27017" },{ _id: 1, host: "mongo2:27027" },{   _id: 2, host: "mongo3:27037" }   ]})']
      interval: 15s
      timeout: 10s
      retries: 3
      start_period: 10s
    $ docker-compose up

上一篇
聊天需求
下一篇
React Native Navigation
系列文
I Shot You 不小心30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言