1.3.HowToInstallKsbFrameWork-old.html 64 KB
Newer Older
HooYoungAhn's avatar
HooYoungAhn committed
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
<!DOCTYPE html>
  <html>
    <head>
      <title>1.3.HowToInstallKsbFrameWork-old</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      
      <link rel="stylesheet" href="file:////Users/giyoung/.atom/packages/markdown-preview-enhanced/node_modules/@shd101wyy/mume/dependencies/katex/katex.min.css">
      
      
      
      
      
      
      
      
      
      

      <style> 
      /**
 * prism.js Github theme based on GitHub's theme.
 * @author Sam Clarke
 */
code[class*="language-"],
pre[class*="language-"] {
  color: #333;
  background: none;
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.4;

  -moz-tab-size: 8;
  -o-tab-size: 8;
  tab-size: 8;

  -webkit-hyphens: none;
  -moz-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
}

/* Code blocks */
pre[class*="language-"] {
  padding: .8em;
  overflow: auto;
  /* border: 1px solid #ddd; */
  border-radius: 3px;
  /* background: #fff; */
  background: #f5f5f5;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
  padding: .1em;
  border-radius: .3em;
  white-space: normal;
  background: #f5f5f5;
}

.token.comment,
.token.blockquote {
  color: #969896;
}

.token.cdata {
  color: #183691;
}

.token.doctype,
.token.punctuation,
.token.variable,
.token.macro.property {
  color: #333;
}

.token.operator,
.token.important,
.token.keyword,
.token.rule,
.token.builtin {
  color: #a71d5d;
}

.token.string,
.token.url,
.token.regex,
.token.attr-value {
  color: #183691;
}

.token.property,
.token.number,
.token.boolean,
.token.entity,
.token.atrule,
.token.constant,
.token.symbol,
.token.command,
.token.code {
  color: #0086b3;
}

.token.tag,
.token.selector,
.token.prolog {
  color: #63a35c;
}

.token.function,
.token.namespace,
.token.pseudo-element,
.token.class,
.token.class-name,
.token.pseudo-class,
.token.id,
.token.url-reference .token.variable,
.token.attr-name {
  color: #795da3;
}

.token.entity {
  cursor: help;
}

.token.title,
.token.title .token.punctuation {
  font-weight: bold;
  color: #1d3e81;
}

.token.list {
  color: #ed6a43;
}

.token.inserted {
  background-color: #eaffea;
  color: #55a532;
}

.token.deleted {
  background-color: #ffecec;
  color: #bd2c00;
}

.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}


/* JSON */
.language-json .token.property {
  color: #183691;
}

.language-markup .token.tag .token.punctuation {
  color: #333;
}

/* CSS */
code.language-css,
.language-css .token.function {
  color: #0086b3;
}

/* YAML */
.language-yaml .token.atrule {
  color: #63a35c;
}

code.language-yaml {
  color: #183691;
}

/* Ruby */
.language-ruby .token.function {
  color: #333;
}

/* Markdown */
.language-markdown .token.url {
  color: #795da3;
}

/* Makefile */
.language-makefile .token.symbol {
  color: #795da3;
}

.language-makefile .token.variable {
  color: #183691;
}

.language-makefile .token.builtin {
  color: #0086b3;
}

/* Bash */
.language-bash .token.keyword {
  color: #0086b3;
}html body{font-family:"Helvetica Neue",Helvetica,"Segoe UI",Arial,freesans,sans-serif;font-size:16px;line-height:1.6;color:#333;background-color:#fff;overflow:initial;box-sizing:border-box;word-wrap:break-word}html body>:first-child{margin-top:0}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{line-height:1.2;margin-top:1em;margin-bottom:16px;color:#000}html body h1{font-size:2.25em;font-weight:300;padding-bottom:.3em}html body h2{font-size:1.75em;font-weight:400;padding-bottom:.3em}html body h3{font-size:1.5em;font-weight:500}html body h4{font-size:1.25em;font-weight:600}html body h5{font-size:1.1em;font-weight:600}html body h6{font-size:1em;font-weight:600}html body h1,html body h2,html body h3,html body h4,html body h5{font-weight:600}html body h5{font-size:1em}html body h6{color:#5c5c5c}html body strong{color:#000}html body del{color:#5c5c5c}html body a:not([href]){color:inherit;text-decoration:none}html body a{color:#08c;text-decoration:none}html body a:hover{color:#00a3f5;text-decoration:none}html body img{max-width:100%}html body>p{margin-top:0;margin-bottom:16px;word-wrap:break-word}html body>ul,html body>ol{margin-bottom:16px}html body ul,html body ol{padding-left:2em}html body ul.no-list,html body ol.no-list{padding:0;list-style-type:none}html body ul ul,html body ul ol,html body ol ol,html body ol ul{margin-top:0;margin-bottom:0}html body li{margin-bottom:0}html body li.task-list-item{list-style:none}html body li>p{margin-top:0;margin-bottom:0}html body .task-list-item-checkbox{margin:0 .2em .25em -1.8em;vertical-align:middle}html body .task-list-item-checkbox:hover{cursor:pointer}html body blockquote{margin:16px 0;font-size:inherit;padding:0 15px;color:#5c5c5c;border-left:4px solid #d6d6d6}html body blockquote>:first-child{margin-top:0}html body blockquote>:last-child{margin-bottom:0}html body hr{height:4px;margin:32px 0;background-color:#d6d6d6;border:0 none}html body table{margin:10px 0 15px 0;border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}html body table th{font-weight:bold;color:#000}html body table td,html body table th{border:1px solid #d6d6d6;padding:6px 13px}html body dl{padding:0}html body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}html body dl dd{padding:0 16px;margin-bottom:16px}html body code{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:.85em !important;color:#000;background-color:#f0f0f0;border-radius:3px;padding:.2em 0}html body code::before,html body code::after{letter-spacing:-0.2em;content:"\00a0"}html body pre>code{padding:0;margin:0;font-size:.85em !important;word-break:normal;white-space:pre;background:transparent;border:0}html body .highlight{margin-bottom:16px}html body .highlight pre,html body pre{padding:1em;overflow:auto;font-size:.85em !important;line-height:1.45;border:#d6d6d6;border-radius:3px}html body .highlight pre{margin-bottom:0;word-break:normal}html body pre code,html body pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}html body pre code:before,html body pre tt:before,html body pre code:after,html body pre tt:after{content:normal}html body p,html body blockquote,html body ul,html body ol,html body dl,html body pre{margin-top:0;margin-bottom:16px}html body kbd{color:#000;border:1px solid #d6d6d6;border-bottom:2px solid #c7c7c7;padding:2px 4px;background-color:#f0f0f0;border-radius:3px}@media print{html body{background-color:#fff}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{color:#000;page-break-after:avoid}html body blockquote{color:#5c5c5c}html body pre{page-break-inside:avoid}html body table{display:table}html body img{display:block;max-width:100%;max-height:100%}html body pre,html body code{word-wrap:break-word;white-space:pre}}.markdown-preview{width:100%;height:100%;box-sizing:border-box}.markdown-preview .pagebreak,.markdown-preview .newpage{page-break-before:always}.markdown-preview pre.line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}.markdown-preview pre.line-numbers>code{position:relative}.markdown-preview pre.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:1em;font-size:100%;left:0;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-preview pre.line-numbers .line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.markdown-preview pre.line-numbers .line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.markdown-preview .mathjax-exps .MathJax_Display{text-align:center !important}.markdown-preview:not([for="preview"]) .code-chunk .btn-group{display:none}.markdown-preview:not([for="preview"]) .code-chunk .status{display:none}.markdown-preview:not([for="preview"]) .code-chunk .output-div{margin-bottom:16px}.scrollbar-style::-webkit-scrollbar{width:8px}.scrollbar-style::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}.scrollbar-style::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode]){position:relative;width:100%;height:100%;top:0;left:0;margin:0;padding:0;overflow:auto}html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{position:relative;top:0}@media screen and (min-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em calc(50% - 457px)}}@media screen and (max-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{font-size:14px !important;padding:1em}}@media print{html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{display:none}}html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{position:fixed;bottom:8px;left:8px;font-size:28px;cursor:pointer;color:inherit;z-index:99;width:32px;text-align:center;opacity:.4}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] #sidebar-toc-btn{opacity:1}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc{position:fixed;top:0;left:0;width:300px;height:100%;padding:32px 0 48px 0;font-size:14px;box-shadow:0 0 4px rgba(150,150,150,0.33);box-sizing:border-box;overflow:auto;background-color:inherit}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar{width:8px}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc a{text-decoration:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{padding:0 1.6em;margin-top:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc li{margin-bottom:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{list-style-type:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{left:300px;width:calc(100% -  300px);padding:2em calc(50% - 457px -  150px);margin:0;box-sizing:border-box}@media screen and (max-width:1274px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{width:100%}}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .markdown-preview{left:50%;transform:translateX(-50%)}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .md-sidebar-toc{display:none}
/* Please visit the URL below for more information: */
/*   https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */
 
      </style>
    </head>
    <body for="html-export">
      <div class="mume markdown-preview   ">
      <h1 class="mume-header" id="ksb-%EC%9D%B8%EA%B3%B5%EC%A7%80%EB%8A%A5-%ED%94%84%EB%A0%88%EC%9E%84%EC%9B%8C%ED%81%AC-%EC%84%A4%EC%B9%98">KSB 인공지능 프레임워크 설치</h1>

<hr>
<p>제공된 KSB 툴박스를 사용하지 않고, 직접 Host PC에 KSB 인공지능 프레임워크를 설치하기 위해서 아래의 오픈소스 프레임워크들을 설치합니다. 사용자 csle 계정을 생성한 후 아래 프로그램들을 설치합니다.</p>
<h2 class="mume-header" id="csle-%EC%82%AC%EC%9A%A9%EC%9E%90-%EA%B3%84%EC%A0%95%EA%B6%8C%ED%95%9C-administrator-%EC%83%9D%EC%84%B1%ED%95%98%EA%B8%B0">csle 사용자 계정(권한 : administrator) 생성하기</h2>

<p><a href="https://csleoss.etri.re.kr/images/contents/manual_1.0/1.2.HowToInstallKsbToolBox.html#host-pc-csle-%EC%82%AC%EC%9A%A9%EC%9E%90-%EA%B3%84%EC%A0%95%EA%B6%8C%ED%95%9C-administrator-%EC%83%9D%EC%84%B1%ED%95%98%EA%B8%B0" title="KSB &#xD234;&#xBC15;&#xC2A4; &#xC124;&#xCE58;">KSB 툴박스 설치</a>의 csle 사용자 계정 생성 부분을 참고합니다.</p>
<h2 class="mume-header" id="java-8-oracle-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">java-8-oracle 설치하기</h2>

<p><a href="https://csleoss.etri.re.kr/images/contents/manual_1.0/1.2.HowToInstallKsbToolBox.html#host-pc-java-8-oracle-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0" title="KSB &#xD234;&#xBC15;&#xC2A4; &#xC124;&#xCE58;">KSB 툴박스 설치</a>의 java-8-oracle 설치 부분을 참고합니다.</p>
<h2 class="mume-header" id="apache-hadoop-273-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">Apache Hadoop 2.7.3 설치하기</h2>

<p>아래 링크를 참고하여 사용자의 PC 혹은 클러스터 환경에 맞게 설치합니다.</p>
<p>참고링크 : <a href="https://hadoop.apache.org/docs/r2.7.3/">https://hadoop.apache.org/docs/r2.7.3/</a><br>
다운로드 링크 : <a href="https://archive.apache.org/dist/hadoop/common/hadoop-2.7.3/">https://archive.apache.org/dist/hadoop/common/hadoop-2.7.3/</a></p>
<h2 class="mume-header" id="spark-230-bin-hadoop27-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">spark-2.3.0-bin-hadoop2.7 설치하기</h2>

<p>아래 링크를 참고하여 사용자의 PC 혹은 클러스터 환경에 맞게 설치합니다.</p>
<p>참고링크 : <a href="https://spark.apache.org/downloads.html">https://spark.apache.org/downloads.html</a><br>
다운로드 링크 : <a href="https://spark.apache.org/downloads.html">https://spark.apache.org/downloads.html</a></p>
<h2 class="mume-header" id="hbase-124optional-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">hbase 1.2.4(optional) 설치하기</h2>

<p>아래 링크를 참고하여 사용자의 PC 혹은 클러스터 환경에 맞게 설치합니다.</p>
<p>참고링크 : <a href="https://hbase.apache.org/book.html">https://hbase.apache.org/book.html</a><br>
다운로드 링크 : <a href="https://archive.apache.org/dist/hbase/1.2.4/">https://archive.apache.org/dist/hbase/1.2.4/</a></p>
<h2 class="mume-header" id="kafka-211-01001optional-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">kafka 2.11-0.10.0.1(optional) 설치하기</h2>

<p>아래 링크를 참고하여 사용자의 PC 혹은 클러스터 환경에 맞게 설치합니다.</p>
<p>참고링크 : <a href="https://kafka.apache.org/">https://kafka.apache.org/</a><br>
다운로드 링크 : <a href="https://kafka.apache.org/downloads">https://kafka.apache.org/downloads</a></p>
<h2 class="mume-header" id="zookeeper-349optional-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">zookeeper 3.4.9(optional) 설치하기</h2>

<p>아래 링크를 참고하여 사용자의 PC 혹은 클러스터 환경에 맞게 설치합니다.</p>
<p>참고링크 : <a href="https://zookeeper.apache.org/">https://zookeeper.apache.org/</a><br>
다운로드 링크 : <a href="https://archive.apache.org/dist/zookeeper/zookeeper-3.4.9/">https://archive.apache.org/dist/zookeeper/zookeeper-3.4.9/</a></p>
<h2 class="mume-header" id="ksb-%ED%94%84%EB%A0%88%EC%9E%84%EC%9B%8C%ED%81%AC-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">KSB 프레임워크 설치하기</h2>

<p><a href="http://csleoss.etri.re.kr:8088/kor/sub02_01.do" title="&#xB2E4;&#xC6B4;&#xB85C;&#xB4DC;"> 다운로드</a> 페이지로부터 KSB 툴박스 파일을 다운로드합니다.</p>
<ul>
<li>ksb_toolbox_v1.tar.gz : KSB 툴박스 파일<br>
<br></li>
</ul>
<p>csle 사용자 계정의 home에 ksb_toolbox_v1.tar.gz 압축을 해제합니다. 결과적으로 /home/csle/ksb-csle 폴더가 생성됩니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">   csle@csle1:~$ <span class="token function">tar</span> zxvf ksb_toolbox_v1.tar.gz -C /home/csle/
</pre><p>/home/csle/ksb-csle 폴더는 다음의 하위 폴더들로 구성됩니다.</p>
<ul>
<li>/bin : KSB 프레임워크 shell 스크립트 파일 저장 폴더</li>
<li>/components : tensorflow train 예제 프로그램 저장 폴더</li>
<li>/conf : KSB 프레임워크 환경설정 파일 저장 폴더</li>
<li>/docker : KSB 툴박스 docker 컨테이너 실행 스크립트 저장 폴더</li>
<li>/examples : CLI(Command Line Interface)를 통해 워크플로우 생성 및 submit 할 수 있는 프로젝트 폴더</li>
<li>/jars : KSB 프레임워크 1.0 버전의 jar 파일 저장 폴더</li>
<li>/ksblib : python 전처리 라이브러리 폴더</li>
<li>/kubernetes : 쿠버네티스 환경설정 폴더</li>
<li>/logs : log 저장 폴더</li>
<li>/pyML : autoML python 프로젝트 폴더</li>
<li>/tools: 예제 테스트를 위한 프로그램(jmeter, hadoop, kafka, maven, .ssh)<br>
<br></li>
</ul>
<h2 class="mume-header" id="ksb-csle-conf-%ED%8C%8C%EC%9D%BC-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">ksb-csle conf 파일 설정하기</h2>

<p>/home/csle/ksb-csle/conf/ksb.conf 파일을 사용자 PC에 맞게 수정합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">csle <span class="token punctuation">{</span>
    user <span class="token punctuation">{</span>
        home <span class="token operator">=</span> <span class="token string">"/home/csle"</span>      <span class="token comment" spellcheck="true"># 사용자 home 디렉토리를 지정합니다.</span>
    <span class="token punctuation">}</span>
    home <span class="token operator">=</span> <span class="token string">"/home/csle/ksb-csle"</span> <span class="token comment" spellcheck="true"># KSB home 디렉토리를 지정합니다.</span>
    submit.cli <span class="token operator">=</span> <span class="token string">"true"</span>
    scheduler.initialization <span class="token operator">=</span> <span class="token string">"false"</span>
<span class="token punctuation">}</span>

servers <span class="token punctuation">{</span>
    gateway <span class="token punctuation">{</span>
        baseUrl <span class="token operator">=</span> <span class="token string">"http://KSB_GATEWAY:SERVICEPORT"</span>
    <span class="token punctuation">}</span>
    kubernetes <span class="token punctuation">{</span>
        <span class="token function">enable</span> <span class="token operator">=</span> <span class="token string">"false"</span>
        baseUrl <span class="token operator">=</span> <span class="token string">"http://SERVICENAME.ksb.local:30100"</span>
        imgRepositoryUrl <span class="token operator">=</span> <span class="token string">"docker.io"</span>
        kubernetes_yaml_path <span class="token operator">=</span> <span class="token string">"/kubernetes"</span>
        masterIp <span class="token operator">=</span> <span class="token string">"csle1"</span>   <span class="token comment" spellcheck="true"># Kubernetes 마스터 도메인 이름 혹은 IP를 지정합니다.</span>
        masterPort <span class="token operator">=</span> <span class="token string">"2243"</span>  <span class="token comment" spellcheck="true"># Kubernetes SSH 포트 번호를 지정합니다.</span>
        nodesIp <span class="token operator">=</span> <span class="token string">"csle2, csle3"</span>    <span class="token comment" spellcheck="true"># Kubernetes 노드들의 도메인 이름 혹은 IP들을 지정합니다.</span>
        user <span class="token operator">=</span> <span class="token string">"csle"</span>       <span class="token comment" spellcheck="true"># Kubernetes 서버의 사용자 ID를 지정합니다.</span>
        externalKafka <span class="token punctuation">{</span>
            brokerHostName <span class="token operator">=</span> <span class="token string">"csle1"</span>  <span class="token comment" spellcheck="true"># 외부 Kafka broker서버 도메인 이름을 지정합니다.</span>
            brokerHostIp <span class="token operator">=</span> <span class="token string">"192.168.0.xxx"</span>  <span class="token comment" spellcheck="true"># 외부 Kafka broker서버 IP을 지정합니다.</span>
          <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
    tensorflow <span class="token punctuation">{</span>  
        <span class="token function">enable</span> <span class="token operator">=</span> <span class="token string">"true"</span>
        python_path <span class="token operator">=</span> <span class="token string">"/anaconda3/envs/tensorflow/bin/python"</span> <span class="token comment" spellcheck="true"># 사용자 PC의 tensorflow python 위치를 지정합니다.</span>
        python_code_project_path <span class="token operator">=</span> <span class="token string">"/analysis"</span>
    <span class="token punctuation">}</span>
    pyspark <span class="token punctuation">{</span>
        python_path <span class="token operator">=</span> <span class="token string">"/anaconda3/bin/python"</span> <span class="token comment" spellcheck="true"># 사용자 PC의 python 위치를 지정합니다.</span>
        python_code_project_path <span class="token operator">=</span> <span class="token string">"/pyML"</span>
    <span class="token punctuation">}</span>
    spark <span class="token punctuation">{</span>
        home <span class="token operator">=</span> <span class="token string">"/spark"</span>  <span class="token comment" spellcheck="true"># 사용자 PC의 spark home 위치를 지정합니다.</span>
        bin <span class="token operator">=</span> <span class="token string">"/spark/bin/spark-submit"</span>
        master <span class="token operator">=</span> <span class="token string">"local[*]"</span> <span class="token comment" spellcheck="true"># spark master 모드를 지정합니다.</span>
        deploy <span class="token operator">=</span> <span class="token string">"client"</span>   <span class="token comment" spellcheck="true"># spark deploy 모드를 지정합니다.</span>
        logging <span class="token operator">=</span> <span class="token string">"true"</span>    
        autoIncreaseModelPath <span class="token operator">=</span> <span class="token string">"true"</span>
    <span class="token punctuation">}</span>
    yarn <span class="token punctuation">{</span>
        home <span class="token operator">=</span> <span class="token string">"/hadoop/bin"</span> <span class="token comment" spellcheck="true"># 사용자 PC의 yarn 위치를 지정합니다.</span>
    <span class="token punctuation">}</span>
    postgres <span class="token punctuation">{</span>
        db <span class="token operator">=</span> <span class="token string">"csledb"</span>
        uri <span class="token operator">=</span> <span class="token string">"jdbc:postgresql://localhost:5432/csledb"</span>
        user <span class="token operator">=</span> <span class="token string">"csle"</span>
        password <span class="token operator">=</span> <span class="token string">"csle1234"</span>
    <span class="token punctuation">}</span>
    hadoop <span class="token punctuation">{</span>
        home <span class="token operator">=</span> <span class="token string">"/hadoop/"</span> <span class="token comment" spellcheck="true"># 사용자 PC의 hadoop 위치를 지정합니다.</span>
        master <span class="token operator">=</span> <span class="token string">"csle1"</span>  <span class="token comment" spellcheck="true"># 사용자 PC의 hadoop master 이름을 지정합니다.</span>
        port <span class="token operator">=</span> <span class="token string">"9000"</span>     <span class="token comment" spellcheck="true"># 사용자 PC의 hadoop master port를 지정합니다.</span>
        hdfs <span class="token punctuation">{</span>
            activated <span class="token operator">=</span> <span class="token string">"true"</span>
            baseDir <span class="token operator">=</span> <span class="token string">"/user/"</span>
            modelPath <span class="token operator">=</span> <span class="token string">"/model"</span>
            datasetPath <span class="token operator">=</span> <span class="token string">"/dataset"</span>
        <span class="token punctuation">}</span>
        webhdfs <span class="token punctuation">{</span>
            port <span class="token operator">=</span> <span class="token string">"50070"</span>
            baseDir <span class="token operator">=</span> <span class="token string">"/webhdfs/v1"</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
    hbase.zookeeper.quorum <span class="token operator">=</span> <span class="token string">"localhost"</span>
    kbe <span class="token punctuation">{</span>
        serverIp <span class="token operator">=</span> <span class="token string">"localhost"</span>
        serverPort <span class="token operator">=</span> <span class="token string">"9876"</span>
        serverType <span class="token operator">=</span> <span class="token string">"jena"</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</pre><h2 class="mume-header" id="bashrc-%EC%84%A4%EC%A0%95-%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0">bashrc 설정 추가하기</h2>

<p>csle 계정의 bashrc 파일을 업데이트 합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token function">cat</span> <span class="token operator">&lt;&lt;</span>EOT <span class="token operator">>></span> ~/.bashrc
    <span class="token function">export</span> JAVA_HOME<span class="token operator">=</span>/usr/lib/jvm/java-8-oracle
    <span class="token function">export</span> PATH<span class="token operator">=</span><span class="token variable">$PATH</span><span class="token keyword">:</span><span class="token variable">$JAVA_HOME</span>/bin
    <span class="token function">export</span> KSB_HOME<span class="token operator">=</span>/home/csle/ksb-csle
    <span class="token function">export</span> PYTHONPATH<span class="token operator">=</span>/home/csle/ksb-csle/pyML/:<span class="token variable">$PYTHONPATH</span>
    <span class="token function">export</span> PYTHONPATH<span class="token operator">=</span>./:/home/csle/ksb-csle/ksblib:<span class="token variable">$PYTHONPATH</span>
EOT
<span class="token function">source</span> ~/.bashrc
</pre><h2 class="mume-header" id="ksb-%EC%9B%B9%ED%88%B4%ED%82%B7%EC%9D%84-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0-%EC%9C%84%ED%95%9C-%EC%82%AC%EC%9A%A9%EC%9E%90-%EA%B3%84%EC%A0%95-%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0">KSB 웹툴킷을 사용하기 위한 사용자 계정 추가하기</h2>

<p>KSB 웹툴킷에 저장된 다양한 예제를 사용하기 위해서는 웹툴킷 사용자(id: <a href="mailto:ksbuser@etri.re.kr">ksbuser@etri.re.kr</a>)에 대한 Ubuntu 및 Hadoop hdfs 계정 추가가 필요합니다.</p>
<h3 class="mume-header" id="ubuntu-%EC%82%AC%EC%9A%A9%EC%9E%90-%EA%B3%84%EC%A0%95-%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0">Ubuntu 사용자 계정 추가하기</h3>

<pre data-role="codeBlock" data-info="sh" class="language-bash">csle<span class="token variable">$myHostName</span><span class="token keyword">:</span>  <span class="token function">sudo</span> adduser ksbuser_etri_re_kr

<span class="token punctuation">[</span>sudo<span class="token punctuation">]</span> password <span class="token keyword">for</span> csle:
<span class="token string">'ksbuser_etri_re_kr'</span> 사용자를 추가 중<span class="token punctuation">..</span>.
새 그룹 <span class="token string">'ksbuser_etri_re_kr'</span> <span class="token punctuation">(</span>1011<span class="token punctuation">)</span> 추가 <span class="token punctuation">..</span>.
새 사용자 <span class="token string">'ksbuser_etri_re_kr'</span> <span class="token punctuation">(</span>1011<span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token punctuation">)</span> 그룹 <span class="token string">'ksbuser_etri_re_kr'</span> <span class="token punctuation">(</span><span class="token punctuation">)</span>로 추가 <span class="token punctuation">..</span>.
<span class="token string">'/home/ksbuser_etri_re_kr'</span> 홈 디렉터리를 생성하는 중<span class="token punctuation">..</span>.
<span class="token string">'/etc/skel'</span>에서 파일들을 복사하는 중<span class="token punctuation">..</span>.

새 UNIX 암호 입력: <span class="token comment" spellcheck="true"># ksbuser_etri_re_kr를 입력하세요</span>
새 UNIX 암호 재입력: <span class="token comment" spellcheck="true"># ksbuser_etri_re_kr를 입력하세요</span>
passwd: 암호를 성공적으로 업데이트했습니다

새로운 값을 넣거나, 기본값을 원하시면 엔터를 치세요
이름 <span class="token punctuation">[</span><span class="token punctuation">]</span>:
방 번호 <span class="token punctuation">[</span><span class="token punctuation">]</span>:
직장 전화번호 <span class="token punctuation">[</span><span class="token punctuation">]</span>:
집 전화번호 <span class="token punctuation">[</span><span class="token punctuation">]</span>:
기타 <span class="token punctuation">[</span><span class="token punctuation">]</span>:
정보가 올바릅니까? <span class="token punctuation">[</span>Y/n<span class="token punctuation">]</span> Y
</pre><h3 class="mume-header" id="sudo-%EA%B6%8C%ED%95%9C-%EB%B6%80%EC%97%AC%ED%95%98%EA%B8%B0">sudo 권한 부여하기</h3>

<pre data-role="codeBlock" data-info="sh" class="language-bash">csle<span class="token variable">$myHostName</span><span class="token keyword">:</span> <span class="token function">sudo</span> <span class="token function">usermod</span> -aG <span class="token function">sudo</span> ksbuser_etri_re_kr
</pre><h3 class="mume-header" id="%EA%B3%84%EC%A0%95-%EC%B6%94%EA%B0%80-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0">계정 추가 확인하기</h3>

<pre data-role="codeBlock" data-info="sh" class="language-bash">csle<span class="token variable">$myHostName</span><span class="token keyword">:</span> <span class="token function">su</span> - ksbuser_etri_re_kr

ksbuser_etri_re_kr<span class="token variable">$myHostName</span><span class="token keyword">:</span> <span class="token function">sudo</span> ll
합계 32
drwxr-xr-x  2 ksbuser_etri_re_kr ksbuser_etri_re_kr 4096  6월 30 08:37 ./
drwxr-xr-x 14 root               root               4096  6월 30 08:36 <span class="token punctuation">..</span>/
-rw-r--r--  1 ksbuser_etri_re_kr ksbuser_etri_re_kr  220  6월 30 08:36 .bash_logout
-rw-r--r--  1 ksbuser_etri_re_kr ksbuser_etri_re_kr 3771  6월 30 08:36 .bashrc
-rw-r--r--  1 ksbuser_etri_re_kr ksbuser_etri_re_kr  655  6월 30 08:36 .profile
-rw-r--r--  1 ksbuser_etri_re_kr ksbuser_etri_re_kr    0  6월 30 08:37 .sudo_as_admin_successful
-rw-r--r--  1 ksbuser_etri_re_kr ksbuser_etri_re_kr 8980  6월 30 08:36 examples.desktop
</pre><h3 class="mume-header" id="hadoop-hdfs-%EC%82%AC%EC%9A%A9%EC%9E%90-%EA%B3%84%EC%A0%95-%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0">Hadoop Hdfs 사용자 계정 추가하기</h3>

<p>사용자 환경에 맞게 설치되어 있는 Hadoop Hdfs를 가동한 후, 아래 명령을 이용하여 hdfs에 ksbuser_etri_re_kr 사용자 폴더를 추가합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash">csle<span class="token variable">$myHostName</span><span class="token keyword">:</span> <span class="token function">su</span> - csle
csle<span class="token variable">$myHostName</span><span class="token keyword">:</span> hdfs dfs -mkdir -p /user/ksbuser_etri_re_kr/dataset
csle<span class="token variable">$myHostName</span><span class="token keyword">:</span> hdfs dfs -mkdir -p /user/ksbuser_etri_re_kr/model

csle<span class="token variable">$myHostName</span><span class="token keyword">:</span> hdfs dfs -chown ksbuser_etri_re_kr:supergroup  /user/ksbuser_etri_re_kr/
csle<span class="token variable">$myHostName</span><span class="token keyword">:</span> hdfs dfs -chown ksbuser_etri_re_kr:supergroup  /user/ksbuser_etri_re_kr/dataset
csle<span class="token variable">$myHostName</span><span class="token keyword">:</span> hdfs dfs -chown ksbuser_etri_re_kr:supergroup  /user/ksbuser_etri_re_kr/model
</pre><h2 class="mume-header" id="ksb-%EC%9B%B9%ED%88%B4%ED%82%B7-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">KSB 웹툴킷 설치하기</h2>

<p><a href="http://csleoss.etri.re.kr:8088/images/contents/manual_1.0/1.4.HowToInstallKsbWebToolkit.html" title="KSB &#xC6F9;&#xD234;&#xD0B7; &#xC124;&#xCE58;&#xD558;&#xAE30;"> KSB 웹툴킷 설치하기</a> 페이지를 통해 KSB 웹툴킷을 설치합니다.</p>
<h2 class="mume-header" id="ksb-%EC%A7%80%EC%8B%9D%EB%B2%A0%EC%9D%B4%EC%8A%A4-%EC%97%94%EC%A7%84-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">KSB 지식베이스 엔진 설치하기</h2>

<p>KSB 지식베이스엔진(KSB-Knowledge Engine)을 사용하기 위한 절차 및 예제를 소개합니다.</p>
<h3 class="mume-header" id="play-framework-activator-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">Play framework Activator 설치하기</h3>

<p>KSB 지식베이스 엔진은 Play framework 기반 엔진이며, 이를 실행하기 위해서는 <a href="https://downloads.typesafe.com/typesafe-activator/1.3.12/typesafe-activator-1.3.12.zip" title="Play framework Activator">Play framework Activator</a>를 사전에 설치해야 합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token comment" spellcheck="true"># Play framework Activator 다운로드</span>
<span class="token function">wget</span> https://downloads.typesafe.com/typesafe-activator/1.3.12/typesafe-activator-1.3.12.zip

<span class="token comment" spellcheck="true"># 압축해제</span>
unzip typesafe-activator-1.3.12.zip

<span class="token comment" spellcheck="true"># Activator bin 경로를 환경변수에 등록</span>
<span class="token function">export</span> PATH<span class="token operator">=</span><span class="token string">"/home/csle/activator-dist-1.3.12/bin:<span class="token variable">$PATH</span>"</span>
</pre><h3 class="mume-header" id="ksb-%EC%A7%80%EC%8B%9D%EB%B2%A0%EC%9D%B4%EC%8A%A4-%EC%97%94%EC%A7%84-%EC%8B%9C%EC%9E%91-%EB%B0%8F-%EC%A2%85%EB%A3%8C-%ED%95%98%EA%B8%B0">KSB 지식베이스 엔진 시작 및 종료 하기</h3>

<p>KSB 지식베이스 엔진을 시작하려면, 해당폴더 (/home/csle/ksb-csle/bin)로 이동하여, startknowledge_service.sh 스크립트를 ip address와 port 번호와 함께 실행합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token comment" spellcheck="true"># KSB 지식베이스 실행 스크립트가 있는 경로로 이동</span>
<span class="token function">cd</span> /home/csle/ksb-csle/bin
<span class="token comment" spellcheck="true"># KSB 지식베이스 엔진 시작 (./startknowledge_service.sh ip_address port_number)</span>
./startknowledge_service.sh 127.0.0.1 9876
</pre><p>KSB 지식베이스 엔진을 종료하려면, 해당폴더 (/home/csle/ksb-csle/bin)로 이동하여, stopKnowledge_service.sh 스크립트를 실행합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token comment" spellcheck="true"># KSB 지식베이스 엔진 종료</span>
./stopKnowledge_service.sh
</pre><h3 class="mume-header" id="%EC%98%A8%ED%86%A8%EB%A1%9C%EC%A7%80-%ED%8C%8C%EC%9D%BC-upload-%ED%95%98%EA%B8%B0">온톨로지 파일 Upload 하기</h3>

<p>KSB 지식베이스 엔진이 Start 되어 있는 상황에서, 사용자가 로컬 파일에 작성된 온톨로지 파일(.owl, .rdf, .rdfs)을 KSB 지식베이스 엔진에 Upload 하는 기능을 설명합니다. 본 예제에서는 KSB 지식베이스 엔진 내부 폴더에 제공하는 공통 온톨로지 파일을 이용합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token comment" spellcheck="true"># 예제 수행 온톨로지 확인을 위해 해당 경로로 이동</span>
<span class="token function">cd</span> /home/csle/ksb-knowledge/KBE/ontologies
</pre><p><img src="./images/1.3_HowToInstallKsbFrameWork_02.png" alt="KSB &#xACF5;&#xD1B5; &#xC628;&#xD1A8;&#xB85C;&#xC9C0;" title="KSB &#xACF5;&#xD1B5; &#xC628;&#xD1A8;&#xB85C;&#xC9C0;"></p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token comment" spellcheck="true"># Curl 명령어 restful request 수행 (url: /loadOntologies, parameter: 온톨로지 경로)</span>
curl -X POST http://127.0.0.1:9876/loadOntologies -H <span class="token string">'Cache-Control: no-cache'</span> -H <span class="token string">'Content-Type: text/plain'</span> -d ./ontologies
</pre><p><img src="./images/1.3_HowToInstallKsbFrameWork_03.png" alt="KSB &#xC9C0;&#xC2DD;&#xBCA0;&#xC774;&#xC2A4; &#xC5D4;&#xC9C4; &#xC628;&#xD1A8;&#xB85C;&#xC9C0; upload &#xD654;&#xBA74;" title="KSB &#xC9C0;&#xC2DD;&#xBCA0;&#xC774;&#xC2A4; &#xC5D4;&#xC9C4; &#xC628;&#xD1A8;&#xB85C;&#xC9C0; upload &#xD654;&#xBA74;"></p>
<p>KSB 지식베이스 엔진에 Upload된 온톨로지는 KSB 지식베이스 엔진이 제공하는  쿼리 Restful API(<code>http://127.0.0.1:9876/query</code>)를 통해 확인할 수 있습니다. 이를 위해 Restful Client(본 예제에서는 Postman)를 실행하고, URL과 질의 쿼리 내용을 아래와 같이 입력하여 실행합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token comment" spellcheck="true"># 본 쿼리는 SPAQRL 1.1의 형태의 질의이며, 이는 온톨로지 thing:Thing 클래스의 서브 클래스를 검색하기 위한 쿼리입니다.</span>
PPREFIX  rdfs: <span class="token operator">&lt;</span>http://www.w3.org/2000/01/rdf-schema<span class="token comment" spellcheck="true">#></span>
PREFIX  owl:  <span class="token operator">&lt;</span>http://www.w3.org/2002/07/owl<span class="token comment" spellcheck="true">#></span>
PREFIX  workflow: <span class="token operator">&lt;</span>http://csle.etri.re.kr/Workflow/<span class="token operator">></span>
PREFIX  thing: <span class="token operator">&lt;</span>http://csle.etri.re.kr/Thing/<span class="token operator">></span>
<span class="token keyword">select</span> * where <span class="token punctuation">{</span>
  ?s  rdfs:subClassOf thing:Thing.
  FILTER <span class="token punctuation">(</span><span class="token operator">!</span>isBlank<span class="token punctuation">(</span>?s<span class="token punctuation">))</span>
<span class="token punctuation">}</span>
</pre><p><img src="./images/1.3_HowToInstallKsbFrameWork_04.png" alt="&#xC628;&#xD1A8;&#xB85C;&#xC9C0; Upload &#xACB0;&#xACFC; &#xD655;&#xC778; &#xD654;&#xBA74;" title="&#xC628;&#xD1A8;&#xB85C;&#xC9C0; Upload &#xACB0;&#xACFC; &#xD559;&#xC778; &#xD654;&#xBA74;"></p>
<h2 class="mume-header" id="ioe-%EC%82%AC%EB%AC%BC-%EB%93%B1%EB%A1%9D">IoE 사물 등록</h2>

<p>KSB 지식베이스 엔진은 IoE 정보를 지식화하여 정보의 연계, 추론을 통한 지식정보를 사용자에게 제공하는 기능이 있습니다. IoE 표준(oneM2M)의 사물 스펙을 지식화하는 기능을 제공합니다.</p>
<p>본 예제에서는 Json 포맷의 사물 스펙을 사용합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token comment" spellcheck="true"># Json 포맷의 사물 스펙(예제로 사용한 IoE 사물의 id는 a1234이며, indoor temperature and humidity 센서입니다.)</span>
<span class="token punctuation">{</span>
      <span class="token string">"version"</span><span class="token keyword">:</span> <span class="token string">"1.0"</span>,
      <span class="token string">"id"</span><span class="token keyword">:</span> <span class="token string">"a1234"</span>,
      <span class="token string">"registrationTime"</span><span class="token keyword">:</span> <span class="token string">"20170102112233"</span>,
      <span class="token string">"properties"</span><span class="token keyword">:</span> <span class="token punctuation">{</span>
        <span class="token string">"name"</span><span class="token keyword">:</span> <span class="token string">"indoor_env_1"</span>,
        <span class="token string">"owner"</span><span class="token keyword">:</span> <span class="token string">"foo@gmail.com"</span>,
        <span class="token string">"description"</span><span class="token keyword">:</span> <span class="token string">"indoor temperature and humidity"</span>,
        <span class="token string">"gid"</span><span class="token keyword">:</span> <span class="token string">"global_unique_id_1"</span>,
        <span class="token string">"model"</span><span class="token keyword">:</span> <span class="token string">"modelA"</span>,
        <span class="token string">"coordinates"</span><span class="token keyword">:</span> <span class="token punctuation">{</span>
          <span class="token string">"latitude"</span><span class="token keyword">:</span> 33.3,
          <span class="token string">"longitude"</span><span class="token keyword">:</span> 122.2,
          <span class="token string">"altitude"</span><span class="token keyword">:</span> 0
        <span class="token punctuation">}</span>,
        <span class="token string">"location"</span><span class="token keyword">:</span> <span class="token string">"seoul korea"</span>,
        <span class="token string">"users"</span><span class="token keyword">:</span> <span class="token punctuation">[</span><span class="token string">"bar@gmail.com"</span><span class="token punctuation">]</span>,
        <span class="token string">"tag"</span><span class="token keyword">:</span> <span class="token punctuation">[</span><span class="token string">"my room"</span>, <span class="token string">"temperature"</span>, <span class="token string">"humidity"</span><span class="token punctuation">]</span>,
        <span class="token string">"madeBy"</span><span class="token keyword">:</span> <span class="token string">"companyA"</span>,
        <span class="token string">"hostedBy"</span><span class="token keyword">:</span> <span class="token string">"companyB"</span>
      <span class="token punctuation">}</span>,
      <span class="token string">"resources"</span><span class="token keyword">:</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
          <span class="token string">"name"</span><span class="token keyword">:</span> <span class="token string">"sensors"</span>,
          <span class="token string">"description"</span><span class="token keyword">:</span> <span class="token string">"temperature and humidity in my room"</span>,
          <span class="token string">"attributes"</span><span class="token keyword">:</span> <span class="token punctuation">[</span>
            <span class="token punctuation">{</span>
              <span class="token string">"name"</span><span class="token keyword">:</span> <span class="token string">"temperature"</span>,
              <span class="token string">"dataType"</span><span class="token keyword">:</span> <span class="token string">"double"</span>,
              <span class="token string">"unit"</span><span class="token keyword">:</span> <span class="token string">"celsius"</span>,
              <span class="token string">"min"</span><span class="token keyword">:</span> <span class="token string">"-80"</span>,
              <span class="token string">"max"</span><span class="token keyword">:</span> <span class="token string">"80"</span>,
              <span class="token string">"description"</span><span class="token keyword">:</span> <span class="token string">"temperature in my room"</span>
            <span class="token punctuation">}</span>,
            <span class="token punctuation">{</span>
              <span class="token string">"name"</span><span class="token keyword">:</span> <span class="token string">"humidity"</span>,
              <span class="token string">"dataType"</span><span class="token keyword">:</span> <span class="token string">"double"</span>,
              <span class="token string">"unit"</span><span class="token keyword">:</span> <span class="token string">"percent"</span>,
              <span class="token string">"min"</span><span class="token keyword">:</span> <span class="token string">"0"</span>,
              <span class="token string">"max"</span><span class="token keyword">:</span> <span class="token string">"100"</span>,
              <span class="token string">"description"</span><span class="token keyword">:</span> <span class="token string">"humidity in my room"</span>
            <span class="token punctuation">}</span>
          <span class="token punctuation">]</span>,
          <span class="token string">"operations"</span><span class="token keyword">:</span> <span class="token punctuation">[</span>
            <span class="token punctuation">{</span>
              <span class="token string">"opType"</span><span class="token keyword">:</span> <span class="token string">"get"</span>,
              <span class="token string">"args"</span><span class="token keyword">:</span> <span class="token punctuation">[</span><span class="token string">"temperature"</span>, <span class="token string">"humidity"</span><span class="token punctuation">]</span>,
              <span class="token string">"description"</span><span class="token keyword">:</span> <span class="token string">"get current temperature and humidity"</span>
            <span class="token punctuation">}</span>
          <span class="token punctuation">]</span>
        <span class="token punctuation">}</span>
      <span class="token punctuation">]</span>
    <span class="token punctuation">}</span>
</pre><p>KSB 지식베이스 엔진이 제공하는  사물등록  Restful API (<code>http://127.0.0.1:9876/registThing</code>)를 통해 KSB 지식베이스 엔진에 사물 스펙정보를 등록 할 수 있습니다.</p>
<p><img src="./images/1.3_HowToInstallKsbFrameWork_05.png" alt="&#xC0AC;&#xBB3C;&#xB4F1;&#xB85D; &#xD654;&#xBA74;" title="&#xC0AC;&#xBB3C;&#xB4F1;&#xB85D; &#xD654;&#xBA74;"></p>
<p>다음과 같은 쿼리 Restful API을 수행하여 결과를 확인합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token comment" spellcheck="true"># 본 쿼리는 SPAQRL 1.1의 형태의 질의이며, 이는 온톨로지 thing:Thing 클래스의 인스턴스를 검색하기 위한 쿼리입니다.</span>
PPREFIX  rdfs: <span class="token operator">&lt;</span>http://www.w3.org/2000/01/rdf-schema<span class="token comment" spellcheck="true">#></span>
PREFIX  owl:  <span class="token operator">&lt;</span>http://www.w3.org/2002/07/owl<span class="token comment" spellcheck="true">#></span>
PREFIX  workflow: <span class="token operator">&lt;</span>http://csle.etri.re.kr/Workflow/<span class="token operator">></span>
PREFIX  thing: <span class="token operator">&lt;</span>http://csle.etri.re.kr/Thing/<span class="token operator">></span>
<span class="token keyword">select</span> * where <span class="token punctuation">{</span>
  ?s rdf:type thing:Thing.
<span class="token punctuation">}</span>
</pre><p><img src="./images/1.3_HowToInstallKsbFrameWork_06.png" alt="&#xC0AC;&#xBB3C;&#xB4F1;&#xB85D;&#xD655;&#xC778;&#xD654;&#xBA74;" title="&#xC0AC;&#xBB3C;&#xB4F1;&#xB85D;&#xD655;&#xC778;&#xD654;&#xBA74;"></p>
<h2 class="mume-header" id="ioe-%EC%82%AC%EB%AC%BC-%EC%84%BC%EC%84%9C%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%A5%BC-%ED%86%B5%ED%95%B4-%EC%A7%80%EC%8B%9D%EC%B6%94%EB%A1%A0%ED%95%98%EA%B8%B0">IoE 사물 센서데이터를 통해 지식추론하기</h2>

<p>KSB 지식베이스 엔진은 IoE 디바이스의 센서데이터를 이용하여, 상황을 추론할 수 있는 기능을 제공합니다.<br>
본 예제의 시나리오는 앞에서 등록된 온도센서(thing id : a1234)로부터 온도가 28도 이상이면 더운 상황(HotContext)을 추론하고,<br>
추론된 정보를 통해 Hue(thing id : S_HUE_light_3)를 파란색으로 켜는 동작을 하는 간단한 시나리오 입니다.</p>
<p>이를 위해 Hue의 제어 명령을 등록합니다. (Restful API: <code>http://127.0.0.1:9876/addDeviceControl</code>)</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token comment" spellcheck="true"># Json 포맷의 사물제어 스펙(id S_HUE_light_3의 Hue)</span>
<span class="token punctuation">[</span>
   <span class="token punctuation">{</span><span class="token string">"id"</span><span class="token keyword">:</span><span class="token string">"hue_turnon_Blue"</span>,
     <span class="token string">"thingId"</span><span class="token keyword">:</span><span class="token string">"S_HUE_light_3"</span>,
     <span class="token string">"resourceId"</span><span class="token keyword">:</span><span class="token string">"controller"</span>,
     <span class="token string">"operationId"</span><span class="token keyword">:</span><span class="token string">"setState"</span>,
     <span class="token string">"controlContents"</span>:<span class="token punctuation">[</span>
        <span class="token punctuation">{</span><span class="token string">"name"</span><span class="token keyword">:</span><span class="token string">"on"</span>,<span class="token string">"value"</span><span class="token keyword">:</span><span class="token string">"true"</span><span class="token punctuation">}</span>,
        <span class="token punctuation">{</span><span class="token string">"name"</span><span class="token keyword">:</span><span class="token string">"bri"</span>,<span class="token string">"value"</span><span class="token keyword">:</span><span class="token string">"254"</span><span class="token punctuation">}</span>,
        <span class="token punctuation">{</span><span class="token string">"name"</span><span class="token keyword">:</span><span class="token string">"hue"</span>,<span class="token string">"value"</span><span class="token keyword">:</span><span class="token string">"46920"</span><span class="token punctuation">}</span>,
        <span class="token punctuation">{</span><span class="token string">"name"</span><span class="token keyword">:</span><span class="token string">"sat"</span>,<span class="token string">"value"</span><span class="token keyword">:</span><span class="token string">"254"</span><span class="token punctuation">}</span>
       <span class="token punctuation">]</span>
   <span class="token punctuation">}</span>,
  <span class="token punctuation">{</span><span class="token string">"id"</span><span class="token keyword">:</span><span class="token string">"hue_turnon_Red"</span>,
   <span class="token string">"thingId"</span><span class="token keyword">:</span><span class="token string">"S_HUE_light_3"</span>,
   <span class="token string">"resourceId"</span><span class="token keyword">:</span><span class="token string">"controller"</span>,
   <span class="token string">"operationId"</span><span class="token keyword">:</span><span class="token string">"setState"</span>,
   <span class="token string">"controlContents"</span>:<span class="token punctuation">[</span>
      <span class="token punctuation">{</span><span class="token string">"name"</span><span class="token keyword">:</span><span class="token string">"on"</span>,<span class="token string">"value"</span><span class="token keyword">:</span><span class="token string">"true"</span><span class="token punctuation">}</span>,
      <span class="token punctuation">{</span><span class="token string">"name"</span><span class="token keyword">:</span><span class="token string">"bri"</span>,<span class="token string">"value"</span><span class="token keyword">:</span><span class="token string">"254"</span><span class="token punctuation">}</span>,
      <span class="token punctuation">{</span><span class="token string">"name"</span><span class="token keyword">:</span><span class="token string">"hue"</span>,<span class="token string">"value"</span><span class="token keyword">:</span><span class="token string">"65535"</span><span class="token punctuation">}</span>,
      <span class="token punctuation">{</span><span class="token string">"name"</span><span class="token keyword">:</span><span class="token string">"sat"</span>,<span class="token string">"value"</span><span class="token keyword">:</span><span class="token string">"254"</span><span class="token punctuation">}</span>
      <span class="token punctuation">]</span>
  <span class="token punctuation">}</span>,
  <span class="token punctuation">{</span><span class="token string">"id"</span><span class="token keyword">:</span><span class="token string">"hue_turnon_Green"</span>,
    <span class="token string">"thingId"</span><span class="token keyword">:</span><span class="token string">"S_HUE_light_3"</span>,
    <span class="token string">"resourceId"</span><span class="token keyword">:</span><span class="token string">"controller"</span>,
    <span class="token string">"operationId"</span><span class="token keyword">:</span><span class="token string">"setState"</span>,
    <span class="token string">"controlContents"</span>:<span class="token punctuation">[</span>
       <span class="token punctuation">{</span><span class="token string">"name"</span><span class="token keyword">:</span><span class="token string">"on"</span>,<span class="token string">"value"</span><span class="token keyword">:</span><span class="token string">"true"</span><span class="token punctuation">}</span>,
       <span class="token punctuation">{</span><span class="token string">"name"</span><span class="token keyword">:</span><span class="token string">"bri"</span>,<span class="token string">"value"</span><span class="token keyword">:</span><span class="token string">"254"</span><span class="token punctuation">}</span>,
       <span class="token punctuation">{</span><span class="token string">"name"</span><span class="token keyword">:</span><span class="token string">"hue"</span>,<span class="token string">"value"</span><span class="token keyword">:</span><span class="token string">"25500"</span><span class="token punctuation">}</span>,
       <span class="token punctuation">{</span><span class="token string">"name"</span><span class="token keyword">:</span><span class="token string">"sat"</span>,<span class="token string">"value"</span><span class="token keyword">:</span><span class="token string">"254"</span><span class="token punctuation">}</span>
      <span class="token punctuation">]</span>
   <span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</pre><p>추론 규칙을 적용하기 위해, KSB-Knowledge/KBE/rules 폴더의 &quot;KBE.rues&quot; 파일을 열고 아래와 같이 추론 규칙을 추가합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token comment" spellcheck="true"># 온도센서의 센싱값이 28이상이면 이벤트 Temp_HOT을 생성합니다.</span>
<span class="token punctuation">[</span>domain_temperature_hot:
 	<span class="token punctuation">(</span>?e event:hasEventValue ?v<span class="token punctuation">)</span>,
 	<span class="token punctuation">(</span>?v thing:hasType ?t<span class="token punctuation">)</span>,
 	<span class="token punctuation">(</span>?t thing:attributeName ?name<span class="token punctuation">)</span>,
 	equal<span class="token punctuation">(</span>?name, <span class="token string">"temperature"</span><span class="token punctuation">)</span>,
 	<span class="token punctuation">(</span>?v thing:hasValue ?value<span class="token punctuation">)</span>,
 	ge<span class="token punctuation">(</span>?value, 28<span class="token punctuation">)</span>
     -<span class="token operator">></span>
    <span class="token punctuation">(</span>?e event:hasEventStatus domain:Temp_HOT<span class="token punctuation">)</span>
 <span class="token punctuation">]</span>
 <span class="token comment" spellcheck="true"># 이벤트 Temp_HOT이면 더운 상황(HotContext)을 생성합니다.</span>
 <span class="token punctuation">[</span>HotContext_context:
    <span class="token punctuation">(</span>?e event:hasEventStatus domain:Temp_HOT<span class="token punctuation">)</span>
    -<span class="token operator">></span> <span class="token punctuation">(</span>?e rdf:type domain:HotContext<span class="token punctuation">)</span>
 <span class="token punctuation">]</span>
 <span class="token comment" spellcheck="true"># 더운 상황(HotContext)이면 Hue를 파란색으로 켭니다.</span>
 <span class="token punctuation">[</span>HotContext_service:
   	<span class="token punctuation">(</span>?e rdf:type domain:HotContext<span class="token punctuation">)</span>
     -<span class="token operator">></span>
    <span class="token punctuation">(</span>?e service:derives domain:hue_turnon_Blue<span class="token punctuation">)</span>
 <span class="token punctuation">]</span>
</pre><p>본 예제를 실행하기 위해 온도센서(thing id: a1234)의 값을 32.6으로 설정하고, Restful API(<code>http://127.0.0.1:9876/recommendDeviceControl</code>)를 실행합니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token comment" spellcheck="true"># 온도센서(thingId : a1234)의 센싱값이 32.6으로 설정합니다.</span>
<span class="token punctuation">{</span>
      <span class="token string">"thingId"</span><span class="token keyword">:</span> <span class="token string">"a1234"</span>,
      <span class="token string">"resourceId"</span><span class="token keyword">:</span> <span class="token string">"sensors"</span>,
      <span class="token string">"time"</span><span class="token keyword">:</span> <span class="token string">"20170330103347"</span>,
      <span class="token string">"values"</span><span class="token keyword">:</span> <span class="token punctuation">[</span>
         <span class="token punctuation">{</span>
            <span class="token string">"name"</span><span class="token keyword">:</span> <span class="token string">"temperature"</span>,
            <span class="token string">"value"</span><span class="token keyword">:</span> <span class="token string">"32.6"</span>
         <span class="token punctuation">}</span>
       <span class="token punctuation">]</span>
    <span class="token punctuation">}</span>
</pre><p>Restful API를 실행한 결과는 다음과 같습니다.</p>
<pre data-role="codeBlock" data-info="sh" class="language-bash"><span class="token comment" spellcheck="true"># 상황(context)가 "HotContext"이고, 상황에 따른 서비스(service)가 "hue_turnon_Blue"이며 그것에 해당하는 사물 제어정보를 리턴합니다.</span>
<span class="token punctuation">[</span>
    <span class="token punctuation">{</span>
        <span class="token string">"thingId"</span><span class="token keyword">:</span> <span class="token string">"S_HUE_light_3"</span>,
        <span class="token string">"resourceId"</span><span class="token keyword">:</span> <span class="token string">"controller"</span>,
        <span class="token string">"context"</span><span class="token keyword">:</span> <span class="token punctuation">[</span>
            <span class="token string">"HotContext"</span>
        <span class="token punctuation">]</span>,
        <span class="token string">"service"</span><span class="token keyword">:</span> <span class="token string">"hue_turnon_Blue"</span>,
        <span class="token string">"controls"</span><span class="token keyword">:</span> <span class="token punctuation">{</span>
            <span class="token string">"sat"</span><span class="token keyword">:</span> <span class="token string">"254"</span>,
            <span class="token string">"hue"</span><span class="token keyword">:</span> <span class="token string">"46920"</span>,
            <span class="token string">"bri"</span><span class="token keyword">:</span> <span class="token string">"254"</span>,
            <span class="token string">"on"</span><span class="token keyword">:</span> <span class="token string">"true"</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">]</span>
</pre><p><img src="./images/1.3_HowToInstallKsbFrameWork_07.png" alt="&#xC0AC;&#xBB3C;&#xCD94;&#xB860; &#xD655;&#xC778;&#xD654;&#xBA74;" title="&#xC0AC;&#xBB3C;&#xCD94;&#xB860; &#xD655;&#xC778;&#xD654;&#xBA74;"></p>

      </div>
      <div class="md-sidebar-toc"><ul>
<li><a href="#ksb-%EC%9D%B8%EA%B3%B5%EC%A7%80%EB%8A%A5-%ED%94%84%EB%A0%88%EC%9E%84%EC%9B%8C%ED%81%AC-%EC%84%A4%EC%B9%98">KSB 인공지능 프레임워크 설치</a>
<ul>
<li><a href="#csle-%EC%82%AC%EC%9A%A9%EC%9E%90-%EA%B3%84%EC%A0%95%EA%B6%8C%ED%95%9C-administrator-%EC%83%9D%EC%84%B1%ED%95%98%EA%B8%B0">csle 사용자 계정(권한 : administrator) 생성하기</a></li>
<li><a href="#java-8-oracle-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">java-8-oracle 설치하기</a></li>
<li><a href="#apache-hadoop-273-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">Apache Hadoop 2.7.3 설치하기</a></li>
<li><a href="#spark-230-bin-hadoop27-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">spark-2.3.0-bin-hadoop2.7 설치하기</a></li>
<li><a href="#hbase-124optional-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">hbase 1.2.4(optional) 설치하기</a></li>
<li><a href="#kafka-211-01001optional-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">kafka 2.11-0.10.0.1(optional) 설치하기</a></li>
<li><a href="#zookeeper-349optional-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">zookeeper 3.4.9(optional) 설치하기</a></li>
<li><a href="#ksb-%ED%94%84%EB%A0%88%EC%9E%84%EC%9B%8C%ED%81%AC-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">KSB 프레임워크 설치하기</a></li>
<li><a href="#ksb-csle-conf-%ED%8C%8C%EC%9D%BC-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0">ksb-csle conf 파일 설정하기</a></li>
<li><a href="#bashrc-%EC%84%A4%EC%A0%95-%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0">bashrc 설정 추가하기</a></li>
<li><a href="#ksb-%EC%9B%B9%ED%88%B4%ED%82%B7%EC%9D%84-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0-%EC%9C%84%ED%95%9C-%EC%82%AC%EC%9A%A9%EC%9E%90-%EA%B3%84%EC%A0%95-%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0">KSB 웹툴킷을 사용하기 위한 사용자 계정 추가하기</a>
<ul>
<li><a href="#ubuntu-%EC%82%AC%EC%9A%A9%EC%9E%90-%EA%B3%84%EC%A0%95-%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0">Ubuntu 사용자 계정 추가하기</a></li>
<li><a href="#sudo-%EA%B6%8C%ED%95%9C-%EB%B6%80%EC%97%AC%ED%95%98%EA%B8%B0">sudo 권한 부여하기</a></li>
<li><a href="#%EA%B3%84%EC%A0%95-%EC%B6%94%EA%B0%80-%ED%99%95%EC%9D%B8%ED%95%98%EA%B8%B0">계정 추가 확인하기</a></li>
<li><a href="#hadoop-hdfs-%EC%82%AC%EC%9A%A9%EC%9E%90-%EA%B3%84%EC%A0%95-%EC%B6%94%EA%B0%80%ED%95%98%EA%B8%B0">Hadoop Hdfs 사용자 계정 추가하기</a></li>
</ul>
</li>
<li><a href="#ksb-%EC%9B%B9%ED%88%B4%ED%82%B7-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">KSB 웹툴킷 설치하기</a></li>
<li><a href="#ksb-%EC%A7%80%EC%8B%9D%EB%B2%A0%EC%9D%B4%EC%8A%A4-%EC%97%94%EC%A7%84-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">KSB 지식베이스 엔진 설치하기</a>
<ul>
<li><a href="#play-framework-activator-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0">Play framework Activator 설치하기</a></li>
<li><a href="#ksb-%EC%A7%80%EC%8B%9D%EB%B2%A0%EC%9D%B4%EC%8A%A4-%EC%97%94%EC%A7%84-%EC%8B%9C%EC%9E%91-%EB%B0%8F-%EC%A2%85%EB%A3%8C-%ED%95%98%EA%B8%B0">KSB 지식베이스 엔진 시작 및 종료 하기</a></li>
<li><a href="#%EC%98%A8%ED%86%A8%EB%A1%9C%EC%A7%80-%ED%8C%8C%EC%9D%BC-upload-%ED%95%98%EA%B8%B0">온톨로지 파일 Upload 하기</a></li>
</ul>
</li>
<li><a href="#ioe-%EC%82%AC%EB%AC%BC-%EB%93%B1%EB%A1%9D">IoE 사물 등록</a></li>
<li><a href="#ioe-%EC%82%AC%EB%AC%BC-%EC%84%BC%EC%84%9C%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%A5%BC-%ED%86%B5%ED%95%B4-%EC%A7%80%EC%8B%9D%EC%B6%94%EB%A1%A0%ED%95%98%EA%B8%B0">IoE 사물 센서데이터를 통해 지식추론하기</a></li>
</ul>
</li>
</ul>
</div>
      <a id="sidebar-toc-btn"></a>
    </body>
    
    
    
    
    
    
    <script>
(function bindTaskListEvent() {
  var taskListItemCheckboxes = document.body.getElementsByClassName('task-list-item-checkbox')
  for (var i = 0; i < taskListItemCheckboxes.length; i++) {
    var checkbox = taskListItemCheckboxes[i]
    var li = checkbox.parentElement
    if (li.tagName !== 'LI') li = li.parentElement
    if (li.tagName === 'LI') {
      li.classList.add('task-list-item')
    }
  }
}())    
</script>
    
<script>
document.body.setAttribute('html-show-sidebar-toc', true)
var sidebarTOCBtn = document.getElementById('sidebar-toc-btn')
sidebarTOCBtn.addEventListener('click', function(event) {
  event.stopPropagation()
  if (document.body.hasAttribute('html-show-sidebar-toc')) {
    document.body.removeAttribute('html-show-sidebar-toc')
  } else {
    document.body.setAttribute('html-show-sidebar-toc', true)
  }
})
</script>
      
  </html>