NOTE: PLEASE BID ON THIS IF YOU CAN HANDLE PYTHON CODE. I HAVE LIMITED TIME
Learning Goal: I’m working on a programming project and need support to help me learn.
I need assistance with an assignment. I’ve completed the ZooKeeper code, which successfully selects a leader among multiple servers. The next task is to extend the leader’s responsibilities to forward messages between the worker servers. Here’s how it works: You have to run a docker
1. ZooKeeper has already chosen a leader from the available servers.
2. A client sends a message in the form of `
3. Any server could receive the message from client (even if it’s not the leader) but the non-leader cannot save it until it receives it from the leader.
4. If The leader receives the message, saves it, and then forwards `
5- In cases where the client sends a message to a server that is not the leader:
– The server will forward the message to the actual leader.
– The leader will save the message and distribute it to the worker servers.
6. Each server, including the leader, maintains its local store to save the `
This setup ensures that all servers, whether acting as leaders or workers, can receive and store the messages sent by the clients. The leader plays a pivotal role in message distribution and synchronization among the worker servers.
I attached my code to build your code in it – the communications will be locally and I need to have some senior to ensure the code runs smoothly.
for the server file : python server.py –host
The connection between servers locally by REST protocol
I need to make sure that :
1- Add and Read: Start 3 servers. The servers elect a leader and all add requests are routed
to the leader. Subsequent Read requests of the key can be fetched from any of the server.
2- Leader election: Same as above but kill the leader node. A new leader is elected and all
subsequent requests is routed to the new leader.
3- Stale Read: The killed leader is back online but is not the leader and may have stale data
(if main data store was updated). Since the key value is in memory, it will return empty
until the key was updated. Once key value is updated, the server will output the updated
value
import requests #
Initialize server and connect to ZooKeeper for leader election
def receive_data(key, value):
if is_leader():
send_to_other_servers(key, value)
else:
forward_to_leader(key, value)
def is_leader or leader_addres():
def send_to_other_servers(key, value):
def forward_to_leader(key, value):
Requirements: As much as they can
NOTE: The hardest part that I couldn’t get is how to know the leader’s IP address and port locally for the leader server, so the non-leader can send him the message.
How each server will have its local storage when it receives the
1 min ago
the assignment has to has 4 files : client, serve, test,yml
we can can run 3 server in the terminal
Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount