RabbitMQ Messaging & Async Systems · บทเรียน

โฮสต์เสมือนเพื่อแยกผู้เช่าหลายราย

ใช้โฮสต์เสมือนของ RabbitMQ เพื่อแยก exchange คิว และสิทธิ์ระหว่างทีม หรือสภาพแวดล้อม ซึ่งเป็นรากฐานของการติดตั้งระบบหลายผู้เช่าที่ปลอดภัย

บทเรียน 4 จาก 413 ขั้นตอน

โฮสต์เสมือนเพื่อแยกผู้เช่าหลายราย เป็นบทเรียน RabbitMQ Messaging & Async Systems ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน RabbitMQ Messaging & Async Systems และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส RabbitMQ Messaging & Async Systems มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Why Isolation Matters

Sharing one broker across teams or environments risks name clashes and accidental cross-access. Virtual hosts (vhosts) partition a broker into isolated namespaces.

What Is a Virtual Host?

A vhost is a logical grouping of exchanges, queues, bindings, and permissions. Resources in one vhost are invisible to another, even with identical names.

The Default Vhost

RabbitMQ ships with a default vhost named /. Production setups usually create dedicated vhosts instead of using the default for everything.

Creating a Vhost

Create vhosts via the CLI.

rabbitmqctl add_vhost team-payments

Granting Permissions per Vhost

Permissions are scoped to a vhost. Grant a user configure, write, and read access with regex patterns.

rabbitmqctl set_permissions -p team-payments alice '.*' '.*' '.*'

Connecting to a Vhost

Clients select a vhost in the connection parameters; the same credentials may have different rights in different vhosts.

params = pika.ConnectionParameters(host='localhost', virtual_host='team-payments')

Isolation in Practice

  • Queue orders in vhost A is separate from orders in vhost B
  • A user without permission on a vhost cannot even see it
  • Resource limits can be applied per vhost

Vhost vs Separate Brokers

Vhosts give logical isolation on shared infrastructure, cheaper than running many brokers, but they share the same node resources (CPU, memory, disk).

Per-Vhost Limits

You can cap the number of connections and queues per vhost to stop one tenant from starving others.

rabbitmqctl set_vhost_limits -p team-payments '{"max-connections": 100, "max-queues": 50}'

Monitoring per Vhost

The management plugin shows metrics broken down by vhost, so you can track each tenant's message rates, queue depths, and connection counts independently.

Security Best Practices

  • One vhost per team or environment
  • Least-privilege permission regexes
  • Avoid the default vhost for real workloads
  • Apply per-vhost limits

Quick Check

Test your vhost understanding.

Recap

Virtual hosts partition a single broker into isolated namespaces with their own resources, permissions, and limits.

Use one vhost per team or environment, apply least-privilege permissions and per-vhost limits, and avoid the default vhost for production traffic.

เริ่มต้นได้ฟรี

เรียนรู้ RabbitMQ Messaging & Async Systems ด้วย AI tutor — ฟรี

เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป

คอร์ส
11
บทเรียน
44

คำถามที่พบบ่อย

บทเรียน “โฮสต์เสมือนเพื่อแยกผู้เช่าหลายราย” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “โฮสต์เสมือนเพื่อแยกผู้เช่าหลายราย” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส RabbitMQ Messaging & Async Systems ให้อัปเกรดเป็น CoddyKit PRO คอร์ส RabbitMQ Messaging & Async Systems มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “โฮสต์เสมือนเพื่อแยกผู้เช่าหลายราย”

ใช้โฮสต์เสมือนของ RabbitMQ เพื่อแยก exchange คิว และสิทธิ์ระหว่างทีม หรือสภาพแวดล้อม ซึ่งเป็นรากฐานของการติดตั้งระบบหลายผู้เช่าที่ปลอดภัย คุณปฏิบัติ RabbitMQ Messaging & Async Systems ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน RabbitMQ Messaging & Async Systems หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน RabbitMQ Messaging & Async Systems บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน

บทเรียน “โฮสต์เสมือนเพื่อแยกผู้เช่าหลายราย” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน RabbitMQ Messaging & Async Systems นี้ได้ไหม

ได้ บทเรียน RabbitMQ Messaging & Async Systems ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. ผู้ใช้และสิทธิ์ของ RabbitMQ
  2. SSL/TLS สำหรับการเชื่อมต่อที่ปลอดภัย
  3. ปลั๊กอินจัดการ RabbitMQ และเมตริก
  4. โฮสต์เสมือนเพื่อแยกผู้เช่าหลายราย
← กลับไปที่ RabbitMQ Messaging & Async Systems