mirror of
https://github.com/hanzoai/s3.git
synced 2026-10-30 14:59:09 +00:00
The binary is s3 and the product is Hanzo S3; the rest of the tree now says so too. - Environment: WEED_* and SEAWEEDFS_* are S3_*, no aliases. fla9's flag prefix is S3, matching viper's existing "s3" prefix, so the S3_S3_SSE_* names mini.go exports are the ones viper reads (WEED_S3_SSE_KEK was never seen once viper moved to "s3"). - Java and Hadoop: packages, fs.hanzofs.* keys and the hanzofs:// scheme under the hanzofs namespace the protos already declare; classes take a neutral Filer prefix and file names match them again (the earlier pass left Seas3*.java holding Seaweed* classes). Client, hdfs3, examples, s3copier, random_access and the Spark tests compile. - Helm chart: helpers are hanzo.*, values live under global.s3; the chart renders and lints, which it did not before. - Terraform: the s3.service.tftpl reference matches the file; 12/12 render tests pass. Config paths point at /etc/hanzo, which the binary reads. - loadtest.pb.go regenerated from loadtest.proto. - Upstream logo, sponsor images and unreferenced diagrams removed from note/. Kept: NOTICE attribution, LICENSE, the erasure-coding fixture s3/storage/erasure_coding/1.dat (test bytes), and unmaintained/ and third_party/ (vendored). No on-disk format, wire protocol or metadata key changed. Co-authored-by: Hanzo Dev <[email protected]>
250 lines
7.0 KiB
Bash
Executable File
250 lines
7.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
BLUE='\033[0;34m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Configuration - assumes script is run from s3-rdma-sidecar directory
|
|
S3_DIR="$(realpath ..)"
|
|
SIDECAR_DIR="$(pwd)"
|
|
MOUNT_POINT="/tmp/hanzo-rdma-mount"
|
|
FILER_ADDR="localhost:8888"
|
|
SIDECAR_ADDR="localhost:8081"
|
|
|
|
# PIDs for cleanup
|
|
MASTER_PID=""
|
|
VOLUME_PID=""
|
|
FILER_PID=""
|
|
SIDECAR_PID=""
|
|
MOUNT_PID=""
|
|
|
|
cleanup() {
|
|
echo -e "\n${YELLOW}๐งน Cleaning up processes...${NC}"
|
|
|
|
# Unmount filesystem
|
|
if mountpoint -q "$MOUNT_POINT" 2>/dev/null; then
|
|
echo "๐ค Unmounting $MOUNT_POINT..."
|
|
fusermount -u "$MOUNT_POINT" 2>/dev/null || umount "$MOUNT_POINT" 2>/dev/null || true
|
|
sleep 1
|
|
fi
|
|
|
|
# Kill processes
|
|
for pid in $MOUNT_PID $SIDECAR_PID $FILER_PID $VOLUME_PID $MASTER_PID; do
|
|
if [[ -n "$pid" ]] && kill -0 "$pid" 2>/dev/null; then
|
|
echo "๐ช Killing process $pid..."
|
|
kill "$pid" 2>/dev/null || true
|
|
fi
|
|
done
|
|
|
|
# Wait for processes to exit
|
|
sleep 2
|
|
|
|
# Force kill if necessary
|
|
for pid in $MOUNT_PID $SIDECAR_PID $FILER_PID $VOLUME_PID $MASTER_PID; do
|
|
if [[ -n "$pid" ]] && kill -0 "$pid" 2>/dev/null; then
|
|
echo "๐ Force killing process $pid..."
|
|
kill -9 "$pid" 2>/dev/null || true
|
|
fi
|
|
done
|
|
|
|
# Clean up mount point
|
|
if [[ -d "$MOUNT_POINT" ]]; then
|
|
rmdir "$MOUNT_POINT" 2>/dev/null || true
|
|
fi
|
|
|
|
echo -e "${GREEN}โ
Cleanup complete${NC}"
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
wait_for_service() {
|
|
local name=$1
|
|
local url=$2
|
|
local max_attempts=30
|
|
local attempt=1
|
|
|
|
echo -e "${BLUE}โณ Waiting for $name to be ready...${NC}"
|
|
|
|
while [[ $attempt -le $max_attempts ]]; do
|
|
if curl -s "$url" >/dev/null 2>&1; then
|
|
echo -e "${GREEN}โ
$name is ready${NC}"
|
|
return 0
|
|
fi
|
|
echo " Attempt $attempt/$max_attempts..."
|
|
sleep 1
|
|
((attempt++))
|
|
done
|
|
|
|
echo -e "${RED}โ $name failed to start within $max_attempts seconds${NC}"
|
|
return 1
|
|
}
|
|
|
|
echo -e "${BLUE}๐ HANZO S3 RDMA MOUNT DEMONSTRATION${NC}"
|
|
echo "======================================"
|
|
echo ""
|
|
echo "This demo shows Hanzo mount with RDMA acceleration:"
|
|
echo " โข Standard Hanzo cluster (master, volume, filer)"
|
|
echo " โข RDMA sidecar for acceleration"
|
|
echo " โข FUSE mount with RDMA fast path"
|
|
echo " โข Performance comparison tests"
|
|
echo ""
|
|
|
|
# Create mount point
|
|
echo -e "${BLUE}๐ Creating mount point: $MOUNT_POINT${NC}"
|
|
mkdir -p "$MOUNT_POINT"
|
|
|
|
# Start Hanzo Master
|
|
echo -e "${BLUE}๐ฏ Starting Hanzo Master...${NC}"
|
|
cd "$S3_DIR"
|
|
./s3 master -port=9333 -mdir=/tmp/hanzo-master &
|
|
MASTER_PID=$!
|
|
wait_for_service "Master" "http://localhost:9333/cluster/status"
|
|
|
|
# Start Hanzo Volume Server
|
|
echo -e "${BLUE}๐พ Starting Hanzo Volume Server...${NC}"
|
|
./s3 volume -master=localhost:9333 -port=8080 -dir=/tmp/hanzo-volume &
|
|
VOLUME_PID=$!
|
|
wait_for_service "Volume Server" "http://localhost:8080/status"
|
|
|
|
# Start Hanzo Filer
|
|
echo -e "${BLUE}๐ Starting Hanzo Filer...${NC}"
|
|
./s3 filer -master=localhost:9333 -port=8888 &
|
|
FILER_PID=$!
|
|
wait_for_service "Filer" "http://localhost:8888/"
|
|
|
|
# Start RDMA Sidecar
|
|
echo -e "${BLUE}โก Starting RDMA Sidecar...${NC}"
|
|
cd "$SIDECAR_DIR"
|
|
./bin/demo-server --port 8081 --rdma-socket /tmp/rdma-engine.sock --volume-server-url http://localhost:8080 --enable-rdma --debug &
|
|
SIDECAR_PID=$!
|
|
wait_for_service "RDMA Sidecar" "http://localhost:8081/health"
|
|
|
|
# Check RDMA capabilities
|
|
echo -e "${BLUE}๐ Checking RDMA capabilities...${NC}"
|
|
curl -s "http://localhost:8081/stats" | jq . || curl -s "http://localhost:8081/stats"
|
|
|
|
echo ""
|
|
echo -e "${BLUE}๐๏ธ Mounting Hanzo with RDMA acceleration...${NC}"
|
|
|
|
# Mount with RDMA acceleration
|
|
cd "$S3_DIR"
|
|
./s3 mount \
|
|
-filer="$FILER_ADDR" \
|
|
-dir="$MOUNT_POINT" \
|
|
-rdma.enabled=true \
|
|
-rdma.sidecar="$SIDECAR_ADDR" \
|
|
-rdma.fallback=true \
|
|
-rdma.maxConcurrent=64 \
|
|
-rdma.timeoutMs=5000 \
|
|
-debug=true &
|
|
MOUNT_PID=$!
|
|
|
|
# Wait for mount to be ready
|
|
echo -e "${BLUE}โณ Waiting for mount to be ready...${NC}"
|
|
sleep 5
|
|
|
|
# Check if mount is successful
|
|
if ! mountpoint -q "$MOUNT_POINT"; then
|
|
echo -e "${RED}โ Mount failed${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
echo -e "${GREEN}โ
Hanzo mounted successfully with RDMA acceleration!${NC}"
|
|
echo ""
|
|
|
|
# Demonstrate RDMA-accelerated operations
|
|
echo -e "${BLUE}๐งช TESTING RDMA-ACCELERATED FILE OPERATIONS${NC}"
|
|
echo "=============================================="
|
|
|
|
# Create test files
|
|
echo -e "${BLUE}๐ Creating test files...${NC}"
|
|
echo "Hello, RDMA World!" > "$MOUNT_POINT/test1.txt"
|
|
echo "This file will be read via RDMA acceleration!" > "$MOUNT_POINT/test2.txt"
|
|
|
|
# Create a larger test file
|
|
echo -e "${BLUE}๐ Creating larger test file (1MB)...${NC}"
|
|
dd if=/dev/zero of="$MOUNT_POINT/large_test.dat" bs=1024 count=1024 2>/dev/null
|
|
|
|
echo -e "${GREEN}โ
Test files created${NC}"
|
|
echo ""
|
|
|
|
# Test file reads
|
|
echo -e "${BLUE}๐ Testing file reads (should use RDMA fast path)...${NC}"
|
|
echo ""
|
|
|
|
echo "๐ Reading test1.txt:"
|
|
cat "$MOUNT_POINT/test1.txt"
|
|
echo ""
|
|
|
|
echo "๐ Reading test2.txt:"
|
|
cat "$MOUNT_POINT/test2.txt"
|
|
echo ""
|
|
|
|
echo "๐ Reading first 100 bytes of large file:"
|
|
head -c 100 "$MOUNT_POINT/large_test.dat" | hexdump -C | head -5
|
|
echo ""
|
|
|
|
# Performance test
|
|
echo -e "${BLUE}๐ PERFORMANCE COMPARISON${NC}"
|
|
echo "========================="
|
|
|
|
echo "๐ฅ Testing read performance with RDMA acceleration..."
|
|
time_start=$(date +%s%N)
|
|
for i in {1..10}; do
|
|
cat "$MOUNT_POINT/large_test.dat" > /dev/null
|
|
done
|
|
time_end=$(date +%s%N)
|
|
rdma_time=$((($time_end - $time_start) / 1000000)) # Convert to milliseconds
|
|
|
|
echo "โ
RDMA-accelerated reads: 10 x 1MB file = ${rdma_time}ms total"
|
|
echo ""
|
|
|
|
# Check RDMA statistics
|
|
echo -e "${BLUE}๐ RDMA Statistics:${NC}"
|
|
curl -s "http://localhost:8081/stats" | jq . 2>/dev/null || curl -s "http://localhost:8081/stats"
|
|
echo ""
|
|
|
|
# List files
|
|
echo -e "${BLUE}๐ Files in mounted filesystem:${NC}"
|
|
ls -la "$MOUNT_POINT/"
|
|
echo ""
|
|
|
|
# Interactive mode
|
|
echo -e "${BLUE}๐ฎ INTERACTIVE MODE${NC}"
|
|
echo "=================="
|
|
echo ""
|
|
echo "The Hanzo filesystem is now mounted at: $MOUNT_POINT"
|
|
echo "RDMA acceleration is active for all read operations!"
|
|
echo ""
|
|
echo "Try these commands:"
|
|
echo " ls $MOUNT_POINT/"
|
|
echo " cat $MOUNT_POINT/test1.txt"
|
|
echo " echo 'New content' > $MOUNT_POINT/new_file.txt"
|
|
echo " cat $MOUNT_POINT/new_file.txt"
|
|
echo ""
|
|
echo "Monitor RDMA stats: curl http://localhost:8081/stats | jq"
|
|
echo "Check mount status: mount | grep hanzo"
|
|
echo ""
|
|
echo -e "${YELLOW}Press Ctrl+C to stop the demo and cleanup${NC}"
|
|
|
|
# Keep running until interrupted
|
|
while true; do
|
|
sleep 5
|
|
|
|
# Check if mount is still active
|
|
if ! mountpoint -q "$MOUNT_POINT"; then
|
|
echo -e "${RED}โ Mount point lost, exiting...${NC}"
|
|
break
|
|
fi
|
|
|
|
# Show periodic stats
|
|
echo -e "${BLUE}๐ Current RDMA stats ($(date)):${NC}"
|
|
curl -s "http://localhost:8081/stats" | jq '.rdma_enabled, .total_reads, .rdma_reads, .http_fallbacks' 2>/dev/null || echo "Stats unavailable"
|
|
echo ""
|
|
done
|