0Pricing
MCP Academy · Lección

Comprobaciones de estado y reinicios

Mantenga el servicio activo y con recuperación automática.

Comprobaciones de estado y reinicios es una lección gratuita de MCP Academy en CoddyKit. Esta es la lección 3 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de MCP Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de MCP Academy incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en inglés.

Servers Need a Pulse

A deployed server can hang or crash silently. A health check is a simple probe that answers the question: are you still alive? 🩺

Expose a Health Endpoint

The classic pattern is a tiny route, often /health, that returns 200 OK when the server is ready to handle work.

GET /health  ->  200 OK

Keep the Check Cheap

A health check runs constantly, so keep it lightweight. It should confirm the process responds without doing heavy real work.

Liveness vs Readiness

Two ideas matter: liveness asks is the process alive, while readiness asks is it ready to accept traffic yet. They can differ at startup.

Let Docker Watch It

Docker can run a HEALTHCHECK on a schedule. If the command fails enough times, the container is marked unhealthy.

HEALTHCHECK CMD curl -f http://localhost:8000/health || exit 1

Restart on Failure

A restart policy tells the platform to bring a dead container back automatically, so a single crash does not mean downtime.

docker run --restart unless-stopped my-mcp-server

Orchestrators Do This Too

Tools like Kubernetes use the same probes to restart unhealthy pods and to route traffic only to ready instances.

Avoid Restart Loops

If a server crashes instantly on boot, blind restarts just loop forever. Use backoff so retries slow down and you can see the real error.

Check Dependencies Wisely

A deep readiness check can ping a database, but be careful: if every server marks itself unready at once, an outage can cascade.

Drain Before You Stop

On shutdown, stop accepting new calls but let in-flight ones finish. This graceful drain prevents cutting clients off mid-request.

Self-Healing in Practice

Health checks plus restart policies give you a self-healing service that recovers from most failures with no human awake at 3am. 🌙

Quick Check

What is the difference between a liveness and a readiness check?

Recap: Health & Restarts

A cheap /health endpoint plus a restart policy makes your server self-healing: probes catch failures and the platform brings it back. 💪

Preguntas frecuentes

¿La lección «Comprobaciones de estado y reinicios» es gratis?

Sí — el texto completo de «Comprobaciones de estado y reinicios» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de MCP Academy, actualiza a CoddyKit PRO. El curso de MCP Academy incluye 4 lecciones en total.

¿Qué aprenderé en «Comprobaciones de estado y reinicios»?

Mantenga el servicio activo y con recuperación automática. Practicas MCP Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar MCP Academy?

No se requiere experiencia previa. MCP Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 3 de 4.

¿Cuánto tiempo toma la lección «Comprobaciones de estado y reinicios»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de MCP Academy?

Sí. Cada lección de MCP Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. Empaquetar el servidor en Docker
  2. Ejecutar detrás de un proxy inverso
  3. Comprobaciones de estado y reinicios
  4. Conectar clientes remotos
← Volver a MCP Academy