-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1538 lines (948 loc) · 52.7 KB
/
index.html
File metadata and controls
1538 lines (948 loc) · 52.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>code spelunking</title>
<meta name="author" content="Timothy St. Clair">
<meta name="description" content="“Link to new location”
">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://timothysc.github.io/">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="/atom.xml" rel="alternate" title="code spelunking" type="application/atom+xml">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="/javascripts/libs/jquery.min.js"%3E%3C/script%3E'))</script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="//fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
</head>
<body >
<header role="banner"><hgroup>
<h1><a href="/">code spelunking</a></h1>
<h2>Q: 'Whats under this rock?' A: 'more rocks...'</h2>
</hgroup>
</header>
<nav role="navigation"><ul class="subscription" data-subscription="rss">
<li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
</ul>
<form action="http://google.com/search" method="get">
<fieldset role="search">
<input type="hidden" name="sitesearch" value="timothysc.github.io">
<input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset>
</form>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
<li><a href="/blog/archives">Archives</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="/blog/2017/03/04/moved-to-medium/">Moved to Medium</a></h1>
<p class="meta">
<time class='entry-date' datetime='2017-03-04T14:37:55-06:00'><span class='date'><span class='date-month'>Mar</span> <span class='date-day'>4</span><span class='date-suffix'>th</span>, <span class='date-year'>2017</span></span> <span class='time'>2:37 pm</span></time>
| <a href="/blog/2017/03/04/moved-to-medium/#disqus_thread"
data-disqus-identifier="http://timothysc.github.io/blog/2017/03/04/moved-to-medium/">Comments</a>
</p>
</header>
<div class="entry-content"><p><a href="http://medium.com/@timothysc">“Link to new location”</a></p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/09/08/mesos-breeze/">Getting Started With Mesos on Fedora 21 and CentOS 7</a></h1>
<p class="meta">
<time class='entry-date' datetime='2014-09-08T10:00:00-05:00'><span class='date'><span class='date-month'>Sep</span> <span class='date-day'>8</span><span class='date-suffix'>th</span>, <span class='date-year'>2014</span></span> <span class='time'>10:00 am</span></time>
| <a href="/blog/2014/09/08/mesos-breeze/#disqus_thread"
data-disqus-identifier="http://timothysc.github.io/blog/2014/09/08/mesos-breeze/">Comments</a>
</p>
</header>
<div class="entry-content"><p><img class="left" src="/images/mesos_logo.png"></p>
<h2>Background</h2>
<p>For decades now, computer scientists have debated on how
to coordinate groups of heterogeneous compute resources to solve a set of domain
specific problems. “Scheduling” was the catch all moniker that was used to
describe this space. This category of problems is <em>old</em>, therefore the
scheduling universe is vast, and expansive.</p>
<p>The most recent generation of schedulers that have emerged, strive to address the
problem of coordinating several distributed applications across a data-center.
The reason why I find this interesting, is that many distributed applications
reinvent aspects of a “scheduler”, often without realizing the depth and breadth
of the domain they just stepped into. There is a great ACM article that highlights
this point <a href="http://queue.acm.org/detail.cfm?id=2482856">“There’s Just No Getting around It: You’re Building a Distributed System”.</a></p>
<p>Now-a-days, we’re seeing a Cambrian explosion of software stacks, each
reinventing pieces of the scheduling wheel. That’s all well and good, but
there is a much easier way. Enter Apache Mesos, a cluster manager
that provides efficient resource isolation and sharing across distributed
applications.</p>
<p>At its core, Mesos is a <strong>focused</strong> meta-scheduler that provides <strong>primitives</strong> to express a wide
variety of scheduling patterns and use cases. Solutions are <strong>written atop</strong> of Mesos, and are
targeted for a particular use case. By remaining focused at its core, Mesos
is not architecturally encumbered by domain specific problems that often exist
within other monolithic schedulers.</p>
<hr />
<h2>References</h2>
<ul>
<li><a href="http://youtu.be/YB1VW0LKzJ4">Introduction to Mesos</a></li>
<li><a href="http://youtu.be/VQAAkO5B5Hg?list=UUeDh9omC_xMKrar2srQZiLg">John Wilkes #MesosCon Keynote</a></li>
<li><a href="http://mesos.apache.org/documentation/latest/mesos-architecture/">Mesos Architecture</a></li>
<li><a href="http://youtu.be/hTcZGODnyf0">Building and Running Distributed Systems using Apache Mesos</a></li>
<li><a href="http://mesos.apache.org/documentation/latest/app-framework-development-guide/">Framework Development Guide</a></li>
<li><a href="https://www.youtube.com/user/TwitterUniversity">Twitter University</a></li>
</ul>
<hr />
<h2>Overview</h2>
<p>I often find software first impressions are usually pretty important,
and if I have to spend hours setting up an application, then that usually colors
my perspective about the technology.</p>
<p>Therefore, in this post I will run through how simple it is for you to get started with
Mesos on Fedora 21 and CentOS 7. <strong>I’ll leave HA deployments for another post, because I want
to outline just how simple it is to setup for “trying it out”.</strong></p>
<hr />
<h2>Prerequisites</h2>
<ul>
<li><a href="http://fedoraproject.org/en/get-fedora">Latest Fedora Machine</a> (OR) <a href="http://www.centos.org/download/">CentOS 7 box </a>with<a href="https://fedoraproject.org/wiki/EPEL"> epel installed</a></li>
</ul>
<h3>CentOS 7</h3>
<p>Currently dependent packages have not been fully pulled into CentOS 7, or epel
channels, but I’ve enabled the <a href="http://pkgs.fedoraproject.org/cgit/mesos.git/tree/mesos.spec">mesos.spec</a>
to build a bundled distribution for those who want to run on CentOS 7. For
convenience, rpms can be found <a href="https://tstclair.fedorapeople.org/mesos/centos7/">here</a></p>
<p>But for those who want to rebuild it for themselves, you can download the <a href="http://koji.fedoraproject.org/koji/packageinfo?packageID=17691">srpm</a> and run:
$ mock –clean –init -r epel-7-x86_64 –rebuild mesos-0.20.0-2.f421ffd.fc21.src.rpm</p>
<p>You will also need to update your docker installation to 1.X.</p>
<h3>Multi-Node Cluster</h3>
<ul>
<li>If you setting up a multi-node cluster, it is recommended that you have DNS setup.</li>
<li>You may also want to alter your firewall settings.</li>
</ul>
<hr />
<h2>Installation</h2>
<pre><code>$ sudo yum install mesos python-mesos mesos-devel mesos-java
</code></pre>
<hr />
<h2>Setup</h2>
<p>Make sure docker is running:
$ systemctl start docker</p>
<h3>Single Node</h3>
<p>Out of the box, the package is configured to run mesos on a single host machine. Which is convenient for
developers who just want to install and test their applications locally before submitting to their cluster.</p>
<h3>Multi-Node</h3>
<p>If you want to setup a multi-node cluster there is simply one parameter you need to set on your worker nodes <em>/etc/mesos/mesos-slave-env.sh</em> file:
export MESOS_master=yourmaster.yourdomain.com:5050</p>
<hr />
<h2>Running</h2>
<h3>Master Node</h3>
<pre><code>$ systemctl start mesos-master
</code></pre>
<p>and open a browser to <a href="http://localhost:5050">localhost:5050</a></p>
<h3>Worker Node</h3>
<pre><code>$ systemctl start mesos-slave
</code></pre>
<p>Now check the “Slaves” tab on the browser window to verify.</p>
<h3>Smoke Test</h3>
<pre><code>$ mesos execute --command="/bin/sleep 10" --master="yourmaster.yourdomain.com:5050" --name="whizbang"
</code></pre>
<p>Verify that it ran under the “Frameworks” tab.</p>
<hr />
<h3>Summary</h3>
<p>Distributed systems can be a complicated and thorny road, but setting up and
deploying them doesn’t have to be, and <strong>it’s a breeze with Mesos</strong>.</p>
<p><strong>HaPpY HaCkInG!</strong></p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/02/17/bdas-tachyon/">Hot Rod Hadoop With Tachyon on Fedora 21 (Rawhide)</a></h1>
<p class="meta">
<time class='entry-date' datetime='2014-02-17T10:00:00-06:00'><span class='date'><span class='date-month'>Feb</span> <span class='date-day'>17</span><span class='date-suffix'>th</span>, <span class='date-year'>2014</span></span> <span class='time'>10:00 am</span></time>
| <a href="/blog/2014/02/17/bdas-tachyon/#disqus_thread"
data-disqus-identifier="http://timothysc.github.io/blog/2014/02/17/bdas-tachyon/">Comments</a>
</p>
</header>
<div class="entry-content"><p><img class="left" src="/images/Tachyon.jpg" title="" ></p>
<h2>Background</h2>
<p>Within the last couple of years we’ve witnessed a natural evolution in
the “Big Data” ecosystem. Where the common theme that you’ve probably heard in the
community that, “Memory is King”, and it is. Therefore, if you are looking for performance
optimization in your stack, an “in memory” layer should be part of
the equation. Enter <em>Tachyon</em>, which provides reliable file sharing across cluster
frameworks.</p>
<p>Tachyon can be used to support different framworks, as well as different filesystems.
So to bound the scope of this post, we will outline how to setup Tachyon on a local installation
to boost performance of map-reduce application whose data is stored in HDFS on Fedora 21.</p>
<hr />
<h2>Special Thanks</h2>
<p>Tachyon is a recent addition to the Fedora channels, and it would not have been possible
without the efforts of <a href="https://github.com/haoyuan">Haoyuan Li</a>, Gil Cattaneo,
and <a href="http://chapeau.freevariable.com/">William Benton</a></p>
<hr />
<h2>References</h2>
<ul>
<li><a href="https://amplab.cs.berkeley.edu/software/">BDAS Stack</a></li>
<li><a href="http://youtu.be/4lMAsd2LNEE">YouTube - Introduction to Tachyon</a></li>
<li><a href="http://tachyon-project.org/">Tachyon project</a></li>
<li><a href="https://fedoraproject.org/wiki/SIGs/bigdata">Fedora BIG Data SIG</a></li>
<li><a href="http://labs.ericsson.com/blog/going-beyond-hadoop-some-insights-for-big-data-platforms">Going beyond Hadoop</a></li>
</ul>
<hr />
<h2>Prerequisites</h2>
<ul>
<li><a href="http://fedoraproject.org/en/get-fedora">Latest Fedora Machine</a></li>
<li><a href="http://timothysc.github.io/blog/2013/09/14/hadoop-mapreduce/">Bootstrapping Your MapReduce 2.X Programming on Fedora 20</a></li>
</ul>
<hr />
<h2>Installation and Setup</h2>
<p>Prior to installing Tachyon please ensure that you have setup your hadoop installation
as outlined in the pre-reqs.</p>
<p>First you will need to install the tachyon package:</p>
<pre><code>$ sudo yum install amplab-tachyon
</code></pre>
<p>Now you will need to update /etc/hadoop/core-site.xml configuration for hadoop to
enable map-reduce to take advantage of tachyon, by appending the following snippet:</p>
<pre><code><property>
<name>fs.tachyon.impl</name>
<value>tachyon.hadoop.TFS</value>
</property>
</code></pre>
<p>Now that all the plumbing is in place you can restart hadoop</p>
<pre><code>systemctl restart hadoop-namenode hadoop-datanode hadoop-nodemanager hadoop-resourcemanager
</code></pre>
<p>Next, make certain your local HDFS instance is up and running, then
you will need to perform a tachyon format.</p>
<pre><code>$ sudo runuser hdfs -s /bin/bash /bin/bash -c "tachyon.sh format"
> Formatting Tachyon @ localhost
> Deleting /var/lib/tachyon/journal/
> Formatting hdfs://localhost:8020/tachyon/data
> Formatting hdfs://localhost:8020/tachyon/workers
</code></pre>
<hr />
<h3>Initialization</h3>
<p>Prior to running the daemons you will need to mount the in-memory filesystem.</p>
<pre><code>$ sudo tachyon-mount.sh SudoMount
</code></pre>
<p>Now you can start the daemons.</p>
<pre><code>$ sudo systemctl start tachyon-master tachyon-slave
</code></pre>
<p>For completeness you can inspect the logs which are located in the standard system location</p>
<pre><code>$ ls -la /var/log/tachyon
</code></pre>
<hr />
<h3>Operation</h3>
<p>Once you’ve verified tachyon is up and running, you can run a simple mapreduce application
as seen below:</p>
<pre><code>$ hadoop jar /usr/share/java/hadoop/hadoop-mapreduce-examples.jar wordcount
tachyon://localhost:19998/user/tstclair/input/constitution.txt
tachyon://localhost:19998/test1
</code></pre>
<p>You’ll notice tha tachyon prefix attached to the input and output locations. This enables
hadoop to start the TFS shim which will load and write to tachyon. To verify you can run the following:</p>
<pre><code>$ sudo runuser hdfs -s /bin/bash /bin/bash -c "tachyon.sh tfs ls /test1"
> 16.65 KB 02-17-2014 15:41:11:849 In Memory /test1/part-r-00000
> 0.00 B 02-17-2014 15:41:12:366 In Memory /test1/_SUCCESS
</code></pre>
<p>If you’re interested in grok'ing further you can probably find the part file under /mnt/ramdisk.</p>
<h2>Summary</h2>
<p>Tachyon provides reliable in memory file sharing across cluster frameworks, as we have seen
in our simple example. It also enables some very interesting prospects for other back end filesystems.</p>
<p>In future posts we’ll explore more elaborate configurations using tachyon atop different frameworks and filesystems.</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/09/14/hadoop-mapreduce/">Bootstrapping Your MapReduce 2.X Programming on Fedora 20</a></h1>
<p class="meta">
<time class='entry-date' datetime='2013-09-14T10:00:00-05:00'><span class='date'><span class='date-month'>Sep</span> <span class='date-day'>14</span><span class='date-suffix'>th</span>, <span class='date-year'>2013</span></span> <span class='time'>10:00 am</span></time>
| <a href="/blog/2013/09/14/hadoop-mapreduce/#disqus_thread"
data-disqus-identifier="http://timothysc.github.io/blog/2013/09/14/hadoop-mapreduce/">Comments</a>
</p>
</header>
<div class="entry-content"><p><img src="/images/ElephantCowboy.jpg" alt="Picture Courtesy of Mauro Flores jr"/></p>
<h2>Background</h2>
<p>Recently the BIG DATA SIG has added Hadoop 2.0.5 (or 2.X series) to the Fedora channels. This
marks the first addition into <em>any</em> OS-distribution which meets all the standards, and system integration
requirements set forth by their steering committee(s). Don’t be fooled, bundling .jars into a package that
looks like a .rpm or .deb != a compliant package (not even by a long shot).</p>
<p>So to give some props to all the effort that it took to lasso this elephant, this post will outline how to bootstrap
the default installation for MapReduce development.</p>
<hr />
<h2>References</h2>
<ul>
<li><a href="https://fedoraproject.org/wiki/Changes/Hadoop">Fedora 20 Hadoop Integration</a></li>
<li><a href="https://fedoraproject.org/wiki/Big_data_SIG">Fedora BIG DATA SIG</a></li>
<li><a href="http://fedoraproject.org/wiki/FedUp">Upgrading with FedUp</a></li>
<li><a href="https://fedoraproject.org/wiki/Packaging:Guidelines?rd=Packaging/Guidelines">Fedora Packaging Guidelines</a></li>
</ul>
<hr />
<h2>Prerequisites</h2>
<ul>
<li>Fedora 20 Machine</li>
</ul>
<hr />
<h2>Installation and Setup (as root)</h2>
<p>First you will need to install all the default hadoop packages and tools required.</p>
<pre><code>yum install hadoop-common hadoop-hdfs hadoop-libhdfs hadoop-mapreduce hadoop-mapreduce-examples hadoop-yarn maven-* xmvn*
</code></pre>
<p>Next you will need need to format your namenode:</p>
<pre><code>runuser hdfs -s /bin/bash /bin/bash -c "hadoop namenode -format"
</code></pre>
<p>Once your namenode has been formatted you can now start the daemons using the default service methods:</p>
<pre><code>systemctl start hadoop-namenode hadoop-datanode hadoop-nodemanager hadoop-resourcemanager
</code></pre>
<p>Finally you will want to create the default directories:</p>
<pre><code>hdfs-create-dirs
</code></pre>
<hr />
<h2>Setting up a Users Sandbox (as root)</h2>
<pre><code>runuser hdfs -s /bin/bash /bin/bash -c "hadoop fs -mkdir /user/tstclair"
runuser hdfs -s /bin/bash /bin/bash -c "hadoop fs -chown tstclair /user/tstclair"
</code></pre>
<hr />
<h2>Running WordCount (as user)</h2>
<p>For simplicity I’ve setup a WordCount example on github that you can copy.</p>
<pre><code>git clone https://github.com/timothysc/hadoop-tests.github
</code></pre>
<p>Once it has downloaded you can put the example .txt file into your user location</p>
<pre><code>cd hadoop-tests/WordCount
hadoop fs -put constitution.txt /user/tstclair
</code></pre>
<p>Now you can build WordCount against the system installed .jars.</p>
<pre><code>mvn-rpmbuild package
</code></pre>
<p>Finally you can run:</p>
<pre><code>hadoop jar wordcount.jar org.myorg.WordCount /user/tstclair /user/tstclair/output
</code></pre>
<p>Feel free to cat the part-0000 file to see the results.</p>
<hr />
<h2>In Summary</h2>
<p>Hadoop 2.0.5 now acts like a standard package, with all the accoutrements folks have come to expect.</p>
<p><em>Giddyup!</em></p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/06/14/systemd-cgroup-sla/">Leveraging Systemd Cgroup Integration to Provide SLAs on Fedora 18 & 19</a></h1>
<p class="meta">
<time class='entry-date' datetime='2013-06-14T10:00:00-05:00'><span class='date'><span class='date-month'>Jun</span> <span class='date-day'>14</span><span class='date-suffix'>th</span>, <span class='date-year'>2013</span></span> <span class='time'>10:00 am</span></time>
| <a href="/blog/2013/06/14/systemd-cgroup-sla/#disqus_thread"
data-disqus-identifier="http://timothysc.github.io/blog/2013/06/14/systemd-cgroup-sla/">Comments</a>
</p>
</header>
<div class="entry-content"><h2>Background</h2>
<p>In the not-so-distant past, enterprise data centers would create silos for specific
services to gaurentee some metric of performance, or “Service Level Agreement” (SLA). However,
this approach can be costly to create and maintain.</p>
<p>Enter the modern era of cloud computing, and one might wonder, “Why not just put it in VM?”. For
some use cases this might work just fine, because the metrics are “good-enough”. Despite this flexibility,
there are many cases where this approach simply won’t meet some measure of performance. I won’t elaborate
on the details, but it doesn’t take Schrödinger math to figure this out, because sometimes the cat
is dead even before you peak into the box. ;-)</p>
<p>Thus, in this post we will explore leveraging systemd cgroup integration to provide SLAs on Fedora.</p>
<hr />
<h2>References</h2>
<ul>
<li><a href="http://searchitchannel.techtarget.com/definition/service-level-agreement">Definition SLA</a></li>
<li><a href="https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/">Redhat Cgroup Documentation</a></li>
<li><a href="http://0pointer.de/blog/projects/resources.html">Resource Management with Systemd</a></li>
<li><a href="http://0pointer.de/public/systemd-man/systemd.directives.html">Systemd Service Directives</a></li>
</ul>
<hr />
<h2>Prerequisites</h2>
<ul>
<li>Fedora 18 or 19 box(es).</li>
<li>Make certain you’ve read the references, as I may gloss over some details in this post.</li>
</ul>
<hr />
<h2>Getting Started</h2>
<p>First you will need to choose a service which has been integrated with systemd that you can plan on tuning.
In this example I will use ‘condor’, but you could use any service that you desire.</p>
<pre><code> sudo yum install condor
</code></pre>
<p><strong>NOTE:</strong> You could do this with raw cgroups, but it becomes difficult to gaurentee performance unless
every service is in a group. So systemd does a lot of the heavy lifting for us.</p>
<p>Next you will need to determine the metrics of performance that you want to provide for that service. For the
purposes of simplicity, lets say we want to carve off 50% of the CPU for condor. You can
also play with disk-io-bandwidth and network settings too, but I think I will leave that for another post
as this can be complicated enough.</p>
<p>In order to divide up your machine you will first need to determine the existing
shares on your machine. This can be done by dumping the current cgroup settings to a file which
can then be analyzed to determine the new settings.</p>
<pre><code>cgsnapshot -s > cgroup_snap.conf
</code></pre>
<p>If you have a fairly basic setup you will notice the following pattern</p>
<pre><code># Configuration file generated by cgsnapshot
mount {
cpuset = /sys/fs/cgroup/cpuset;
cpu = /sys/fs/cgroup/cpu,cpuacct;
cpuacct = /sys/fs/cgroup/cpu,cpuacct;
memory = /sys/fs/cgroup/memory;
devices = /sys/fs/cgroup/devices;
freezer = /sys/fs/cgroup/freezer;
net_cls = /sys/fs/cgroup/net_cls;
blkio = /sys/fs/cgroup/blkio;
perf_event = /sys/fs/cgroup/perf_event;
}
group system {
cpu {
cpu.rt_period_us="1000000";
cpu.rt_runtime_us="0";
cpu.cfs_period_us="100000";
cpu.cfs_quota_us="-1";
cpu.shares="1024";
}
cpuacct {
cpuacct.usage="147354515620554";
}
}
group system/condor.service {
cpu {
cpu.rt_period_us="1000000";
cpu.rt_runtime_us="0";
cpu.cfs_period_us="100000";
cpu.cfs_quota_us="-1";
cpu.shares="1024";
}
cpuacct {
cpuacct.usage="146844720798260";
}
}
... * services look ~=
</code></pre>
<hr />
<h2>Analyzing your Configuration</h2>
<p>One thing you will notice is that systemd creates an implied hierarchy on your
machine by default, where each service has an equal amount of cpu.shares. This means
when all services are contending for resources, each “service” gets an equal
share.</p>
<p>Lets elaborate on shares a bit. Say you had two service S(a) = 1, and S(b) = 3 and each service
has multiple processes all contending for CPU.</p>
<pre><code>%CPU = service.cpu.share /(sum (service shares @ level))
%CPU[S(a)] = 1/4 = 25%
%CPU[S(b)] = 3/4 = 75%
</code></pre>
<p>So now lets extend this idea and create a simple hierarchy
where there are two groups, with each group having two services:</p>
<pre><code> Share Overall%
Group 1 1 25%
S(a) 1 12.5%
S(b) 1 12.5%
Group 2 3 75%
S(c) 3 56.25%
S(d) 1 18.75%
</code></pre>
<p>Hopefully this should be intuitive, however it can quickly goto plaid. Therefore, it’s
important to have a handle on how many services you have planed for a given machine, and
your intended hierarchy. Thus the cost of reliable performance is extra complexity, which
isn’t so bad provided you’ve done your math.</p>
<hr />
<h2>Altering your Configuration##</h2>
<p>So now lets provision condor such that it has 50% of the CPU. First we need to get a count
of number of services that exist on the machine.</p>
<pre><code>$ cgsnapshot -s | grep [.]service | wc -l
30
</code></pre>
<p>As you can see from the previous example, and from the documentation, the default cpu.shares
given to a service is 1024. Thus if we want 50% CPU:</p>
<pre><code>.50 = condor.cpu.shares/(1024*29 + condor.cpu.shares)
512*(29) + .50*condor.cpu.shares = condor.cpu.shares
14848 = (1-.50)*condor.cpu.shares
condor.cpu.shares = 14848/.50 = 29696
</code></pre>
<p>Seem nutty? GOOD! Don’t do it this way! Instead lets use the idea of promoting a top level
group:</p>
<pre><code>vim /usr/lib/systemd/system/condor.service
[Service]
ControlGroup=cpu:/condor
CPUShares=1024
</code></pre>
<p>Once we exit we will need to restart the daemon and verify it worked.</p>
<pre><code>systemctl daemon-reload
systemctl restart condor.service
</code></pre>
<p>You may need to remove any legacy cruft from cgroups, or reboot, but you can compare the two configuration files.</p>
<pre><code>cgsnapshot -s > cgroup_snap_2.conf
</code></pre>
<p>Next you will want to submit a whole bunch of condor jobs, and try to load down the other services.
To verify that your machine is behaving as expected you can run:</p>
<pre><code>systemd-cgtop
</code></pre>
<p>In this example it can be difficult when you have 30 services to accurately test that you are
guaranteed 50% so I would recommend that the reader promote a couple of services to the top level
and have them compete in a controlled experiment.</p>
<hr />
<h2>In Summary</h2>
<p>Systemd’s integration with cgroups is a many splendid thing, and when used correctly can
give administrators and developers another tool in which to help create SLAs in their datacenter.</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/04/22/personalhadoop/">Configuring a Personal Hadoop Development Environment on Fedora 18</a></h1>
<p class="meta">
<time class='entry-date' datetime='2013-04-22T10:00:00-05:00'><span class='date'><span class='date-month'>Apr</span> <span class='date-day'>22</span><span class='date-suffix'>nd</span>, <span class='date-year'>2013</span></span> <span class='time'>10:00 am</span></time>
| <a href="/blog/2013/04/22/personalhadoop/#disqus_thread"
data-disqus-identifier="http://timothysc.github.io/blog/2013/04/22/personalhadoop/">Comments</a>
</p>
</header>
<div class="entry-content"><h2>Background</h2>
<p>The following post outlines a setup and configuration of a “personal hadoop” development environment that is much akin to a “personal condor” setup.
The primary purpose is to have a single source for configuration and logs along with a soft-link to development built binaries such that switching
to a different build is a matter of updating a soft-link while maintaining all other data and configuration.</p>
<hr />
<h2>Use Cases</h2>
<ul>
<li>Comparison testing in a local sandbox without altering an existing system installation.</li>
<li>Single source configuration and logs</li>
<li>…</li>
</ul>
<hr />
<h2>References</h2>
<p>Inter-webz:</p>
<ul>
<li><a href="http://wiki.apache.org/hadoop/HowToSetupYourDevelopmentEnvironment">http://wiki.apache.org/hadoop/HowToSetupYourDevelopmentEnvironment</a></li>
<li><a href="http://vichargrave.com/create-a-hadoop-build-and-development-environment-for-hadoop/">http://vichargrave.com/create-a-hadoop-build-and-development-environment-for-hadoop/</a></li>
<li><a href="http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/">http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/</a></li>
<li><a href="http://wiki.apache.org/hadoop/">http://wiki.apache.org/hadoop/</a></li>
<li><a href="http://docs.hortonworks.com/CURRENT/index.htm#Appendix/Configuring_Ports/HDFS_Ports.htm">http://docs.hortonworks.com/CURRENT/index.htm#Appendix/Configuring_Ports/HDFS_Ports.htm</a></li>
</ul>
<p>Books:</p>
<ul>
<li><a href="http://www.amazon.com/Hadoop-The-Definitive-Guide-ebook/dp/B0082FE448/ref=dp_kinw_strp_1">Hadoop “The Definitive Guide”</a></li>
</ul>
<hr />
<h2>Disclaimers</h2>
<ul>
<li>Currently this is a non-native development setup that uses the existing maven dependencies. For details on native packaging please visit <a href="https://fedoraproject.org/wiki/Features/Hadoop">https://fedoraproject.org/wiki/Features/Hadoop</a></li>
<li>The setup listed below is for creating “Single-Node-Cluster”</li>
</ul>
<hr />
<h2>Prerequisites</h2>
<h3>Configure Password-less ssh</h3>
<pre><code>yum install openssh openssh-clients openssh-server
# generate a public/private key, if you don't already have one
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/*
# testing ssh:
ps -ef | grep sshd # verify sshd is running
ssh localhost # accept the certification when prompted
sudo passwd root # Make sure the root has a password
</code></pre>
<h3>Install Other Build Dependencies</h3>
<pre><code>yum install cmake git subversion dh-make ant autoconf automake sharutils libtool asciidoc xmlto curl protobuf-compiler gcc-c++
</code></pre>
<h3>Install Java And Deps</h3>
<pre><code>yum install java-1.7.0-openjdk java-1.7.0-openjdk-devel java-1.7.0-openjdk-javadoc *maven*
</code></pre>
<p>append to your .bashrc file:
export JVM_ARGS=“-Xmx1024m -XX:MaxPermSize=512m”
export MAVEN_OPTS=“-Xmx1024m -XX:MaxPermSize=512m”</p>
<p><strong>NOTE:</strong> These instructions have been updated to build against OpenJDK 7 on F18. Currently (4/25/13), builds are clean but there are
some test failures. To get a complete list of failed tests run:</p>
<pre><code> mvn install -Dmaven.test.failure.ignore=true
</code></pre>
<hr />
<h2>Building and Setting up a “personal-hadoop”</h2>
<h3>Building</h3>
<pre><code>git clone git://git.apache.org/hadoop-common.git
cd hadoop-common
git checkout -b branch-2.0.4-alpha origin/branch-2.0.4-alpha
mvn clean package -Pdist -DskipTests
</code></pre>
<h3>Creating Your “personal-hadoop” Sandbox</h3>
<p>In this configuration we default to <strong>/home/tstclair</strong></p>
<pre><code>cd ~
mkdir personal-hadoop
cd personal-hadoop
mkdir -p conf data name logs/yarn
ln -sf <your-git-loc>/hadoop-dist/target/hadoop-2.0.4-alpha home
</code></pre>
<h3>Override your environment</h3>
<p>append to your .bashrc file:
# Hadoop env override:
export HADOOP_BASE_DIR=${HOME}/personal-hadoop
export HADOOP_LOG_DIR=${HOME}/personal-hadoop/logs
export HADOOP_PID_DIR=${HADOOP_BASE_DIR}
export HADOOP_CONF_DIR=${HOME}/personal-hadoop/conf
export HADOOP_COMMON_HOME=${HOME}/personal-hadoop/home
export HADOOP_HDFS_HOME=${HADOOP_COMMON_HOME}
export HADOOP_MAPRED_HOME=${HADOOP_COMMON_HOME}
# Yarn env override:
export HADOOP_YARN_HOME=${HADOOP_COMMON_HOME}
export YARN_LOG_DIR=${HADOOP_LOG_DIR}/yarn
#classpath override to search hadoop loc
export CLASSPATH=/usr/share/java/:${HADOOP_COMMON_HOME}/share
#Finally update your PATH
export PATH=${HADOOP_COMMON_HOME}/bin:${HADOOP_COMMON_HOME}/sbin:${HADOOP_COMMON_HOME}/libexec:${PATH}</p>
<h3>Verify your setup</h3>
<pre><code>source ~/.bashrc
which hadoop # verify it should be ${HOME}/personal-hadoop/home/bin
hadoop -help # verify classpath is correct.
</code></pre>
<h3>Creating Initial Single Configuration Node Setup</h3>
<p>First copy in the default configuration files:
cp ${HADOOP_COMMON_HOME}/etc/hadoop/* ${HADOOP_BASE_DIR}/conf</p>
<p>NOTE: As your configuration testing space expands it is sometimes useful to have your conf directory to also be a softlink of configuration templates.</p>
<p>Next update your <em>hdfs-site.xml</em> with the following:
File /home/tstclair/work/spaces/timothysc.github.com/source/downloads/code/xml/hdfs-site.xml could not be found</p>
<p>Append, or update, your <em>mapred-site.xml</em> with the following:
File /home/tstclair/work/spaces/timothysc.github.com/source/downloads/code/xml/mapred-site.xml could not be found</p>
<p>Finally update your <em>yarn-site.xml</em> with the following:
File /home/tstclair/work/spaces/timothysc.github.com/source/downloads/code/xml/yarn-site.xml could not be found</p>
<p><strong>NOTE:</strong> You may notice that I’ve included default variables and their corresponding port numbers to ease default hunting.</p>
<h2>Starting Your Single Node Hadoop Cluster</h2>
<p>Format your namenode (only needed for the 1st setup):
hadoop namenode -format
#verify output is correct.</p>
<p>Start HDFS:
start-dfs.sh</p>
<p>open a browser to <a href="http://localhost:50070">http://localhost:50070</a> and verify you have 1 live node.</p>
<p>Next start yarn:
start-yarn.sh</p>
<p>Verify the logs show it’s running normally.</p>
<p>Finally check to see if you can run an MR application:
cd ${HADOOP_COMMON_HOME}/share/hadoop/mapreduce
hadoop jar hadoop-mapreduce-example-2.0.4-alpha.jar randomwriter out</p>
<p><strong>HAPPY HACKING!!!</strong></p>
</div>
</article>
<article>
<header>