New price cuts across every cluster configuration! Up to 35% off Starter Kits and saves hundreds depending on the cluster configuration!

How to Run Elasticsearch as a Docker Container on the Raspberry Pi 5

Learn how to deploy and run Elasticsearch as a Docker container on your Raspberry Pi 5. This guide covers the complete setup process with optimizations specific to ARM64 architecture and the Pi 5's performance characteristics.

In this comprehensive guide, we'll walk you through running Elasticsearch in Docker containers on ARM architecture on your Desktop Datacenter. Whether you're building a home lab or managing an edge computing environment, this tutorial will help you leverage your PicoCluster for lightweight search and analytics workloads on your ARM-based Desktop Datacenter.

Prerequisites

Before we begin, ensure you have the following:

  • Hardware: Raspberry Pi 5 with 8GB RAM, 64GB+ high-speed microSD card or SSD
  • Software: Raspberry Pi OS 64-bit or Ubuntu 22.04+ for ARM64, Docker installed
  • Network: All nodes connected and accessible via SSH
  • Knowledge: Basic Docker commands and Linux terminal experience
  • Kubernetes: K8s must already be installed - see our guides for installing Docker on Raspberry Pi 5, K3s installation, or MicroK8s

Background & Context

Elasticsearch traditionally runs on x86 architecture, but with ARM64 support and the Raspberry Pi 5's improved performance, it's now feasible to run lightweight Elasticsearch workloads on ARM-based systems. This setup is perfect for development, testing, or small-scale search applications.

Your Desktop Datacenter provides the perfect environment for building ARM-based search solutions, creating development environments, or learning search technologies without the overhead of traditional server hardware. Unlike traditional cloud solutions, your PicoCluster gives you complete control over your infrastructure while keeping costs low and learning opportunities high.

Step-by-Step Implementation

Step 1: Prerequisites Verification

Verify your ARM64 system is ready and has proper dependencies:

bash
# Check architecture and system resources
uname -m  # Should show aarch64
free -h
df -h

# Verify Docker installation and ARM64 support
docker --version
docker info | grep Architecture

# Check available storage
lsblk
sudo fdisk -l

Step 2: ARM64-Specific System Configuration

Configure system settings optimized for ARM64 and Pi 5 limitations:

bash
# Increase virtual memory for Elasticsearch (ARM64 optimized)
sudo sysctl -w vm.max_map_count=262144

# Set swappiness for better memory management on Pi 5
sudo sysctl -w vm.swappiness=1

# Make settings permanent
echo 'vm.max_map_count=262144' | sudo tee -a /etc/sysctl.conf
echo 'vm.swappiness=1' | sudo tee -a /etc/sysctl.conf

# Increase file descriptor limits
echo '* soft nofile 65536' | sudo tee -a /etc/security/limits.conf
echo '* hard nofile 65536' | sudo tee -a /etc/security/limits.conf

# Verify settings
sudo sysctl vm.max_map_count vm.swappiness

Step 3: Prepare Storage for Elasticsearch

Set up optimized storage configuration for the Pi 5:

bash
# Create Elasticsearch directories with proper permissions
sudo mkdir -p /opt/elasticsearch/{data,config,logs}

# Set ownership for Elasticsearch user (UID 1000 in container)
sudo chown -R 1000:1000 /opt/elasticsearch/

# Verify permissions
ls -la /opt/elasticsearch/

Step 4: Create ARM64-Optimized Configuration

Create Elasticsearch configuration optimized for Raspberry Pi 5 ARM64:

yaml
# Create elasticsearch.yml optimized for Pi 5
sudo tee /opt/elasticsearch/config/elasticsearch.yml << 'EOF'
# Cluster configuration
cluster.name: "rpi5-elasticsearch-cluster"
node.name: "rpi5-node-1"

# Network configuration
network.host: 0.0.0.0
http.port: 9200

# Path configuration
path.data: /usr/share/elasticsearch/data
path.logs: /usr/share/elasticsearch/logs

# Memory settings (conservative for Pi 5)
bootstrap.memory_lock: false  # Disabled due to ARM64 limitations

# Discovery configuration
discovery.type: single-node

# Security (disabled for development)
xpack.security.enabled: false
xpack.security.enrollment.enabled: false

# ARM64 performance optimizations
thread_pool.search.queue_size: 100
thread_pool.write.queue_size: 200
indices.memory.index_buffer_size: 128mb
indices.queries.cache.size: 64mb
indices.fielddata.cache.size: 128mb

# Disable machine learning (not supported on ARM64)
xpack.ml.enabled: false

# Disable monitoring to save resources
xpack.monitoring.enabled: false
EOF

sudo chown 1000:1000 /opt/elasticsearch/config/elasticsearch.yml

Step 5: Deploy ARM64 Elasticsearch Container

Deploy Elasticsearch using the official ARM64 image:

bash
# Pull ARM64 Elasticsearch image
sudo docker pull docker.elastic.co/elasticsearch/elasticsearch:8.11.0

# Run Elasticsearch with Pi 5 optimizations
sudo docker run -d \
  --name elasticsearch-rpi5 \
  --restart unless-stopped \
  -p 9200:9200 \
  -p 9300:9300 \
  -e "ES_JAVA_OPTS=-Xms1g -Xmx2g -XX:+UseG1GC" \
  -e "discovery.type=single-node" \
  -e "xpack.security.enabled=false" \
  -e "xpack.ml.enabled=false" \
  -e "cluster.name=rpi5-cluster" \
  -e "bootstrap.memory_lock=false" \
  -v /opt/elasticsearch/data:/usr/share/elasticsearch/data \
  -v /opt/elasticsearch/config:/usr/share/elasticsearch/config \
  -v /opt/elasticsearch/logs:/usr/share/elasticsearch/logs \
  --ulimit nofile=65536:65536 \
  --memory=3g \
  --cpus=3 \
  docker.elastic.co/elasticsearch/elasticsearch:8.11.0

Step 6: Verify and Test ARM64 Deployment

Verify that Elasticsearch is running correctly on ARM64:

bash
# Check container status
sudo docker ps | grep elasticsearch

# Monitor container startup (may take 2-3 minutes on Pi 5)
sudo docker logs -f elasticsearch-rpi5

# Test Elasticsearch API (wait for startup to complete)
sleep 60
curl -X GET "localhost:9200/"

# Check cluster health
curl -X GET "localhost:9200/_cluster/health?pretty"

# Verify ARM64 architecture in node info
curl -X GET "localhost:9200/_nodes?pretty" | grep -A5 -B5 "architecture"

Step 7: ARM64 Performance Testing

Test Elasticsearch performance on the Pi 5 ARM64 architecture:

json
# Create a test index with ARM64 optimizations
curl -X PUT "localhost:9200/rpi5-test" -H 'Content-Type: application/json' -d '
{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0,
    "index.refresh_interval": "30s",
    "index.translog.flush_threshold_size": "256mb"
  },
  "mappings": {
    "properties": {
      "timestamp": { "type": "date" },
      "cpu_temp": { "type": "float" },
      "cpu_usage": { "type": "float" },
      "memory_usage": { "type": "float" },
      "message": { "type": "text" }
    }
  }
}'

# Add sample IoT/sensor data (typical Pi use case)
curl -X POST "localhost:9200/rpi5-test/_doc" -H 'Content-Type: application/json' -d '
{
  "timestamp": "'$(date -Iseconds)'",
  "cpu_temp": 65.5,
  "cpu_usage": 45.2,
  "memory_usage": 67.8,
  "message": "Pi 5 sensor reading example"
}'

# Test search performance
curl -X GET "localhost:9200/rpi5-test/_search" -H 'Content-Type: application/json' -d '
{
  "query": {
    "range": {
      "cpu_temp": { "gte": 60 }
    }
  }
}'

Desktop Datacenter Integration

Home Lab Applications:

  • IoT sensor data collection and search
  • Personal log aggregation from Pi-based projects
  • Small-scale document search for home automation
  • Development and testing of ARM-based search solutions

Educational Benefits:

  • Understanding ARM64 deployment considerations
  • Learning resource optimization for constrained environments
  • Hands-on experience with cross-platform Docker deployment
  • Performance tuning for embedded systems

Professional Development:

  • ARM64 deployment experience for edge computing
  • Cost-effective development environment for search applications
  • Understanding of performance constraints and optimization
  • Cross-architecture containerization skills

Troubleshooting

Container fails to start due to memory constraints: Reduce heap size to -Xms512m -Xmx1g for 4GB Pi 5 models, ensure swap is enabled

Elasticsearch runs very slowly on ARM64: Disable memory lock (bootstrap.memory_lock=false), use SSD instead of SD card, monitor for thermal throttling

ARM64 image not found or architecture errors: Verify you are using ARM64 OS (uname -m shows aarch64), pull specific ARM64 image tag if needed

High CPU temperature and throttling: Improve cooling, reduce JVM heap size, consider active cooling solutions for sustained workloads

Performance Optimization

For optimal ARM64 performance, use fast storage (SSD over SD card), monitor CPU temperature to prevent throttling, and tune JVM garbage collection settings. The Pi 5's improved performance makes it viable for development workloads, but production use should consider clustering multiple Pi units.

Conclusion

You now have Elasticsearch running efficiently on your Raspberry Pi 5's ARM64 architecture. This setup demonstrates the versatility of modern ARM processors for search workloads while providing a cost-effective platform for development and learning.

Your PicoCluster Desktop Datacenter provides an excellent platform for running Elasticsearch in Docker containers on ARM architecture. This setup not only saves costs compared to cloud alternatives but also provides valuable hands-on experience with enterprise-grade technologies.

Related Products & Resources

Explore our range of Desktop Datacenter solutions:

For additional support and documentation, visit our support center.

Leave a comment

Please note, comments must be approved before they are published

What are you looking for? Have questions or feedback?