This diagram illustrates a data processing architecture utilising RabbitMQ to enable event-driven communication. This setup helps to parallelise and distribute the processing of large datasets across multiple nodes efficiently.
-
Event Producer Pod: This component reads spectrum data files from the mounted Spectral Volume. It creates events (chunks of data) and publishes these events to RabbitMQ.
-
RabbitMQ: Acts as the message broker, managing the distribution of data events to various Processor Pods.
-
Processor Pods: Each of these pods subscribes to the RabbitMQ queue to receive data events. The Event Receiver container within each pod writes a data file in a format suitable for the Starlight application. The file is saved to a shared volume accessible to both containers within the pod.
-
Starlight Application: This application, triggered by a bash script, processes the new data file and saves the results back to a shared volume on the Event Producer Pod.
- kubernetes (https://kubernetes.io/docs/setup/)
- kind (https://kind.sigs.k8s.io/)
- Kubernetes cluster and it's admin credentials for further actions
For local setup - additional requirement is Docker (https://www.docker.com/) and RabbitMQ instance (https://www.rabbitmq.com/docs/download)
-
Set up RabbitMQ and make sure that the credentials in producer.go and receive.go are used correctly according to local environment.
-
Build images of the processor, receiver and starlight from the given Dockerfiles.
docker build -t username/image_name .
- Run the images to get the functional result:
docker run username/image_name
From the producer should be seen the following result:
------------SENDING-------------
user user
pass pass
url amqp://user:pass@host:5672/
2024/07/05 00:29:23 Num Files = 8
2024/07/05 00:29:23 File = spectrum_0461.txt
2024/07/05 00:29:23 [x] Sent lambda flu
2024/07/05 00:29:23 Moving file to /processed dir
2024/07/05 00:29:23 Moved file to /docker/starlight/shared_directory/config_files_starlight/spectrum//processed/spectrum_0461.txt
2024/07/05 00:29:23 File = spectrum_xpos_00_ypos_00_NGC6027_LR-V.txt
From the receiver:
2024/07/05 00:32:26 ------------------ reveive() ---------------------
user user
pass pass
url amqp://user:pass@host:5672/
2024/07/05 00:32:26 [*] Waiting for messages. To exit press CTRL+C
2024/07/05 00:32:26 -------------------------- Iterating messages -------------------------------
2024/07/05 00:32:26 Read Flag = false
2024/07/05 00:32:26 Read Flag = false
2024/07/05 00:32:26 -------------------------- Received a message: spectrum_0461.txt -------------------------------
Writing message to data file
Useful UI tool - https://k8slens.dev/
The required files are located in:
ucm/deployment/.
- To check the status of your pods
kubectl get pods -n _namespace_
- To delete a deployment
kubectl delete deployment deployment_name -n your_namespace
- To verify if RabbitMQ service is healthy and running
kubectl get svc -n your_namespace
- To get the logs of a given pod
kubectl logs _podname_ -n _namespace_
- To execute command in a pod:
kubectl exec -it _podname_ -- /bin/ bash
First, we need to configure the volume, volumeclaim and rabbitmq:
kubectl apply -f ./volume.yaml -n _namespace_
kubectl apply -f ./volumeclaim.yaml -n _namespace_
kubectl apply -f ./deployment_rabbitmq.yaml -n _namespace_
kubectl apply -f _filename_ -n _namespace_
You should be able to see the following output (example):
deployment.apps/ucm-producer-deployment created
kubectl cp /some/path/to/inputfile . _podname_:/starlight/data/input/ -n _namespace_
The Output data can be viewed in the /starlight/data/output directory. You can either exec into the pod to view or copy down to local directory:
kubectl exec --stdin --tty _podname_ -n _namespace_ -- /bin/bash
cd /starlight/data/output
OR
kubectl cp _podname_:/starlight/data/output/ /some/local/dir/ -n _namespace_
