Not the answer you need?
Register and ask your own question!
Many Forum changes were implemented on Tue 22 Sep. Read about new Ranks, Scoring, and Reactions.
Email [email protected] for any comments or concerns.

Replica Set with Percona MongoDB on Docker

rpedrerorpedrero ContributorCurrent User Role Novice
Hi all!

It's possible to run a cluster of mongodb in replica set with docker edition?

If yes, can anyone help me?

Many thanks

Comments

  • Akira KuroganeAkira Kurogane Percona Percona Staff Role
    Hi. There isn't any docker solution for a whole cluster from MongoDB (or Percona). There are single-container images, but those are stand-alones.

    This next part is conjecture, but I think the crowd that liked Docker moved on Kubernetes instead over the last couple of years, so I wouldn't expect there to be any movement with Docker + MongoDB coming in the future.

    Kubernetes on the other hand is adjusting towards having the operators that will work for distributed databases.

    Percona's Kubernetes Operator for MongoDB already supports a (non-sharded) replicaset of 3+ nodes. MongoDB currently support a Kubernetes image that installs Ops Manager agents, but that is Ops Manager (paid product) that controls the mongod nodes, not Kubernetes.

    Sharded cluster topology support in Percona's Kubernetes Operator for MongoDB is coming. https://jira.percona.com/browse/CLOUD-329
  • rpedrerorpedrero Contributor Current User Role Novice
    I'm trying to execute mongodb with this config:

    services:
    mongo:
    image: percona/percona-server-mongodb
    command: --dbpath=/data/db -profile=2 -slowms=200 -rateLimit=100 --keyFile /data/keyfile --replSet rs0 --bind_ip localhost,10.1.0.15

    restart: always
    ports:
    - "27017:27017"
    environment:
    MONGO_INITDB_ROOT_USERNAME: xxxx
    MONGO_INITDB_ROOT_PASSWORD: xxxx
    volumes:
    - ./mongodb/:/data/db
    - ./security.keyfile:/data/keyfile

    keyfile with correct permissions, etc.

    When I try to start only with bindip = localhost, mongodb starts correctly.

    But when I add another node, I have the next error:


    mongo_1 | + exec mongod --dbpath=/data/db -profile=2 -slowms=200 -rateLimit=100 --keyFile /data/keyfile --replSet rs0 --bind_ip localhost,10.1.0.14 --auth --sslMode disabled
    mongo_1 | 2019-10-14T15:06:59.603+0000 I STORAGE [main] Max cache overflow file size custom option: 0
    mongo_1 | 2019-10-14T15:06:59.606+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
    mongo_1 | 2019-10-14T15:06:59.622+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=mongodb-2
    mongo_1 | 2019-10-14T15:06:59.623+0000 I CONTROL [initandlisten] db version v4.0.12-6
    mongo_1 | 2019-10-14T15:06:59.623+0000 I CONTROL [initandlisten] git version: da989eba899f9163ee9e3591bda7084d5217d4ed
    mongo_1 | 2019-10-14T15:06:59.624+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017
    mongo_1 | 2019-10-14T15:06:59.624+0000 I CONTROL [initandlisten] allocator: tcmalloc
    mongo_1 | 2019-10-14T15:06:59.625+0000 I CONTROL [initandlisten] modules: none
    mongo_1 | 2019-10-14T15:06:59.625+0000 I CONTROL [initandlisten] build environment:
    mongo_1 | 2019-10-14T15:06:59.625+0000 I CONTROL [initandlisten] distarch: x86_64
    mongo_1 | 2019-10-14T15:06:59.625+0000 I CONTROL [initandlisten] target_arch: x86_64
    mongo_1 | 2019-10-14T15:06:59.625+0000 I CONTROL [initandlisten] options: { net: { bindIp: "localhost,10.1.0.14", ssl: { mode: "disabled" } }, operationProfiling: { mode: "all", rateLimit: 100, slowOpThresholdMs: 200 }, replication: { replSet: "rs0" }, security: { authorization: "enabled", keyFile: "/data/keyfile" }, storage: { dbPath: "/data/db" } }
    mongo_1 | 2019-10-14T15:06:59.626+0000 E STORAGE [initandlisten] Failed to set up listener: SocketException: Cannot assign requested address
    mongo_1 | 2019-10-14T15:06:59.626+0000 I CONTROL [initandlisten] now exiting
    mongo_1 | 2019-10-14T15:06:59.626+0000 I CONTROL [initandlisten] shutting down with code:48
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.