Add RedPanda_setup_guide
This commit is contained in:
69
RedPanda_setup_guide
Normal file
69
RedPanda_setup_guide
Normal file
@@ -0,0 +1,69 @@
|
||||
1) Update OS and install prerequisites
|
||||
# update
|
||||
apt update && apt upgrade -y
|
||||
# ensure basic tools exist
|
||||
apt install -y curl jq apt-transport-https ca-certificates gnupg lsb-release
|
||||
|
||||
|
||||
2) Install Docker (quick & reliable method)
|
||||
# run Docker install script (works for most Ubuntu versions)
|
||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||
sh get-docker.sh
|
||||
# enable and start docker
|
||||
systemctl enable --now docker
|
||||
|
||||
# add current user to docker group if not root (optional)
|
||||
# (you're root so this isn't required now)
|
||||
# usermod -aG docker <youruser>
|
||||
|
||||
3) Create a persistent data directory for Redpanda
|
||||
mkdir -p /var/lib/redpanda/data
|
||||
chown root:root /var/lib/redpanda/data
|
||||
chmod 700 /var/lib/redpanda/data
|
||||
|
||||
4) Pull the official Redpanda Docker image
|
||||
docker pull docker.redpanda.com/redpandadata/redpanda:latest
|
||||
|
||||
|
||||
5) Get the VM public IP (used for advertised address)
|
||||
PUBLIC_IP=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address || hostname -I | awk '{print $1}')
|
||||
echo "Public IP: $PUBLIC_IP"
|
||||
|
||||
6)Run Redpanda container (single-node POC)
|
||||
docker run -d --name redpanda \
|
||||
--restart unless-stopped \
|
||||
-p 9092:9092 \
|
||||
-p 9644:9644 \
|
||||
-p 8081:8081 \
|
||||
-v /var/lib/redpanda/data:/var/lib/redpanda/data \
|
||||
docker.redpanda.com/redpandadata/redpanda:v24.1.7 \
|
||||
redpanda start \
|
||||
--overprovisioned \
|
||||
--smp 1 \
|
||||
--check=false \
|
||||
--kafka-addr PLAINTEXT://0.0.0.0:9092 \
|
||||
--advertise-kafka-addr PLAINTEXT://${PUBLIC_IP}:9092
|
||||
|
||||
7) Verify container and logs
|
||||
# list container
|
||||
docker ps --filter name=redpanda
|
||||
# watch log
|
||||
docker logs -f redpanda
|
||||
|
||||
8) Test quickly (create topic + produce + consume)
|
||||
You can run rpk inside the running container to create topics and test:
|
||||
|
||||
# create a topic
|
||||
docker exec -it redpanda rpk topic create test-topic
|
||||
|
||||
# produce a message (type text, then Ctrl+D)
|
||||
docker exec -it redpanda rpk topic produce test-topic
|
||||
hello from redpanda
|
||||
# Ctrl+D
|
||||
|
||||
# consume messages (press Ctrl+C to exit)
|
||||
docker exec -it redpanda rpk topic consume test-topic --brokers ${PUBLIC_IP}:9092
|
||||
|
||||
|
||||
9) run the ui
|
||||
docker run -d --name redpanda-console -p 8082:8080 -e KAFKA_BROKERS=${PUBLIC_IP}:9092 docker.redpanda.com/redpandadata/console:latest
|
||||
Reference in New Issue
Block a user