Answered step by step
Verified Expert Solution
Question
1 Approved Answer
lease write as may scripts as necessary in Python 3 to do the following. You are allowed use any 3rd libraries and/or frameworks. The easiest
lease write as may scripts as necessary in Python 3 to do the following. You are allowed use any 3rd libraries and/or frameworks. The easiest Python library to use for such purpose is here. 1. The first part is an mqtt broker running locally into your computer (localhost) by using the image eclipse-mosquitto. Then do the following: a. Initialize a single-node Docker Swarm. Try to name the swarm. Is it possible? b. Print out the ID, name, and creation date of the Swarm. c. Creates a network named "se443_test_net", using the "overlay" driver, "global" scope, and with an IP CIDR range of 10.10.10.0/24. d. Print out the ID, name, and creation date of the network. e. Deploys a service named "broker" with three (3) replicas of the docker image. i. You will also have to configure the service to automatically restart (always). 2. The second part has a subscriber and a publisher again running from your local computer with the docker image efrecon/mqtt-client. By using as many as necessary Python scripts you have to publish/subscribe to the above mqtt broker. The topic has to be "alfaisal_uni" and the messages have to be where XX will be an increasing counter. Send and receive as many messages as you need to exhibit the above implementation. a. Deploy a service named "subscriber" with three (3) replicas of the efrecon/mqtt-client docker image b. Deploy a service named "publisher" with three (3) replicas of the efrecon/mqtt-client docker image c. You will also have to configure the services to automatically restart (a/ways) d. Your code should print out the names, IDs, and number of running replicas of both server and client services. e. Start publishing messages to the broker, so your code can show how multiple subscriber replicas subscribe to the same topic of multiple broker replicas and multiple publisher replicas send multiple messages. Do craft your messages as you wish (e.g., 1.1.1) to exhibit the above random behaviours. 3. Make all your code run for a set amount of time (e.g., 5 minutes), sends a number of messages, and then shut down cleanly, cleaning up after itself to bring down services, remove the overlay network, and finally tear down the Docker Swarm(s)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started