Versión de la integración 2.1.0
Conecta el clúster TiDB a Datadog para:
Recopilar métricas TiDB clave de tu clúster. Recopilar logs de tu clúster, como logs TiDB/TiKV/TiFlash y logs de consultas lentas. Visualizar el rendimiento del clúster en el dashboard proporcionado. Nota :
En primer lugar, descarga e inicia el Datadog Agent .
A continuación, instala manualmente el check de TiDB. Las instrucciones varían en función del entorno .
Ejecuta datadog-agent integration install -t datadog-tidb==<INTEGRATION_VERSION>
.
Edita el archivo tidb.d/conf.yaml
, que se encuentra en la carpeta conf.d/
en la raíz del directorio de configuración de tu Agent, para empezar a recopilar los datos de rendimiento de tu TiDB. Para conocer todas las opciones de configuración disponibles, consulta el tidb.d/conf.yaml de ejemplo . El tidb.d/conf.yaml de ejemplo sólo configura la instancia PD. Es necesario configurar manualmente las otras instancias en el clúster TiDB así:
init_config :
instances :
- pd_metric_url : http://localhost:2379/metrics
send_distribution_buckets : true
tags :
- cluster_name:cluster01
- tidb_metric_url : http://localhost:10080/metrics
send_distribution_buckets : true
tags :
- cluster_name:cluster01
- tikv_metric_url : http://localhost:20180/metrics
send_distribution_buckets : true
tags :
- cluster_name:cluster01
- tiflash_metric_url : http://localhost:8234/metrics
send_distribution_buckets : true
tags :
- cluster_name:cluster01
- tiflash_proxy_metric_url : http://localhost:20292/metrics
send_distribution_buckets : true
tags :
- cluster_name:cluster01
Copy
Reinicia el Agent .Disponible para la versión 6.0 o posteriores del Agent
La recopilación de logs se encuentra deshabilitada de manera predeterminada en el Datadog Agent. Habilítala en tu archivo datadog.yaml
:
Añade este bloque de configuración a tu archivo tidb.d/conf.yaml
para empezar a recopilar tus logs de TiDB:
logs :
# pd log
- type : file
path : "/tidb-deploy/pd-2379/log/pd*.log"
service : "tidb-cluster"
source : "pd"
# tikv log
- type : file
path : "/tidb-deploy/tikv-20160/log/tikv*.log"
service : "tidb-cluster"
source : "tikv"
# tidb log
- type : file
path : "/tidb-deploy/tidb-4000/log/tidb*.log"
service : "tidb-cluster"
source : "tidb"
exclude_paths :
- /tidb-deploy/tidb-4000/log/tidb_slow_query.log
- type : file
path : "/tidb-deploy/tidb-4000/log/tidb_slow_query*.log"
service : "tidb-cluster"
source : "tidb"
log_processing_rules :
- type : multi_line
name : new_log_start_with_datetime
pattern : '#\sTime:'
tags :
- "custom_format:tidb_slow_query"
# tiflash log
- type : file
path : "/tidb-deploy/tiflash-9000/log/tiflash*.log"
service : "tidb-cluster"
source : "tiflash"
Copy
Cambia la path
y el service
según la configuración de tu clúster.
Utiliza estos comandos para mostrar la ruta de todos los logs:
# show deploying directories
tiup cluster display <YOUR_CLUSTER_NAME>
# find specific logging file path by command arguments
ps -fwwp <TIDB_PROCESS_PID/PD_PROCESS_PID/etc.>
Copy
Reinicia el Agent .
Ejecuta el subcomando de estado del Agent y busca tidb
en la sección Checks .
tidb_cluster.tidb_executor_statement_total (count)The total number of statements executedShown as execution tidb_cluster.tidb_server_execute_error_total (count)The total number of execution errorsShown as error tidb_cluster.tidb_server_connections (gauge)Current number of connections in TiDB serverShown as connection tidb_cluster.tidb_server_handle_query_duration_seconds.count (count)The total number of handled queries in serverShown as query tidb_cluster.tidb_server_handle_query_duration_seconds.sum (count)The sum of handled query duration in serverShown as second tidb_cluster.tikv_engine_size_bytes (gauge)The disk usage bytes of TiKV instancesShown as byte tidb_cluster.tikv_store_size_bytes (gauge)The disk capacity bytes of TiKV instancesShown as byte tidb_cluster.tikv_io_bytes (count)The io read/write bytes of TiKV instancesShown as byte tidb_cluster.tiflash_store_size_used_bytes (gauge)The disk usage bytes of TiFlash instancesShown as byte tidb_cluster.tiflash_store_size_capacity_bytes (gauge)The disk capacity bytes of TiFlash instancesShown as byte tidb_cluster.process_cpu_seconds_total (count)The cpu usage seconds of TiDB/TiKV/TiFlash instancesShown as second tidb_cluster.process_resident_memory_bytes (gauge)The resident memory bytes of TiDB/TiKV/TiFlash instancesShown as byte
Es posible utilizar la opción de configuración metrics
para recopilar métricas adicionales de un clúster TiDB.
El check de TiDB no incluye eventos.
tidb_cluster.prometheus.health Returns CRITICAL
if the Agent cannot fetch Prometheus metrics, otherwise returns OK
.Statuses: ok, critical
Las métricas de CPU y memoria no se proporcionan para las instancias TiKV y TiFlash en los siguientes casos:
El check de TiDB habilita por defecto el tipo de métrica distribution
de Datadog. Esta parte de los datos es bastante grande y puede consumir muchos recursos. Puedes modificar este comportamiento en el archivo tidb.yml
:
send_distribution_buckets: false
Debido a que en un clúster TiDB hay muchas métricas, el check de TiDB define max_returned_metrics
en 10000
por defecto. Si es necesario, puedes reducir max_returned_metrics
en el archivo tidb.yml
:
max_returned_metrics: 1000
¿Necesitas ayuda? Ponte en contacto con el servicio de asistencia de Datadog .