mongodb1:
    image: mongo:4.4.6
    container_name: mongodb1
    networks:
      yewu-network:
        ipv4_address: 192.168.177.61
    restart: always
    environment:
      - MONGO_INITDB_ROOT_USERNAME=admin
      - MONGO_INITDB_ROOT_PASSWORD=SfrZlryFjcpIvWHV
    ports:
      - 27017:27017
    volumes:
      - ./mongodb1-data:/data/db
    entrypoint:
      - sh
      - -euc
      - |
        cat <<'EOF'> /data/replica.key
        koZpwlmElilPVpIm+hFeuMuOikAITJz0yhz7H8DJ28HSDiZQb76EE77MbY/V47Jf2MQKTU9
        AJW8L9dCcwr+iJ/nszZ4cj/xOikAITJQP7hQb+Aa+uR+iqZ0nFBMdMWozFKUxBhe
        uapG/A==
        EOF
        chown mongodb:mongodb /data/replica.key
        chmod 600 /data/replica.key
        docker-entrypoint.sh mongod --bind_ip_all --wiredTigerCacheSizeGB 2 --auth --keyFile /data/replica.key
最后修改:2023 年 11 月 03 日
如果觉得我的文章对你有用,请随意赞赏