You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2016-8-22-Jenkins CCJPE HA.markdown
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ Introduction
22
22
Welcome to the DevOps Library! This is Samantha, and today we're going to set
23
23
up the Enterprise edition of Jenkins! Up until now, we've only been using the
24
24
open-source version, but for the rest of this course, we'll mainly be focusing
25
-
on enterprise functionality.
25
+
on enterprise functionality.
26
26
27
27
Additionally, we're going to set up Jenkins the RIGHT way, in full HA mode,
28
28
with two masters sitting behind a load balancer.
@@ -118,27 +118,27 @@ completes, you can access the Jenkins web UI on port 8080.
118
118
119
119
Since this is the enterprise version of Jenkins, you will need to request a
120
120
trial license before you can do anything else. After you complete the
121
-
registration, go ahead and do a Jenkins install on the second AWS instance.
121
+
registration, go ahead and do a Jenkins install on the second AWS instance.
122
122
123
123
Jenkins High Availability Overview
124
124
----------------------------------
125
125
While that's installing, let's talk a little more in depth about what Jenkins
126
126
High Availability is, and what it is not. Essentially, the Enterprise Jenkins
127
127
HA plugin uses Jgroups to configure active/passive high availability when it
128
-
detects that two masters are sharing the same Jenkins home.
128
+
detects that two masters are sharing the same Jenkins home.
129
129
130
130
Because we installed Jenkins on the **Jenkins01** instance first, it'll start
131
-
out as our "primary" instance.
131
+
out as our "primary" instance.
132
132
133
133
If you try to access **Jenkins02** on port 8080 on the other hand, you'll see a
134
134
message letting you know that the node is standing by in case the primary
135
135
instance fails. Effectively, a Jenkins fail-over results in the shutting down
136
-
of the current Jenkins master, followed by it starting up on a second server.
136
+
of the current Jenkins master, followed by it starting up on a second server.
137
137
138
138
Failover Overview
139
139
-----------------
140
140
Because both masters share the same *$JENKINS_HOME*, a failover has the
141
-
following characteristics. Tje following will all survive a failover event:
141
+
following characteristics. The following will all survive a failover event:
142
142
143
143
* Jenkins Settings
144
144
* Configuration of Jobs & Users
@@ -149,7 +149,7 @@ following characteristics. Tje following will all survive a failover event:
149
149
150
150
However, by default, any builds that were in-progress won't survive. Don't worry--
151
151
Cloudbees has released two plugins to address this issue. The [Restart Aborted Builds](https://www.cloudbees.com/products/cloudbees-jenkins-platform/enterprise-edition/features/restart-aborted-builds-plugin) plugin makes it easy to kick off any jobs that were
152
-
running during a restart or failover event.
152
+
running during a restart or failover event.
153
153
154
154
Or, by using the [Long-Running Build](https://www.cloudbees.com/products/cloudbees-jenkins-platform/enterprise-edition/features/long-running-build-plugin) plugin, you can create jobs that survive master restarts, although
155
155
you'll have to change your jobs project type from FreeStyle to "Long Running
@@ -162,7 +162,7 @@ the Jenkins master URLs in your web browser, followed by **/ha/health-check**.
162
162
163
163
**Jenkins01** should return *Running as primary*, and **Jenkins02** should
164
164
return *Running as standby*. Excellent job!! If we were to shut down or have
165
-
**Jenkins01** crash, **Jenkins02** would automatically take its place as primary.
165
+
**Jenkins01** crash, **Jenkins02** would automatically take its place as primary.
166
166
The problem though is that our users would still have to change URLs after any
167
167
failover. That's why we still have one final step; we need to set up a load
168
168
balancer!
@@ -172,41 +172,41 @@ Setting up a Load Balancer
172
172
If you're not using AWS, your best bet is probably going to be something like
173
173
[HAproxy](http://www.haproxy.org/), or even an [F5](https://f5.com/products/big-ip)
174
174
if you have the budget. Thankfully for us, we can quickly set up an [Amazon ELB](https://aws.amazon.com/elasticloadbalancing/), or "Elastic Load Balancer".
175
-
Let's go ahead and do that now.
175
+
Let's go ahead and do that now.
176
176
177
-
On your AWS console, click "Load Balancers", then "Create Load Balancer".
177
+
On your AWS console, click "Load Balancers", then "Create Load Balancer".
178
178
Select "Classic Load Balancer", as we'll need to route both HTTP for the web
179
179
interface, as well as a TCP port for JNLP.
180
180
181
181
Feel free to name the balancer whatever you'd like, then use port 80 for the
182
182
listener port, and port 8080 on the instances. That way any traffic that comes
183
183
in on port 80 to the load balancer will automatically be redirected to port 80
184
-
on the primary instance. You'll also want to add a TCP port for JNLP.
184
+
on the primary instance. You'll also want to add a TCP port for JNLP.
185
185
We like to use 10001, but it doesn't matter what you use as long as it matches
186
186
what you configure under your Global Security settings.
187
187
188
188
Configure ELB Health Check
189
189
--------------------------
190
-
Next, after you select a security group, we need to set up a health check.
190
+
Next, after you select a security group, we need to set up a health check.
191
191
This is how Amazon determines to which instance traffic should flow. Remember
192
-
that **/ha/health-check** URL we went to earlier? Use that for the ping path.
192
+
that **/ha/health-check** URL we went to earlier? Use that for the ping path.
193
193
That way, the only instance that AWS will see as healthy is the one currently
194
194
running as primary.
195
195
196
-
You'll also want to lower the response timeout, interval, and healthy threshold.
196
+
You'll also want to lower the response timeout, interval, and healthy threshold.
197
197
If you copy the settings we have here, and the primary master goes down, you
198
198
should only experience a minute or two of downtime in the event of a failover,
199
199
give or take depending on how many plugins and jobs you're using.
200
200
201
-
Alright, add the two instances, then finish creating the load balancer.
201
+
Alright, add the two instances, then finish creating the load balancer.
202
202
Within a few minutes, the status of the load balancer should show one of two
203
203
instances as healthy. Once you see that, go ahead and pull up the load balancer
204
-
DNS name up in your browser.
204
+
DNS name up in your browser.
205
205
206
206
There we go!!! Great job!! You've successfully set up the Cloudbees Enterprise
207
207
Jenkins platform, and not only that, we're running it in full high availability
208
208
mode!!! Aside from a few performance and security tweaks, these guys are ready
209
-
for production use!! Right now we should be running off of **Jenkins01**.
209
+
for production use!! Right now we should be running off of **Jenkins01**.
210
210
211
211
Testing Failover
212
212
----------------
@@ -239,6 +239,6 @@ the DevOps community.
239
239
240
240
Thanks for Watching!
241
241
--------------------
242
-
[Subscribe to our YouTube channel](https://www.youtube.com/channel/UCOnioSzUZS-ZqsRnf38V2nA?sub_confirmation=1) or follow [DevOpsLibrary on Twitter](https://twitter.com/intent/user?screen_name=devopslibrary).
242
+
[Subscribe to our YouTube channel](https://www.youtube.com/channel/UCOnioSzUZS-ZqsRnf38V2nA?sub_confirmation=1) or follow [DevOpsLibrary on Twitter](https://twitter.com/intent/user?screen_name=devopslibrary).
0 commit comments