配置Rundeck的MySQL后服务停止,访问报HTTP 503错误
Been there, done that—configuring MySQL for Rundeck and hitting a 503 is super common, almost always tied to bad connection settings or missing dependencies. Let’s walk through the fix step by step:
1. Double-Check Your rundeck-config.properties MySQL Settings
First, make sure your database config is spot-on. Here’s what a valid MySQL setup should look like (adjust values to match your environment):
# Database configuration dataSource.driverClassName=com.mysql.cj.jdbc.Driver dataSource.url=jdbc:mysql://your-mysql-host:3306/rundeck_db?autoReconnect=true&useSSL=false&serverTimezone=UTC dataSource.username=rundeck_db_user dataSource.password=your_secure_password rundeck.projectsStorageType=db rundeck.storage.provider.1.type=db rundeck.storage.provider.1.path=keys
Key things to verify:
- If you’re using MySQL 8+, use
com.mysql.cj.jdbc.Driver(not the oldcom.mysql.jdbc.Driver). - The JDBC URL includes correct host, port, database name, and critical parameters like
serverTimezone(mandatory for MySQL 8+). - Username/password have no typos, and the user has explicit access to the target database.
2. Ensure MySQL JDBC Driver Is Installed
Rundeck doesn’t ship with the MySQL driver out of the box. You need to download the correct driver JAR and drop it into Rundeck’s lib directory:
- For RPM/deb installs: Copy
mysql-connector-java-8.x.x.jarto/var/lib/rundeck/lib - For manual installs: Copy it to
/opt/rundeck/server/lib
After adding the driver, restart the Rundeck service to apply changes:
sudo systemctl restart rundeckd
3. Dig Into Rundeck’s Startup Logs
The 503 error is a generic "service down" message—real clues are hidden in the logs. Check the main service log:
tail -f /var/log/rundeck/service.log
Or the server-specific log:
tail -f /opt/rundeck/server/logs/rundeck.log
Look for these common error patterns:
Cannot create PoolableConnectionFactory: Usually means wrong credentials, missing database, or network blocks between Rundeck and MySQL.ClassNotFoundException: com.mysql.cj.jdbc.Driver: Means the JDBC driver is missing or placed in the wrong directory.
4. Verify MySQL Database Accessibility
Test if Rundeck can reach your MySQL server from its host:
- Use the MySQL client to connect with the exact credentials from your Rundeck config:
mysql -u rundeck_db_user -p -h your-mysql-host
- If connection fails, fix these common issues:
- MySQL firewall rules allow traffic from Rundeck’s IP on port 3306.
- The MySQL user has permissions to connect from Rundeck’s host (run
GRANT ALL PRIVILEGES ON rundeck_db.* TO 'rundeck_db_user'@'rundeck-host-ip' IDENTIFIED BY 'your_password';thenFLUSH PRIVILEGES;). - The
rundeck_dbdatabase exists (create it withCREATE DATABASE IF NOT EXISTS rundeck_db;if missing).
5. Check Rundeck Service Status
Make sure the service is actually running (sometimes it crashes silently on startup):
sudo systemctl status rundeckd
If it’s failed, start it manually and watch for immediate errors:
sudo systemctl start rundeckd journalctl -u rundeckd -f
Common Gotchas to Watch For
- MySQL Version Compatibility: Rundeck 4.x and above require MySQL 5.7+ (preferably 8.x). Older versions will cause compatibility breaks.
- SSL Settings: If your MySQL server enforces SSL, adjust the JDBC URL to
useSSL=trueand add truststore configurations if needed. - File Permissions: Ensure the Rundeck user (usually
rundeck) has read access to the JDBC driver JAR andrundeck-config.propertiesfile.
内容的提问来源于stack exchange,提问作者Sudhir Gosavi

