VPS Host Maintenance Shutdown: Difference between revisions
(Add troubleshooting section for container unreachable after host power cycle) |
(Review: přidán diagram workflow pro lepší vizualizaci) |
||
| Line 17: | Line 17: | ||
| '''Shut down entire VPS for maintenance''' || LXC container from host system || <code>lxc-stop</code>, <code>sw vps-detach</code>, <code>sw vps-start</code> (from HOST) || This guide | | '''Shut down entire VPS for maintenance''' || LXC container from host system || <code>lxc-stop</code>, <code>sw vps-detach</code>, <code>sw vps-start</code> (from HOST) || This guide | ||
|} | |} | ||
<kroki lang="mermaid"> | |||
%%{init: {'flowchart': {'nodeSpacing': 15, 'rankSpacing': 30}}}%% | |||
flowchart LR | |||
subgraph SHUTDOWN["Shutdown Sequence"] | |||
direction TB | |||
A1[Stop MySQL] --> A2[lxc-stop] | |||
A2 --> A3[sw vps-detach] | |||
end | |||
subgraph MAINT["Maintenance"] | |||
direction TB | |||
B1[Hardware Work] | |||
end | |||
subgraph STARTUP["Startup Sequence"] | |||
direction TB | |||
C1[sw vps-attach] --> C2[sw vps-start] | |||
C2 --> C3[Start MySQL] | |||
C3 --> C4[Verify] | |||
end | |||
SHUTDOWN --> MAINT --> STARTUP | |||
</kroki> | |||
== Prerequisites == | == Prerequisites == | ||
Revision as of 21:28, 6 January 2026
This guide explains how to perform a planned graceful shutdown of a VoIPmonitor VPS from the HOST system for hardware maintenance. This is different from stopping the VoIPmonitor service from within the VPS (see Systemd Service Management for that procedure).
ℹ️ Note: This guide assumes VoIPmonitor is running inside an LXC container on a SolusVM-managed hypervisor. If you are stopping the VoIPmonitor service only (not the entire VPS), use systemctl stop voipmonitor inside the VPS instead.
Overview: Service-Level vs. VPS-Level Shutdowns
| Scenario | What You Shutdown | Commands Used | Documentation |
|---|---|---|---|
| Stop VoIPmonitor application only | VoIPmonitor service inside VPS | systemctl stop voipmonitor (from within VPS) |
Systemd Service Management |
| Shut down entire VPS for maintenance | LXC container from host system | lxc-stop, sw vps-detach, sw vps-start (from HOST) |
This guide |
Prerequisites
- SSH access to the HOST system (not the VPS)
- Root or sudo access on the HOST
- SolusVM hypervisor commands (
sw) available - LXC tools installed on host
- The VPS container name (e.g.,
sipMON)
Graceful Shutdown Procedure for Planned Hardware Maintenance
Follow these steps from the HOST system to stop a VoIPmonitor VPS cluster for planned hardware maintenance:
Step 1: Stop the Database Service on the Host
Stop the MySQL/MariaDB service running on the host system before stopping the VPS container.
# Stop MySQL/MariaDB on the HOST
service mysql stop
# Verify it is stopped
ps ax | grep mysqld
💡 Tip: If MySQL is running on a different host (not the same server as the VPS), skip this step and stop MySQL on the correct host.
Step 2: Stop the VPS Container
Stop the LXC container hosting VoIPmonitor using the container name.
# Stop the VPS container
lxc-stop -n sipMON
# Verify it is stopped
lxc-ls -f
Replace sipMON with your actual VPS container name.
Step 3: Detach the VPS (SolusVM)
Detach the VPS from SolusVM using the sw command before proceeding with hardware maintenance.
# Detach the VPS
sw vps-detach -n sipMON
⚠️ Warning: The VPS must be fully stopped before detaching. Do not proceed with vps-detach if lxc-stop returned errors.
Step 4: Perform Hardware Maintenance
At this point, you can safely perform hardware maintenance on the host system (e.g., replacing drives, upgrading RAM, power maintenance).
Step 5: Re-attach and Start the VPS (Post-Maintenance)
After hardware maintenance is complete, start the VPS back up in the correct order:
# Re-attach the VPS to SolusVM
sw vps-attach -n sipMON
# Start the VPS container
sw vps-start -n sipMON
# Verify the VPS is running
lxc-ls -f
ℹ️ Note: VoIPmonitor inside the VPS will start automatically if systemd is configured with systemctl enable voipmonitor. See Systemd Service Management for details.
Verification Steps
After bringing the VPS back online, verify that everything is operational:
# 1. Check VPS status
lxc-ls -f
# 2. Start MySQL on host (if applicable)
service mysql start
# 3. Verify VoIPmonitor is running inside VPS
# SSH into the VPS:
ssh root@<VPS_IP>
systemctl status voipmonitor
# 4. Check for SQL queue backlog in the GUI
# Navigate to Settings -> Sensors -> Status
# Monitor SQLq until it returns to 0
ℹ️ Note: Any buffered SQL queries (qoq files in /var/spool/voipmonitor) will be automatically processed when the sensor starts. This may temporarily increase the SQL queue in the GUI.
Troubleshooting
LXC Container Unreachable After Host Power Cycle
If a host server is powered down and back up, the VoIPmonitor LXC container may become unreachable via SSH. This typically happens because the SolusVM attachment was disrupted during the host power cycle.
To recover, run the full stop/detach/attach/start sequence:
# Step 1: Stop the container
lxc-stop -n <container_name>
# Step 2: Detach the container from SolusVM
sw vps-detach -n <container_name>
# Step 3: Re-attach the container
sw vps-attach -n <container_name>
# Step 4: Start the container
sw vps-start -n <container_name>
ℹ️ Note: These SolusVM commands may take time to execute fully. Allow each command to complete before proceeding to the next step.
Replace <container_name> with your actual VPS container name (e.g., sipMON).
💡 Tip: For planned shutdowns, see the step-by-step Graceful Shutdown Procedure above which includes MySQL handling and verification steps. This quick recovery assumes MySQL is already running on the host.
VPS Will Not Stop
If lxc-stop fails or hangs:
# Force stop (last resort)
lxc-stop -n sipMON -k
# Or kill LXC processes directly
lxc-kill -n sipMON
MySQL Will Not Stop
If MySQL fails to stop:
# Check for active connections
netstat -tunap | grep :3306
# Force stop if necessary (ensuring VoIPmonitor VPS is stopped first)
service mysql stop
pkill mysqld
⚠️ Warning: Always stop VoIPmonitor VPS BEFORE stopping MySQL if they are on separate hosts, or use systemd dependency (see Systemd Service Management).
VPS Does Not Start After Re-attach
If the VPS fails to start after vps-attach:
# Check SolusVM logs
tail -f /var/log/solusvm.log
# Check LXC logs
tail -f /var/log/lxc/sipMON.log
# Manually start with LXC
lxc-start -n sipMON -F
AI Summary for RAG
Summary: This guide documents the host-level procedure for gracefully shutting down a VoIPmonitor VPS for planned hardware maintenance when the application runs inside an LXC container on a SolusVM hypervisor. The workflow from the HOST system includes: (1) stopping MySQL with service mysql stop and verifying with ps ax|grep mysqld, (2) stopping the VPS container using lxc-stop -n <container_name>, (3) detaching from SolusVM with sw vps-detach -n <container_name>, performing hardware maintenance, then (4) re-attaching with sw vps-attach -n <container_name> and starting with sw vps-start -n <container_name>. This procedure differs from service-level shutdown (systemctl stop voipmonitor inside VPS) which is documented separately. Post-start verification includes checking VPS status, starting MySQL on host, and monitoring SQL queue backlog in GUI as buffered qoq files are processed. For unplanned host power cycles where the container becomes unreachable via SSH, the recovery procedure is identical: lxc-stop → sw vps-detach → sw vps-attach → sw vps-start. These SolusVM commands may take time to execute fully.
Keywords: VPS shutdown, host maintenance, LXC container, SolusVM, lxc-stop, lxc-start, sw vps-detach, sw vps-attach, sw vps-start, hardware maintenance, mysql stop, container management, hypervisor, graceful shutdown, host power cycle, container unreachable
Key Questions:
- How do I shut down a VoIPmonitor VPS from the host system for hardware maintenance?
- What is the difference between stopping the VoIPmonitor service and stopping the VPS container?
- What SolusVM commands are used to stop and start a VPS for maintenance?
- Should I stop MySQL before stopping the VPS container in a SolusVM environment?
- How do I verify the VPS is stopped before performing hardware maintenance?
- What order should I follow when starting the VPS back up after maintenance?
- How do I detach and re-attach a VPS using SolusVM commands?
- What should I check after bringing the VPS back online?
- How do I recover an LXC container that becomes unreachable after a host server power cycle?
- What should I do if my VPS container is unreachable via SSH after the host reboots?