curl 命令获取 solr 集合的分片信息
curl command to get shard information of a solr collection
如果有 curl 命令可以为我们提供 solr 中给定集合的分片信息,请告诉我。也就是说,有关给定集合被分成多少个分片及其复制因子的信息。我理解可以通过solr admin UI看到。但是,我们正在寻找会产生相同结果的 curl 命令。
Admin UI 是一个 Javascript 应用程序。如果您在“网络”选项卡下查看浏览器的开发工具,您会确切地看到 UI 正在发出哪些请求来显示所需的信息。然后,您可以在 curl 中使用相同的端点来检索相同的信息并根据您的意愿进行处理。
The CLUSTERSTATUS endpoint will give you the information you're looking for:
http://localhost:8983/solr/admin/collections?action=CLUSTERSTATUS
{
"responseHeader":{
"status":0,
"QTime":333},
"cluster":{
"collections":{
"collection1":{
"shards":{
"shard1":{
"range":"80000000-ffffffff",
"state":"active",
"health": "GREEN",
"replicas":{
"core_node1":{
"state":"active",
"core":"collection1",
"node_name":"127.0.1.1:8983_solr",
"base_url":"http://127.0.1.1:8983/solr",
"leader":"true"},
"core_node3":{
"state":"active",
"core":"collection1",
"node_name":"127.0.1.1:8900_solr",
"base_url":"http://127.0.1.1:8900/solr"}}},
"shard2":{
"range":"0-7fffffff",
"state":"active",
"health": "GREEN",
"replicas":{
"core_node2":{
"state":"active",
"core":"collection1",
"node_name":"127.0.1.1:7574_solr",
"base_url":"http://127.0.1.1:7574/solr",
"leader":"true"},
"core_node4":{
"state":"active",
"core":"collection1",
"node_name":"127.0.1.1:7500_solr",
"base_url":"http://127.0.1.1:7500/solr"}}}},
"maxShardsPerNode":"1",
"router":{"name":"compositeId"},
"replicationFactor":"1",
"znodeVersion": 11,
"autoCreated":"true",
"configName" : "my_config",
"health": "GREEN",
"aliases":["both_collections"]
},
"collection2":{
"..."
}
},
"aliases":{ "both_collections":"collection1,collection2" },
"roles":{
"overseer":[
"127.0.1.1:8983_solr",
"127.0.1.1:7574_solr"]
},
"live_nodes":[
"127.0.1.1:7574_solr",
"127.0.1.1:7500_solr",
"127.0.1.1:8983_solr",
"127.0.1.1:8900_solr"]
}
}
如果有 curl 命令可以为我们提供 solr 中给定集合的分片信息,请告诉我。也就是说,有关给定集合被分成多少个分片及其复制因子的信息。我理解可以通过solr admin UI看到。但是,我们正在寻找会产生相同结果的 curl 命令。
Admin UI 是一个 Javascript 应用程序。如果您在“网络”选项卡下查看浏览器的开发工具,您会确切地看到 UI 正在发出哪些请求来显示所需的信息。然后,您可以在 curl 中使用相同的端点来检索相同的信息并根据您的意愿进行处理。
The CLUSTERSTATUS endpoint will give you the information you're looking for:
http://localhost:8983/solr/admin/collections?action=CLUSTERSTATUS
{
"responseHeader":{
"status":0,
"QTime":333},
"cluster":{
"collections":{
"collection1":{
"shards":{
"shard1":{
"range":"80000000-ffffffff",
"state":"active",
"health": "GREEN",
"replicas":{
"core_node1":{
"state":"active",
"core":"collection1",
"node_name":"127.0.1.1:8983_solr",
"base_url":"http://127.0.1.1:8983/solr",
"leader":"true"},
"core_node3":{
"state":"active",
"core":"collection1",
"node_name":"127.0.1.1:8900_solr",
"base_url":"http://127.0.1.1:8900/solr"}}},
"shard2":{
"range":"0-7fffffff",
"state":"active",
"health": "GREEN",
"replicas":{
"core_node2":{
"state":"active",
"core":"collection1",
"node_name":"127.0.1.1:7574_solr",
"base_url":"http://127.0.1.1:7574/solr",
"leader":"true"},
"core_node4":{
"state":"active",
"core":"collection1",
"node_name":"127.0.1.1:7500_solr",
"base_url":"http://127.0.1.1:7500/solr"}}}},
"maxShardsPerNode":"1",
"router":{"name":"compositeId"},
"replicationFactor":"1",
"znodeVersion": 11,
"autoCreated":"true",
"configName" : "my_config",
"health": "GREEN",
"aliases":["both_collections"]
},
"collection2":{
"..."
}
},
"aliases":{ "both_collections":"collection1,collection2" },
"roles":{
"overseer":[
"127.0.1.1:8983_solr",
"127.0.1.1:7574_solr"]
},
"live_nodes":[
"127.0.1.1:7574_solr",
"127.0.1.1:7500_solr",
"127.0.1.1:8983_solr",
"127.0.1.1:8900_solr"]
}
}