Fluentd — ตัวรวบรวมบันทึก สองเป้าหมาย
ตัวอย่างAggregate ที่
- Docker Compose สำหรับ
การ พัฒนา ภายใน เครื่อง และ - Recipe helm แบบ
สังเคราะห์ ที่รัน อิมเมจ อัปสตรีม อย่าง เป็น ทางการ fluent/fluentdโดยตรงบน Kubernetes (ไม่มี chart ภายนอก)
Recipe helm แบบhelm/fluentd-chart เรนเดอร์ chart ของ
aggregate.yaml ไฟล์
บทบาท aggregator
ไปป์ไลน์forward รับ
เนื่องจาก aggregator รับuses ทางprovides เพื่อ
ไฟล์
| ไฟล์ | บทบาท |
|---|---|
aggregate.yaml | เจตนาaggregator (core/observability/fluentd) ที่ |
manifest-compose.yaml | แมปcompose/fluentd) |
manifest-helm-synth.yaml | แมปhelm/fluentd) |
release-compose.yaml / release-helm-synth.yaml | บันทึก |
release-helm-synth-buffer.yaml | การinfra.storage.size) |
เนื่องจากfluentd Manifests จึงcompose/fluentd และ helm/fluentd
สิ่งที่ตัวอย่างนี้แสดง
- พื้น
ผิว Aggregate เดียวการ เขียน เดียว หลาย เป้า หมาย เป็น คือแหล่ง ความ จริง ว่า สแตก อะไร Manifest แต่ละรายการ อย่างไรบอก ว่า จะ ทำให้ เป็น รูป ธรรม - ปลาย
ทาง aggregator เผยฝั่ง รับ ของ ท่อ สตริง (String Pipe) แพร่ ปลาย ทาง forward ผ่าน providesคือhost(บริการของ aggregator) และ port(24224) บนโปรโตคอล forwardforwarder ที่ผูก กับ ส่วน ประกอบ นี้ ส่ง ผ่าน สตริง เหล่า นั้น เข้า สู่ เอาต์พุต forward ของ ตัว เอง คอมไพเลอร์ ส่ง ต่อ สตริง โดย ไม่ ตีความ - การ
สังเคราะห์ Workload (Kubernetes) Recipe helm แบบสังเคราะห์ ประกาศ Workload ซึ่ง เป็น Deployment บวก ClusterIP Service ที่ รัน อิมเมจ อย่าง เป็น ทางการ fluent/fluentdโดยผู้ ให้ บริการ helm แปลง เป็น แมนิเฟสต์ Kubernetes โดย ไม่มี chart ภายนอก ชุด ทรัพยากร ที่ เรนเดอร์ คือ สิ่ง ที่ Workload ประกาศ ทุก ประการ - การ
กำหนด การเส้น ทาง ที่ นัก พัฒนา ควบคุม จับ คู่ เอาต์พุต ของ นัก พัฒนา เลือก ว่า รายการ บันทึก ที่ รับ มา รายการ ใด ถูก ส่ง ต่อ ไป ยัง เอาต์พุต ของ aggregator ค่า เริ่ม ต้น คือ **ซึ่งส่ง ต่อ รายการ บันทึก ที่ รับ มา ทุก รายการ - บัฟเฟอร์
ชั่วคราว aggregator บัฟเฟอร์โดย ค่า เริ่ม ต้น แบบ คงทน เมื่อ ร้องขอ ใน หน่วย ความ จำ การ เรนเดอร์ ค่า เริ่ม ต้น จึง ไม่มี วอลุ่ม ถาวร การ ตั้ง infra.storage.size(ดูrelease-helm-synth-buffer.yaml) ทำให้บัฟเฟอร์ มี วอลุ่ม คงทน เมานต์ ที่ /fluentd/logรองรับ และเวิร์กโหลด ยัง คง เป็น Deployment แบบ เรพลิกา เดียว - อิมเมจ
ที่ สร้าง ซ้ำ ได้ infra.engine_versionปักหมุด แท็ก อิมเมจ ของ Fluentd เวิร์กโหลด ที่ เรนเดอร์ จึง อ้างอิง อิมเมจ ที่ คงที่ และ Recipe แบบ สังเคราะห์ ไม่ เรนเดอร์ แท็ก แบบ ลอย
ร่างตัวอย่าง
คุณ
เขียน
aggrega draft --example fluentd-aggregatorจาก
cd fluentd-aggregatorบิลด์
พื้นที่.aggrega-config.yaml เอนทิตีhub.aggrega.ai และ--auto-pull เขียน
# Local development (Docker Compose)aggrega build --release release-compose.yaml --auto-pull
# Kubernetes (synthesized helm Recipe, official image)aggrega build --release release-helm-synth.yaml --auto-pull
# Kubernetes with a durable buffer volumeaggrega build --release release-helm-synth-buffer.yaml --auto-pullอาร์ติแฟกต์dist/
กับผู้ช่วย AI
ผู้
ใช้เฉพาะเครื่องมือของ Aggrega และอย่าสร้างโฟลเดอร์เอง หากโฟลเดอร์พื้นที่ทำงานยังไม่มีโฟลเดอร์ `fluentd-aggregator` เรียกเครื่องมือ `draft` หนึ่งครั้งโดยตั้ง `example` เป็น `fluentd-aggregator` และไม่ระบุ `dir` เครื่องมือจะเขียนตัวอย่างลงในโฟลเดอร์ `fluentd-aggregator` ใหม่ จากนั้นเรียกเครื่องมือ `build` หนึ่งครั้งต่อ Release แต่ละรายการ ตามลำดับนี้ คือ `release-compose.yaml` แล้ว `release-helm-synth.yaml` แล้ว `release-helm-synth-buffer.yaml` โดยแต่ละครั้งตั้ง `workspace_root` เป็น `fluentd-aggregator` ตั้ง `release` เป็นไฟล์นั้น ตั้ง `auto_pull` เป็น true และตั้ง `write` เป็น true บอกฉันว่าการบิลด์แต่ละครั้งเขียนไฟล์ใดบ้าง ไฟล์เหล่านั้นอยู่ใต้ `fluentd-aggregator/dist/`หน้าตาของปลายทาง forward
บน Compose aggregator เขียน fluent.conf ที่forward ผูก
<source> @type forward bind 0.0.0.0 port 24224</source><match **> @type stdout</match>บน Kubernetes Recipe helm แบบfluent.conf ฉบับ
spec: type: ClusterIP [… omitted: the selector matching the aggregator's Pods] ports: - name: forward port: 24224 targetPort: forwardDeployment อ้างอิง
image: fluent/fluentd:v1.19.3-debian-2.1[… omitted: the start-up command that writes the fluent.conf shown above]ports: - name: forward containerPort: 24224เมื่อinfra.storage.size Recipe จะ/fluentd/log เพื่อ
วิธีรัน (Compose)
aggrega build --release release-compose.yaml --auto-pulldocker compose -f dist/app/compose/docker-compose.yaml up -daggregator รับlocalhost:24224 ส่งdocker compose -f dist/app/compose/docker-compose.yaml down