{"id":2983,"date":"2026-06-18T08:41:49","date_gmt":"2026-06-18T08:41:49","guid":{"rendered":"https:\/\/tucumandevelopers.com\/index.php\/2026\/06\/18\/deploying-apache-dolphinscheduler-3-1-9-cluster-with-mysql-instead-of-postgresql-a-practical-docker-compose-guide\/"},"modified":"2026-06-18T08:41:49","modified_gmt":"2026-06-18T08:41:49","slug":"deploying-apache-dolphinscheduler-3-1-9-cluster-with-mysql-instead-of-postgresql-a-practical-docker-compose-guide","status":"publish","type":"post","link":"https:\/\/tucumandevelopers.com\/index.php\/2026\/06\/18\/deploying-apache-dolphinscheduler-3-1-9-cluster-with-mysql-instead-of-postgresql-a-practical-docker-compose-guide\/","title":{"rendered":"Deploying Apache DolphinScheduler 3.1.9 Cluster with MySQL Instead of PostgreSQL? A Practical Docker Compose Guide"},"content":{"rendered":"<div>\n<div><\/div>\n<h2> <a name=\"download-the-mysql-jdbc-driver\" href=\"#download-the-mysql-jdbc-driver\"> <\/a> Download the MySQL JDBC Driver <\/h2>\n<div>\n<pre><code>wget https:\/\/downloads.mysql.com\/archives\/get\/p\/3\/file\/mysql-connector-j-8.0.33.zip unzip <span>-q<\/span> mysql-connector-j-8.0.33.zip <span>cp <\/span>mysql-connector-j-8.0.33\/mysql-connector-j-8.0.33.jar <span>.<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h2> <a name=\"prepare-custom-images\" href=\"#prepare-custom-images\"> <\/a> Prepare Custom Images <\/h2>\n<h3> <a name=\"dockerfile-for-master-worker-api-and-alert-server\" href=\"#dockerfile-for-master-worker-api-and-alert-server\"> <\/a> Dockerfile for Master, Worker, API, and Alert Server <\/h3>\n<div>\n<pre><code><span># Based on the official DolphinScheduler image<\/span> <span>ARG<\/span><span> SERVICE=api<\/span> <span>FROM<\/span><span> apache\/dolphinscheduler-${SERVICE}:3.1.9<\/span> <span># Copy the MySQL JDBC driver into the DolphinScheduler library directory<\/span> <span># DolphinScheduler loads JDBC drivers from the lib directory<\/span> <span>COPY<\/span><span> mysql-connector-j-8.0.33.jar \/opt\/dolphinscheduler\/libs\/<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h3> <a name=\"dockerfile-for-tools\" href=\"#dockerfile-for-tools\"> <\/a> Dockerfile for Tools <\/h3>\n<div>\n<pre><code><span># Based on the official DolphinScheduler image<\/span> <span>ARG<\/span><span> SERVICE=tools<\/span> <span>FROM<\/span><span> apache\/dolphinscheduler-${SERVICE}:3.1.9<\/span> <span># Copy the MySQL JDBC driver into the DolphinScheduler tools library directory<\/span> <span># DolphinScheduler loads JDBC drivers from the lib directory<\/span> <span>COPY<\/span><span> mysql-connector-j-8.0.33.jar \/opt\/dolphinscheduler\/tools\/libs\/<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h2> <a name=\"build-custom-images\" href=\"#build-custom-images\"> <\/a> Build Custom Images <\/h2>\n<div>\n<pre><code>docker build <span>--build-arg<\/span> <span>SERVICE<\/span><span>=<\/span>master <span>-t<\/span> apache\/dolphinscheduler-master:3.1.9-mysql <span>.<\/span> docker build <span>--build-arg<\/span> <span>SERVICE<\/span><span>=<\/span>worker <span>-t<\/span> apache\/dolphinscheduler-worker:3.1.9-mysql <span>.<\/span> docker build <span>--build-arg<\/span> <span>SERVICE<\/span><span>=<\/span>tools <span>-t<\/span> apache\/dolphinscheduler-tools:3.1.9-mysql <span>.<\/span> docker build <span>--build-arg<\/span> <span>SERVICE<\/span><span>=<\/span>api <span>-t<\/span> apache\/dolphinscheduler-api:3.1.9-mysql <span>.<\/span> docker build <span>--build-arg<\/span> <span>SERVICE<\/span><span>=<\/span>alert-server <span>-t<\/span> apache\/dolphinscheduler-alert-server:3.1.9-mysql <span>.<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h2> <a name=\"update-dockercomposeyaml\" href=\"#update-dockercomposeyaml\"> <\/a> Update docker-compose.yaml <\/h2>\n<p>Disable the PostgreSQL service and add a MySQL service as the metadata database. <\/p>\n<div>\n<pre><code><span># Comment out the PostgreSQL service<\/span> <span># dolphinscheduler-postgresql:<\/span> <span># image: bitnami\/postgresql:15.2.0<\/span> <span># ...<\/span> <span># MySQL Metadata Database Service<\/span> <span>dolphinscheduler-mysql<\/span><span>:<\/span> <span>image<\/span><span>:<\/span> <span>mysql:8.0<\/span> <span>container_name<\/span><span>:<\/span> <span>dolphinscheduler-mysql<\/span> <span>profiles<\/span><span>:<\/span> <span>-<\/span> <span>all<\/span> <span>-<\/span> <span>schema<\/span> <span>environment<\/span><span>:<\/span> <span>MYSQL_ROOT_PASSWORD<\/span><span>:<\/span> <span>${MYSQL_ROOT_PASSWORD:-root}<\/span> <span>MYSQL_DATABASE<\/span><span>:<\/span> <span>${MYSQL_DATABASE:-dolphinscheduler}<\/span> <span>volumes<\/span><span>:<\/span> <span>-<\/span> <span>dolphinscheduler-mysql:\/var\/lib\/mysql<\/span> <span>ports<\/span><span>:<\/span> <span>-<\/span> <span>\"<\/span><span>3306:3306\"<\/span> <span># Expose MySQL to allow workers on other servers to connect<\/span> <span>healthcheck<\/span><span>:<\/span> <span>test<\/span><span>:<\/span> <span>[<\/span> <span>\"<\/span><span>CMD\"<\/span><span>,<\/span> <span>\"<\/span><span>mysqladmin\"<\/span><span>,<\/span> <span>\"<\/span><span>ping\"<\/span><span>,<\/span> <span>\"<\/span><span>-h\"<\/span><span>,<\/span> <span>\"<\/span><span>localhost\"<\/span><span>,<\/span> <span>\"<\/span><span>-u\"<\/span><span>,<\/span> <span>\"<\/span><span>${MYSQL_USERNAME:-root}\"<\/span><span>,<\/span> <span>\"<\/span><span>-p${MYSQL_PASSWORD:-root}\"<\/span> <span>]<\/span> <span>interval<\/span><span>:<\/span> <span>5s<\/span> <span>timeout<\/span><span>:<\/span> <span>60s<\/span> <span>retries<\/span><span>:<\/span> <span>120<\/span> <span>networks<\/span><span>:<\/span> <span>-<\/span> <span>dolphinscheduler<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<p>The remaining services (ZooKeeper, Schema Initializer, API, Alert Server, Master, Worker, Network, and Volume configurations) remain the same as the official Docker Compose deployment, with the following key modifications:<\/p>\n<h3> <a name=\"schema-initializer-dependency\" href=\"#schema-initializer-dependency\"> <\/a> Schema Initializer Dependency <\/h3>\n<div>\n<pre><code><span>depends_on<\/span><span>:<\/span> <span>dolphinscheduler-mysql<\/span><span>:<\/span> <span>condition<\/span><span>:<\/span> <span>service_healthy<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h3> <a name=\"master-jvm-configuration\" href=\"#master-jvm-configuration\"> <\/a> Master JVM Configuration <\/h3>\n<div>\n<pre><code><span>environment<\/span><span>:<\/span> <span>JAVA_OPTS<\/span><span>:<\/span> <span>&gt;<\/span> <span>-server<\/span> <span>-Duser.timezone=${SPRING_JACKSON_TIME_ZONE}<\/span> <span>-Xms8g<\/span> <span>-Xmx8g<\/span> <span>-Xmn4g<\/span> <span>-XX:+PrintGCDetails<\/span> <span>-Xloggc:gc.log<\/span> <span>-XX:+HeapDumpOnOutOfMemoryError<\/span> <span>-XX:HeapDumpPath=dump.hprof<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h3> <a name=\"worker-jvm-configuration\" href=\"#worker-jvm-configuration\"> <\/a> Worker JVM Configuration <\/h3>\n<div>\n<pre><code><span>environment<\/span><span>:<\/span> <span>JAVA_OPTS<\/span><span>:<\/span> <span>&gt;<\/span> <span>-server<\/span> <span>-Duser.timezone=${SPRING_JACKSON_TIME_ZONE}<\/span> <span>-Xms8g<\/span> <span>-Xmx8g<\/span> <span>-Xmn4g<\/span> <span>-XX:+PrintGCDetails<\/span> <span>-Xloggc:gc.log<\/span> <span>-XX:+HeapDumpOnOutOfMemoryError<\/span> <span>-XX:HeapDumpPath=dump.hprof<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h3> <a name=\"volume-configuration\" href=\"#volume-configuration\"> <\/a> Volume Configuration <\/h3>\n<div>\n<pre><code><span>volumes<\/span><span>:<\/span> <span># Comment out PostgreSQL volume<\/span> <span># dolphinscheduler-postgresql:<\/span> <span>dolphinscheduler-mysql<\/span><span>:<\/span> <span>dolphinscheduler-zookeeper<\/span><span>:<\/span> <span>dolphinscheduler-worker-data<\/span><span>:<\/span> <span>dolphinscheduler-logs<\/span><span>:<\/span> <span>dolphinscheduler-shared-local<\/span><span>:<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h2> <a name=\"update-the-env-file\" href=\"#update-the-env-file\"> <\/a> Update the .env File <\/h2>\n<div>\n<pre><code><span># Docker Hub Repository and Image Tag <\/span> <span>HUB<\/span><span>=<\/span><span>apache<\/span> <span>TAG<\/span><span>=<\/span><span>3.1.9<\/span> <span># MySQL Configuration <\/span> <span>MYSQL_ROOT_PASSWORD<\/span><span>=<\/span><span>root<\/span> <span>MYSQL_DATABASE<\/span><span>=<\/span><span>dolphinscheduler<\/span> <span>MYSQL_USERNAME<\/span><span>=<\/span><span>root<\/span> <span>MYSQL_PASSWORD<\/span><span>=<\/span><span>root<\/span> <span># DolphinScheduler Database Configuration <\/span> <span>TZ<\/span><span>=<\/span><span>Asia\/Shanghai<\/span> <span># Use MySQL as the metadata database <\/span> <span>DATABASE<\/span><span>=<\/span><span>mysql<\/span> <span>SPRING_JACKSON_TIME_ZONE<\/span><span>=<\/span><span>GMT+8<\/span> <span>SPRING_DATASOURCE_URL<\/span><span>=<\/span><span>jdbc:mysql:\/\/dolphinscheduler-mysql:3306\/${MYSQL_DATABASE}?useUnicode=true&amp;characterEncoding=UTF-8&amp;useSSL=false&amp;serverTimezone=Asia\/Shanghai&amp;allowPublicKeyRetrieval=true<\/span> <span>SPRING_DATASOURCE_USERNAME<\/span><span>=<\/span><span>${MYSQL_USERNAME}<\/span> <span>SPRING_DATASOURCE_PASSWORD<\/span><span>=<\/span><span>${MYSQL_PASSWORD}<\/span> <span>REGISTRY_ZOOKEEPER_CONNECT_STRING<\/span><span>=<\/span><span>dolphinscheduler-zookeeper:2181<\/span> <span>MASTER_FETCH_COMMAND_NUM<\/span><span>=<\/span><span>10<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h2> <a name=\"initialize-the-database\" href=\"#initialize-the-database\"> <\/a> Initialize the Database <\/h2>\n<div>\n<pre><code>docker compose <span>--profile<\/span> schema up <span>-d<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h2> <a name=\"start-the-entire-cluster\" href=\"#start-the-entire-cluster\"> <\/a> Start the Entire Cluster <\/h2>\n<div>\n<pre><code>docker compose <span>--profile<\/span> all up <span>-d<\/span> <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h2> <a name=\"start-the-worker-service\" href=\"#start-the-worker-service\"> <\/a> Start the Worker Service <\/h2>\n<div>\n<pre><code>docker compose up <span>-d<\/span> dolphinscheduler-worker <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h2> <a name=\"start-the-master-service\" href=\"#start-the-master-service\"> <\/a> Start the Master Service <\/h2>\n<div>\n<pre><code>docker compose up <span>-d<\/span> dolphinscheduler-master <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h2> <a name=\"start-the-alert-service\" href=\"#start-the-alert-service\"> <\/a> Start the Alert Service <\/h2>\n<div>\n<pre><code>docker compose up <span>-d<\/span> dolphinscheduler-alert <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h2> <a name=\"start-the-api-service\" href=\"#start-the-api-service\"> <\/a> Start the API Service <\/h2>\n<div>\n<pre><code>docker compose up <span>-d<\/span> dolphinscheduler-api <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h2> <a name=\"restart-all-services\" href=\"#restart-all-services\"> <\/a> Restart All Services <\/h2>\n<div>\n<pre><code>docker compose <span>--profile<\/span> all restart <\/code><\/pre>\n<div>\n<\/p><\/div>\n<\/p><\/div>\n<h2> <a name=\"conclusion\" href=\"#conclusion\"> <\/a> Conclusion <\/h2>\n<p>Although Apache DolphinScheduler officially ships with a PostgreSQL-based Docker Compose deployment, many enterprises continue to standardize on MySQL for operational consistency and ecosystem compatibility.<\/p>\n<p>By adding the MySQL JDBC driver, rebuilding the DolphinScheduler images, and adjusting the Docker Compose and environment configurations, you can quickly deploy a fully functional Apache DolphinScheduler 3.1.9 cluster powered by MySQL metadata storage.<\/p>\n<p>This approach enables teams already invested in the MySQL ecosystem to integrate DolphinScheduler into their infrastructure with minimal friction while preserving the benefits of containerized deployment and cluster-based scheduling.<\/p>\n<p>If your organization relies on MySQL as a strategic database platform, this solution provides a practical and production-friendly path to running Apache DolphinScheduler at scale.<\/p>\n<\/p><\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Fuente: <a href=\"https:\/\/dev.to\/chen_debra_3060b21d12b1b0\/deploying-apache-dolphinscheduler-319-cluster-with-mysql-instead-of-postgresql-a-practical-2mam\">Art\u00edculo original<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Download the MySQL JDBC Driver wget https:\/\/downloads.mysql.com\/archives\/get\/p\/3\/file\/mysql-connector-j-8.0.33.zip unzip -q mysql-connector-j-8.0.33.zip cp mysql-connector-j-8.0.33\/mysql-connector-j-8.0.33.jar . Prepare Custom Images Dockerfile for Master, Worker, API, and Alert Server # Based on the official DolphinScheduler image ARG SERVICE=api FROM apache\/dolphinscheduler-${SERVICE}:3.1.9 # Copy the MySQL JDBC driver into the DolphinScheduler library directory # DolphinScheduler loads JDBC drivers from the lib directory [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2982,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[41],"tags":[],"class_list":["post-2983","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devto"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/posts\/2983","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/comments?post=2983"}],"version-history":[{"count":0,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/posts\/2983\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/media\/2982"}],"wp:attachment":[{"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/media?parent=2983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/categories?post=2983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tucumandevelopers.com\/index.php\/wp-json\/wp\/v2\/tags?post=2983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}