Tuesday, August 6, 2019

Starting RabbitMQ, Redis and MondoDB Docker Containers

MacOS 10.14.6
Docker Engine 19.03.1


Goals:
  • Install and test these two Broker/Message Systems.

Install:
  • Create the RabbitMQ Container:
    • docker container create --hostname rabbitmq --name rabbitmq-3.6 -p 5672:5672 -p 15672:15672 -p 25672:25672 rabbitmq:3.6-management
  • Start the RabbitMQ Container:
    • docker start rabbitmq-3.6
  • Install MQTT Plugin for RabbitMQ:
    • docker exec -it rabbitmq-3.6 bash
      • rabbitmq-plugins enable rabbitmq_mqtt
  • Create the Redis Container:
    • docker container create --name=redis -p 6379:6379 redis:alpine
  • Start the Redis Container:
    • docker start redis
  • Create the MongoDB Container:
    • docker container create --name=mongodb-3.6 -p 27017:27017 mongo:3.6
    • OR, to start the container automatically when they exit, or when Docker restarts.
      • docker container create --name=mongodb-3.6 -p 27017:27017 --restart always mongo:3.6
  • Start the MongoDB Container:
    • docker start mongodb-3.6


Test:

  • Check if the containers are running:
    • docker ps
  • RabbitMQ:
    • Open the url http://localhost:15672 and enter `guest` as username and also as password.

More Information:
    • db.updateUser("user_to_update", { ...  })
    • use db_to_remove
    • db.dropDatabase()


  • Superuser Roles
      • The following roles provide the ability to assign any user any privilege on any database, which means that users with one of these roles can assign themselves any privilege on any database:
        • dbOwner role - when scoped to the admin database
        • userAdmin role - when scoped to the admin database
        • userAdminAnyDatabase role
      • The following role provides full privileges on all resources:
        • root role - provides access to the operations and all the resources of the readWriteAnyDatabase, dbAdminAnyDatabase, userAdminAnyDatabase, clusterAdmin, restore, and backup combined


  • Rename Database
      • mongo --port 27017 -u "<USER>" -p --authenticationDatabase "admin"
      • db.copyDatabase("old-db-name","new-db-name")
      • use old-db-name
      • db.dropDatabase()


    References:
    If you like this content, feel free to