Commands
Check Health
curl http://172.17.0.2:9200/_cluster/health?pretty
Set Replicas Num
curl -X PUT "http://172.17.0.2:9200/_all/_settings" \
-H "Content-Type: application/json" \
-d '{
"number_of_replicas": 0
}'
Enabled Performance Analyzer
curl -XPOST localhost:9200/_plugins/_performanceanalyzer/cluster/config -H 'Content-Type: application/json' -d '{"enabled": true}'
{
"currentPerformanceAnalyzerClusterState": 1,
"shardsPerCollection": 0,
"collectorsSetting": 0,
"batchMetricsRetentionPeriodMinutes": 7
}
Sucks
# 确保配置目录存在
mkdir -p /usr/share/opensearch/config/opensearch-performance-analyzer
# 1. 创建性能分析器配置文件,并强制设置绑定为 0.0.0.0
echo "webservice-bind-host = 0.0.0.0" > /usr/share/opensearch/config/opensearch-performance-analyzer/performance-analyzer.properties
# 2. 创建日志中提示缺失的元数据文件
touch /usr/share/opensearch/config/opensearch-performance-analyzer/plugin-stats-metadata
# 3. 检查并确保 /dev/shm/performanceanalyzer/ 存在
mkdir -p /dev/shm/performanceanalyzer/
chown -R opensearch:opensearch /usr/share/opensearch/config/opensearch-performance-analyzer
chown -R opensearch:opensearch /dev/shm/performanceanalyzer