The cluster configuration in YugabyteDB provides information about the current state of the cluster. It includes details about the replication settings, placement of replicas, and other configuration parameters.
We can view the cluster configuration from the command line using the yb-admin command line tool or hitting an http endpoint.
The option used depends on the format of the outout you desire.
For JSON output, use yb-admin or curl the MASTER_IP:7000/api/v1/cluster-config
end point.
# yb-admin -master-addresses 127.0.0.1 get_universe_config
{"version":4,"replicationInfo":{"liveReplicas":{"numReplicas":3,"placementBlocks":[{"cloudInfo":{"placementCloud":"aws","placementRegion":"us-west-1","placementZone":"us-west-1a"},"minNumReplicas":1},{"cloudInfo":{"placementCloud":"aws","placementRegion":"ca-central-1","placementZone":"ca-central-1a"},"minNumReplicas":1},{"cloudInfo":{"placementCloud":"aws","placementRegion":"us-east-1","placementZone":"us-east-1a"},"minNumReplicas":1}],"placementUuid":"YzIxMTg2ZWQtNmNhYy00MGEwLWIxODQtOGEwNWY0MTdhN2Mw"}},"clusterUuid":"113a3d30-9073-45e0-8983-3f2277432abe","universeUuid":"39cd8628-f0d3-49b9-ba2d-cbb3a03cb58e"}
# curl -s 127.0.0.1:7000/api/v1/cluster-config
{"version":4,"replication_info":{"live_replicas":{"num_replicas":3,"placement_blocks":[{"cloud_info":{"placement_cloud":"aws","placement_region":"us-west-1","placement_zone":"us-west-1a"},"min_num_replicas":1},{"cloud_info":{"placement_cloud":"aws","placement_region":"ca-central-1","placement_zone":"ca-central-1a"},"min_num_replicas":1},{"cloud_info":{"placement_cloud":"aws","placement_region":"us-east-1","placement_zone":"us-east-1a"},"min_num_replicas":1}],"placement_uuid":"c21186ed-6cac-40a0-b184-8a05f417a7c0"}},"cluster_uuid":"113a3d30-9073-45e0-8983-3f2277432abe","universe_uuid":"39cd8628-f0d3-49b9-ba2d-cbb3a03cb58e"}
For HTML output, curl the MASTER_IP:7000/cluster-config
end point:
# curl -s yugabytedb.tech:7000/cluster-config
YugabyteDB
Current Cluster Config
Successfully got cluster config!version: 4
replication_info {
live_replicas {
num_replicas: 3
placement_blocks {
cloud_info {
placement_cloud: "aws"
placement_region: "us-west-1"
placement_zone: "us-west-1a"
}
min_num_replicas: 1
}
placement_blocks {
cloud_info {
placement_cloud: "aws"
placement_region: "ca-central-1"
placement_zone: "ca-central-1a"
}
min_num_replicas: 1
}
placement_blocks {
cloud_info {
placement_cloud: "aws"
placement_region: "us-east-1"
placement_zone: "us-east-1a"
}
min_num_replicas: 1
}
placement_uuid: "c21186ed-6cac-40a0-b184-8a05f417a7c0"
}
}
cluster_uuid: "113a3d30-9073-45e0-8983-3f2277432abe"
universe_uuid: "39cd8628-f0d3-49b9-ba2d-cbb3a03cb58e"
For Plain Text output, use a tool like the Linux lynx command to query the MASTER_IP:7000/cluster-config
end point:
# lynx --dump http://127.0.0.1:7000/cluster-config | awk '/version:/,/universe_uuid:/'
version: 4
replication_info {
live_replicas {
num_replicas: 3
placement_blocks {
cloud_info {
placement_cloud: "aws"
placement_region: "us-west-1"
placement_zone: "us-west-1a"
}
min_num_replicas: 1
}
placement_blocks {
cloud_info {
placement_cloud: "aws"
placement_region: "ca-central-1"
placement_zone: "ca-central-1a"
}
min_num_replicas: 1
}
placement_blocks {
cloud_info {
placement_cloud: "aws"
placement_region: "us-east-1"
placement_zone: "us-east-1a"
}
min_num_replicas: 1
}
placement_uuid: "c21186ed-6cac-40a0-b184-8a05f417a7c0"
}
}
cluster_uuid: "113a3d30-9073-45e0-8983-3f2277432abe"
universe_uuid: "39cd8628-f0d3-49b9-ba2d-cbb3a03cb58e"
Have Fun!