惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Spread Privacy
Spread Privacy
P
Palo Alto Networks Blog
P
Proofpoint News Feed
AI
AI
Help Net Security
Help Net Security
S
Securelist
T
Troy Hunt's Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
Cisco Blogs
Scott Helme
Scott Helme
Hacker News - Newest:
Hacker News - Newest: "LLM"
Vercel News
Vercel News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
B
Blog
GbyAI
GbyAI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed
S
Security Affairs
Cisco Talos Blog
Cisco Talos Blog
AWS News Blog
AWS News Blog
T
Tenable Blog
H
Help Net Security
NISL@THU
NISL@THU
F
Fortinet All Blogs
博客园_首页
G
GRAHAM CLULEY
L
LINUX DO - 最新话题
P
Privacy International News Feed
G
Google Developers Blog
博客园 - Franky
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Security Archives - TechRepublic
Security Archives - TechRepublic
The Register - Security
The Register - Security
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
T
Tor Project blog
P
Privacy & Cybersecurity Law Blog
量子位
C
Cyber Attacks, Cyber Crime and Cyber Security
Forbes - Security
Forbes - Security
S
Secure Thoughts
Simon Willison's Weblog
Simon Willison's Weblog
D
Docker
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
L
Lohrmann on Cybersecurity
T
Tailwind CSS Blog

OneUptime Blog

How to Monitor Azure App Services (PaaS) with OpenTelemetry Grafana Stack vs OneUptime: DIY Observability or Unified Platform? Your AI Workloads Are About to Blow Up Your Observability Bill The Great Observability Consolidation Is Here How to Write Custom Object Classes for Ceph How to Write Custom Ceph Manager Modules How to Write a ceph.conf Configuration File How to Use Rook-Ceph with OpenShift How to Use Rook-Ceph with Longhorn for Comparison How to Configure Volume Snapshot Class for RBD in Rook How to Configure VolumeReplicationClass Scheduling Intervals in Rook How to Set Up Volume Replication with Rook-Ceph How to Create Volume Group Snapshots with Rook CSI How to Visualize Ceph Network Performance in Grafana How to Enable Virtual Host-Style Bucket Access in Rook How to View Runtime Configuration via Admin Socket How to View Quota Settings and Update Stats in Ceph RGW How to View PG Scaling Recommendations with autoscale-status How to View Performance Metrics in the Ceph Dashboard How to View OSD Performance Counters in Ceph How to View Connection Status via Admin Socket How to View Ceph Cluster Summary Dashboard via CLI How to Version Control Rook-Ceph Configuration How to Version Control Ceph Infrastructure with Terraform How to Verify Kubernetes Node Requirements for Rook-Ceph Deployment How to Verify Health Before and After Rook Upgrades How to Verify Data Integrity with Deep Scrubbing How to Verify Complete Rook-Ceph Cleanup How to Verify Backup Integrity from Ceph Snapshots How to Use Rook-Ceph with Velero for Kubernetes Backup How to Integrate HashiCorp Vault with Rook-Ceph (Token Auth) How to Configure TLS for Vault Integration in Rook How to Integrate HashiCorp Vault with Rook-Ceph (Kubernetes Auth) How to Validate Ceph Cluster Configuration After Deployment How to Understand User Type and ID Notation (TYPE.ID) in Ceph How to Configure User Management in the Ceph Dashboard How to Use Rook-Ceph with Kubernetes Operators How to Use Rook-Ceph with Helm Chart Deployments How to Use the Swift API with Ceph RGW How to Use SQLite Databases Stored on Ceph How to Use s3cmd with Ceph RGW How to Use the S3 API with Ceph RGW How to Use Red Hat Ceph with RHEL Virtualization How to Use RBD with QEMU How to Use RBD with Nomad How to Use RBD with CloudStack How to Use RBD Snapshot Rollback How to Use rados bench for Object Storage Benchmarking How to Secure Rook-Ceph with Pod Security Admission How to Use pg-upmap for PG Mapping in Ceph How to Use Multipath Devices with Ceph OSDs How to Use MinIO Client (mc) with Ceph RGW How to Use fs swap for CephFS How to Use fio for Ceph Block Storage Benchmarking How to Use the CephFS Shell How to Use Ceph RGW for Media Asset Management How to Use Ceph RGW for Log Storage and Archival How to Use Ceph RGW for Data Lake Storage How to Use Ceph RGW for Backup Repository Storage How to Use the ceph-authtool Utility How to Use boto3 (Python) with Ceph RGW S3 How to Use AWS CLI with Ceph RGW S3 How to Use the Admin Ops API with Ceph RGW How to Configure Usage Log Key Transition in Ceph RGW How to Handle Rook-Ceph Upgrades in GitOps Pipelines How to Upgrade Rook-Ceph with Zero Downtime How to Create a Ceph Upgrade Runbook How to Upgrade the Rook Operator from v1.18 to v1.19 How to Upgrade the Rook Operator on Kubernetes How to Upgrade External Cluster Connections in Rook How to Upgrade the Ceph Version in Rook How to Upgrade from Ceph Reef to Squid How to Upgrade from Ceph Quincy to Reef How to Upgrade Ceph Clusters in Stretch Mode How to Update Kernel for CephFS Feature Compatibility How to Update Ceph Configuration on a Running Rook Cluster How to Create Unique Kubernetes Services per NFS Server in Rook How to Understand When Compression Helps vs Hurts in Ceph How to Understand User Types (Individual vs System) in Ceph How to Understand the undersized PG State in Ceph How to Understand the stale PG State in Ceph How to Understand the repair PG State in Ceph How to Understand the remapped PG State in Ceph How to Understand Red Hat Ceph Storage vs Upstream Ceph How to Understand Placement Groups in Ceph How to Understand PG Splitting in Ceph How to Understand the peering PG State in Ceph How to Understand OSD Recovery Process in Ceph How to Understand the OSD Map in Ceph How to Understand New Features in Each Ceph Release How to Understand Monitor Leadership in Ceph How to Understand MDS States in CephFS How to Understand Deprecated Features in Ceph Reef How to Understand the degraded PG State in Ceph How to Understand D3N in Ceph How to Understand the creating PG State in Ceph How to Understand the clean PG State in Ceph How to Understand CephX Authentication Protocol How to Understand CephX Authentication Flow How to Understand What Data Ceph Telemetry Collects
How to View PG Distribution via Admin Socket
Nawaz Dhandala · 2026-03-31 · via OneUptime Blog

Overview

Placement groups (PGs) are the fundamental units of data distribution in Ceph. Each OSD hosts a subset of PGs, and uneven distribution leads to hotspots. The admin socket provides commands to inspect which PGs are on a specific OSD and their current state.

Listing PGs on an OSD

# Show all PGs on OSD 0
ceph daemon osd.0 dump_pgs

# Count PGs on each OSD
for osd in $(ceph osd ls); do
    COUNT=$(ceph daemon osd.$osd dump_pgs 2>/dev/null | python3 -c \
    "import sys,json; d=json.load(sys.stdin); print(len(d.get('pg_stats',d if isinstance(d,list) else [])))" 2>/dev/null)
    echo "OSD $osd: $COUNT PGs"
done

Getting PG States on an OSD

# Dump PGs with state information
ceph daemon osd.0 dump_pgs | python3 -c "
import sys, json
data = json.load(sys.stdin)
pgs = data if isinstance(data, list) else data.get('pg_stats', [])
states = {}
for pg in pgs:
    state = pg.get('state', 'unknown')
    states[state] = states.get(state, 0) + 1
for state, count in sorted(states.items()):
    print(f'{state}: {count}')
"

Checking Primary vs Replica PGs

# Check how many PGs have OSD 0 as primary
ceph pg dump --format json 2>/dev/null | python3 -c "
import sys, json
data = json.load(sys.stdin)
pgs = data.get('pg_stats', [])
count = sum(1 for pg in pgs if pg.get('acting_primary') == 0)
print(f'PGs with OSD 0 as primary: {count}')
"

# More detailed breakdown: primary vs replica for OSD 0
ceph pg dump --format json 2>/dev/null | python3 -c "
import sys, json
data = json.load(sys.stdin)
pgs = data.get('pg_stats', [])
primary = 0
replica = 0
for pg in pgs:
    acting = pg.get('acting', [])
    if acting and acting[0] == 0:
        primary += 1
    elif 0 in acting:
        replica += 1
print(f'Primary: {primary}, Replica: {replica}')
"

Identifying Uneven PG Distribution

# Get PG count per OSD (dynamically find the PGS column from the header)
ceph osd df | awk 'NR==1{for(i=1;i<=NF;i++) if($i=="PGS") c=i} NR>1 && $1~/^[0-9]/ && c{print "OSD "$1": "$c" PGs"}' | head -20

# Check the OSD with most and fewest PGs
ceph osd df | awk 'NR==1{for(i=1;i<=NF;i++) if($i=="PGS") c=i} NR>1 && $1~/^[0-9]/ && c{print $1, $c}' | sort -k2 -n | head -5   # least PGs
ceph osd df | awk 'NR==1{for(i=1;i<=NF;i++) if($i=="PGS") c=i} NR>1 && $1~/^[0-9]/ && c{print $1, $c}' | sort -k2 -rn | head -5  # most PGs

Viewing PG Map Details for an OSD

# Request the latest OSD map from the monitor
ceph daemon osd.0 get_latest_osdmap

# Dump the current OSD map epoch
ceph daemon osd.0 osd_map_epoch

Rebalancing PG Distribution

If PGs are unevenly distributed, check CRUSH weights:

# Show CRUSH weight for each OSD
ceph osd tree | grep osd

# Reweight if one OSD is significantly over-represented
ceph osd reweight osd.0 0.95

# Or use automatic reweighting
ceph osd reweight-by-utilization

Monitoring PG State Changes

# Watch PG state changes on a specific OSD
watch -n 10 'ceph daemon osd.0 dump_pgs | python3 -c "
import sys, json
data = json.load(sys.stdin)
pgs = data if isinstance(data, list) else data.get(\"pg_stats\", [])
active = sum(1 for p in pgs if \"active\" in p.get(\"state\",\"\"))
print(f\"Active PGs: {active}/{len(pgs)}\")
"'

Summary

The admin socket dump_pgs command reveals all placement groups hosted on a specific OSD along with their state. Use this to diagnose PG imbalances causing OSD hotspots, verify primary and replica distribution, and confirm PG health during cluster operations. Combine with ceph osd df and CRUSH reweighting to address uneven distributions.