Skip to content

Deployment Overview of Apache Spark on Server

Prerequisites and Basic Requirements

To ensure a successful deployment, the server must meet the following requirements:

  • Operating System: Debian or Ubuntu.

  • Privileges: Root or sudo access is required for package installation and system configuration.

  • Java Runtime: Java (OpenJDK) must be installed. The specific version depends on the OS distribution:

  • For Ubuntu/Debian Bullseye: default-jdk (Java 11).

  • For Debian Bookworm: OpenJDK 17.

  • Network Requirements:

  • Access to archive.apache.org to download Spark binaries.

  • Outbound access for SSL certificate acquisition via Certbot.

FQDN of the final panel on the hostkey.in domain

The application is accessible via a specific subdomain template based on the server ID.

Parameter Value
Prefix spark
Domain hostkey.in
Full template spark{Server_ID}.hostkey.in

File and Directory Structure

The deployment utilizes several specific directories for configuration, data, and proxy management:

  • /root/nginx: Contains the Nginx Docker Compose file.

  • /data/nginx/user_conf.d/: Stores the Nginx virtual host configuration files.

  • /etc/environment: Used to define system-wide environment variables such as JAVA_HOME and SPARK_LOCAL_IP.

Application Installation Process

The installation of Apache Spark 3.5.3 is performed through a series of automated steps:

  1. System Update: The package manager cache is updated, and all existing packages are upgraded to their latest versions.

  2. Java Installation: The default-jdk package is installed to provide the necessary runtime environment.

  3. Environment Configuration:

  4. JAVA_HOME is set in /etc/environment pointing to the appropriate OpenJDK path.

  5. SPARK_LOCAL_IP is set to 127.0.0.1.

  6. Binary Download and Extraction:

  7. The Apache Spark 3.5.3 binary archive (spark-3.5.3-bin-hadoop3.tgz) is downloaded from the official Apache archives.

  8. The archive is extracted to the system.

  9. The downloaded .tgz file is removed after extraction to clean up the root directory.

  10. System Reboot: A system reboot is performed to ensure all environment variable changes are applied globally.

Access Rights and Security

  • Firewall/Ports: The application uses a reverse proxy to handle incoming traffic on port 443 (HTTPS).

  • SSL/TLS: SSL certificates are managed via Certbot within a Docker container to secure the connection.

  • Environment Isolation: System environment variables are configured to ensure Spark services bind correctly to local interfaces where necessary.

Docker Containers and Their Deployment

The deployment utilizes a Docker container to manage Nginx and SSL certificate renewal through a reverse proxy setup.

Container Name Image Ports/Network Volumes Environment Variables Restart Policy
nginx jonasal/nginx-certbot:latest host mode - nginx_secrets:/etc/letsencrypt
- /data/nginx/user_conf.d:/etc/nginx/user_conf.d
[email protected] unless-stopped

Application Update Instructions

To update the Apache Spark application:

  • Since the application is installed via manual binary extraction and system package management, updates require downloading the new version of the Spark binaries and replacing the existing installation files.

  • For the Nginx proxy component, use the following command in the /root/nginx directory:

    docker compose pull && docker compose up -d
    

Location of Configuration Files and Data

  • Nginx Proxy Config: /data/nginx/user_conf.d/spark{Server_ID}.hostkey.in.conf

  • Docker Compose File: /root/nginx/compose.yml

  • SSL Certificates: Managed within the nginx_secrets Docker volume and accessible to Nginx at /etc/letsencrypt/live/.

Available Ports for Connection

The following ports are used by the application services (accessible via the proxy):

Service Internal Port External Path / Location
Main Application 4040 /
Spark Master 8080 /master
Spark Worker 8081 /worker
Spark History Server 18080 /history

Proxy Servers

The application is served through an Nginx reverse proxy running in a Docker container. This proxy handles:

  • SSL termination using certificates obtained via Certbot.

  • Routing requests to the appropriate Spark sub-services (Master, Worker, History) based on the URL path.

  • WebSocket support for real-time communication.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×