{"id":707,"date":"2016-07-15T22:18:05","date_gmt":"2016-07-15T16:48:05","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=707"},"modified":"2026-09-10T13:25:29","modified_gmt":"2026-09-10T07:55:29","slug":"rundeck-failover-setup","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/rundeck-failover-setup\/","title":{"rendered":"Rundeck Failover Setup"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Introduction:<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In this post, we will explain how to set up failover on Rundeck. Rundeck officially doesn\u2019t supports failover. We tested this approach on CentOS 6 and it\u2019s working fine. Moreover, use this approach at your own risk \u00f0\u0178\u02dc\u203a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Prerequisites:<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This post assumes that Rundeck is running on host1 and listens on port 8000. Its standalone server and using mysql database.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before moving to the post, let\u2019s understand basic execution mode on Rundeck. There are 2 kinds of execution mode available on Rundeck<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Active Mode: Jobs, scheduled Jobs, and adhoc executions can be run.<\/li>\n\n\n\n<li>Passive Mode: No Jobs or adhoc executions can be run.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">We will configure Rundeck failover server in Passive mode, where no jobs will run and whenever the master server goes down, the Rundeck failover server will become a master.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Implementation<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Check whether the Rundeck master server is listening on port 8000 from the failover server<\/li>\n\n\n\n<li>If the Rundeck master responds, copy the projects and log folders and check whether the failover server is in active mode or passive mode. If the Rundeck failover server is in active mode, change it to passive mode and send notifications. If the Rundeck failover server is in Passive mode, then do nothing.<\/li>\n\n\n\n<li>If the Rundeck master doesn\u2019t respond, switch the failover Rundeck server execution mode from Passive to Active and send notifications.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Fail Over Setup:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Install Rundeck on the failover server.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">$ rpm -Uvh http:\/\/repo.rundeck.org\/latest.rpm<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">$ yum install rundeck<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;Configure database details on the rundeck Failover server.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">$&nbsp;<code>vi \/etc\/rundeck\/rundeck-config.properties<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">dataSource.url=jdbc:mysql:\/\/IPADDRESS\/rundeck?autoReconnect=true<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">dataSource.username=rundeck<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">dataSource.password=&lt;YOUR PASSWORD&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">dataSource.driverClassName=com.mysql.jdbc.Driver<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Modify the rundeck port if you wish to listen on different. In our case, we used port 8000<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">$&nbsp;<code>vi \/etc\/rundeck\/profile<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">RDECK_HTTP_PORT=8000<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Grant privileges to mysql user on mysql host<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">grant all on rundeck.* to \u2018rundeck\u2019@\u2019FAILOVER-IPADDRESS\u2019 identified by \u2018&lt;YOUR PASSWORD&gt;\u00e2\u20ac&#x2122;;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">flush privileges;<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Copy ssh key on master to failover server. Execute the below command on failover server<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">scp \/var\/lib\/rundeck\/.ssh<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">MASTER_IP_ADDRESS:\/var\/lib\/rundeck<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Generate API key on FAILOVER SERVER. Move your Pointer to&nbsp;<strong>Rundeck -&gt; Settings -&gt; GENERATE<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Provide&nbsp;<strong>enable_executions, disable_executions&nbsp;<\/strong>&nbsp;to<strong>&nbsp;apitoken.aclpolicy<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">$&nbsp;<code>vi \/etc\/rundeck\/apitoken.aclpolicy<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">context:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp; application: \u2018rundeck\u2019<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">for:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp; resource:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp; &nbsp; \u2013 equals:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp; &nbsp; &nbsp; &nbsp; kind: system<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp; &nbsp; &nbsp; allow:&nbsp;<strong>[read,enable_executions,disable_executions]<\/strong>&nbsp;# allow read of system info<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Start the rundeck service on failover server.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\">$&nbsp;<code>\/etc\/init.d\/rundeck start<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Change active mode to passive on the failover server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Rundeck Server -&gt; Settings -&gt; Change Executions -&gt; Passive -&gt; Save<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Copy the failover script and add it to cron to run every 15 minutes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#!\/usr\/bin\/python\n#Author:support@pheonixsolutions.com\n#Description: Script to setup Failover\n#Schedule this script on cron to run every 15 minutes\n#Love to do in Python\n#Version:1.0\nimport os,sys,socket\nimport xml.etree.ElementTree\nimport smtplib\nimport email\nimport email.mime.text\nimport string\n# Required Variables\nPROJECT_FOLDER='\/var\/rundeck\/projects'\nLOG_FOLDER='\/var\/log\/rundeck'\nEXECUTION_LOGS='\/var\/lib\/rundeck\/logs'\nMASTER_IP_ADDRESS='&lt;MASTER-IP-ADDRESS'\nFAILOVER_IP_ADDRESS='&lt;FAILOVER-IP_ADDRESS' RUNDECK_PORT=8000 sender_mail = 'rundeck-failover@domain.tld' # Mention FROM email address recipients =['email1@domain.tld','email2@domain.tld']#Separated by Comma API_TOKEN='YOUR API TOKEN' print \"Checking whether Rundeck Master server is responding..\" check_socket=socket.socket() try: check_socket.connect((MASTER_IP_ADDRESS,RUNDECK_PORT)); #print \"Connected to %s on port %s\" % (MASTER_IP_ADDRESS, RUNDECK_PORT) # \"Syncing data from Master to Slave\" os.system('rsync -ratlz root@'+MASTER_IP_ADDRESS+':'+PROJECT_FOLDER+'\/* ' +PROJECT_FOLDER+'\/') os.system('rsync -ratlz root@'+MASTER_IP_ADDRESS+':'+LOG_FOLDER+'\/* ' +LOG_FOLDER+'\/') os.system('rsync -ratlz root@'+MASTER_IP_ADDRESS+':'+EXECUTION_LOGS+'\/* ' +EXECUTION_LOGS+'\/') os.system(\"curl -H 'X-Rundeck-Auth-Token:\"+API_TOKEN+\"' http:\/\/\"+FAILOVER_IP_ADDRESS+\":\"+str(RUNDECK_PORT)+\"\/api\/2\/system\/info&gt;\/tmp\/output_failover.xml\");\n  e = xml.etree.ElementTree.parse('\/tmp\/output_failover.xml').getroot()\n  for all_elements in e:\n    for executions in all_elements:\n      if(executions.tag =='executions'):\n        #Checking whether Failover server is active or passive\n        if(executions.get('executionMode') == 'active'):\n          os.system('curl -H \"X-Rundeck-Auth-Token:'+API_TOKEN+'\" -X POST http:\/\/'+FAILOVER_IP_ADDRESS+':'+str(RUNDECK_PORT)+'\/api\/14\/system\/executions\/disable');\n          #Sending Notifications\n          body=\"Master Server %s is up. Fail Over Server Execution Mode is Active. Disabling Active Mode on %s\\n\" %(MASTER_IP_ADDRESS,FAILOVER_IP_ADDRESS)\n          body_of_the_message= email.mime.text.MIMEText(body,'html');\n          message      = email.MIMEMultipart.MIMEMultipart('alternative')\n          message['Subject'] =\"Rundeck Fail Over Alert\"\n          message['From']    = sender_mail\n          message.attach(body_of_the_message);\n          message['To']=\",\".join(recipients)\n          server = smtplib.SMTP('localhost')\n          server.sendmail(message['From'],recipients,message.as_string())\n          server.quit()\n        elif(executions.get('executionMode') == 'passive'):\n          print \"Fail Over Server Execution Mode is Passive. Do Nothing..\";\n        else:\n          print \"Something is wrong. Please check Fail Over Server %s.\" %(FAILOVER_IP_ADDRESS)\n          body=\"Rundeck Fail Over Alert: Something is Wrong on %s\" %(FAILOVER_IP_ADDRESS)\n          body_of_the_message= email.mime.text.MIMEText(body,'html');\n          message      = email.MIMEMultipart.MIMEMultipart('alternative')\n          message['Subject'] =\"Urgent:Rundeck Fail Over Alert. Something is wrong on Failover Server\"\n          message['From']    = sender_mail\n          message['To']=\",\".join(recipients)\n          message.attach(body_of_the_message);\n          server = smtplib.SMTP('localhost')\n          server.sendmail(message['From'],recipients,message.as_string())\n          server.quit()\n#If the Master server doesn't Responds, switch the connection\nexcept socket.error, e:\n  print \"Connection Failed. Master Rundeck server failed %s\" %(MASTER_IP_ADDRESS);\n  print \"Starting Failover Server\"\n  os.system('curl -H \"X-Rundeck-Auth-Token:'+API_TOKEN+'\" -X POST http:\/\/'+FAILOVER_IP_ADDRESS+':'+str(RUNDECK_PORT)+'\/api\/14\/system\/executions\/enable');\n  body=\"Rundeck Fail Over Alert: Rundeck Master is Down %s. Failover Completed on %s. Please check \" %(MASTER_IP_ADDRESS,FAILOVER_IP_ADDRESS)\n  body_of_the_message= email.mime.text.MIMEText(body,'html');\n  message      = email.MIMEMultipart.MIMEMultipart('alternative')\n  message['From']    = sender_mail\n  message['Subject'] =\"Urgent: Rundeck Master Server %s is Down. Please check \" %(MASTER_IP_ADDRESS)\n  message.attach(body_of_the_message);\n  message['To']=\",\".join(recipients)\n  server = smtplib.SMTP('localhost')\n  server.sendmail(message['From'],recipients,message.as_string())\n  server.quit()<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><br>Add the script to cron to run every 15 minutes.<br>Stop the Rundeck server on the master and execute the copied script; you can see the failover server become Active mode.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The script can be downloaded from&nbsp;<a href=\"https:\/\/github.com\/Pheonixsolutions\/rundeck-failover\" target=\"_blank\" rel=\"noopener\">github<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This solution provides a practical failover mechanism for standalone Rundeck deployments by leveraging automated monitoring, synchronisation, and execution mode switching. While it is not an officially supported high-availability solution, it can significantly improve service continuity in environments where Rundeck availability is critical. Regular testing and monitoring are recommended to ensure the failover process operates as expected.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQs<\/h2>\n\n\n\n<h5 class=\"wp-block-heading\">1. Does Rundeck officially support failover?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">No. The approach described in this article is a custom failover mechanism for standalone Rundeck deployments and is not an officially supported high-availability solution.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">2. What is the purpose of the failover server?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">The failover server acts as a standby Rundeck server. It remains in <strong>Passive<\/strong> execution mode while the master server is running and switches to <strong>Active<\/strong> mode when the master becomes unavailable.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">3. What is the difference between Active and Passive execution modes in Rundeck?<\/h5>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Active Mode:<\/strong> Jobs, scheduled jobs, and ad-hoc executions can run.<\/li>\n\n\n\n<li><strong>Passive Mode:<\/strong> Job and ad-hoc executions are disabled.<\/li>\n<\/ul>\n\n\n\n<h5 class=\"wp-block-heading\">4. How does the failover script determine whether the master server is available?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">The script checks whether it can establish a connection to the configured Rundeck master IP address on port <strong>8000<\/strong>. If the connection succeeds, the master is considered available. If the connection fails, the failover process is triggered.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">5. What happens when the master Rundeck server is down?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">When the master server does not respond, the script enables executions on the failover server, changing it from <strong>Passive<\/strong> to <strong>Active<\/strong> mode. It also sends an email notification.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">6. What happens when the master server comes back online?<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">The script detects that the master server is responding again. It synchronizes the required project and log data and checks the execution mode of the failover server. If the failover server is still Active, it changes it back to Passive mode and sends a notification.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Related Article:<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/exportingimporting-a-job-on-rundeck\/\">How to Export and Import Jobs in Rundeck &#8211; Pheonix Solutions<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to our experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Have a technology challenge or looking for the right solution for your business? Our team can help you with <strong>cloud, DevOps, development, infrastructure, design, and more<\/strong>. Feel free to reach out to our experts <a href=\"https:\/\/pheonixsolutions.com\/contact\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: In this post, we will explain how to set up failover on Rundeck. Rundeck officially doesn\u2019t supports failover. We [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[294,292,293,210],"class_list":["post-707","post","type-post","status-publish","format-standard","hentry","category-web-architecture","tag-failover","tag-python","tag-rundeck","tag-script","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-bp","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/707","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=707"}],"version-history":[{"count":2,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/707\/revisions"}],"predecessor-version":[{"id":11629,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/707\/revisions\/11629"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=707"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=707"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}