StoryCode

'전체 글'에 해당되는 글 570건

  1. 설치 ( Windows )
  2. Elastic Search 란
  3. 연습) Hello, World.

설치 ( Windows )

Database 관리/Mongo DB
반응형

다운로드 후 설치시, Windows 7 에서는 진행이 안되는 경우가 발생할 수 있다.

Compas 문제인데, Windows 8 부터 지원한다.

이 경우에는 아래지시를 따른다.


1. Run the installer with a double-click.

2. Click next.

3. Accept the License Agreement

4. Select the Complete installation type and click Instal

5. Uncheck the Install Compass option (by default this checked and Compass requires the Microsoft .NET Framework version 4.5 or later

6. With in a minute time installation will get complete and you can see the exe files under C:\Program Files\MongoDB\Server\3.6\bin

 

[ 참조 ] https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/

반응형

'Database 관리 > Mongo DB' 카테고리의 다른 글

MongoDB vs MySQL CRUD 비교  (0) 2019.04.21
성능 최적화 전략  (0) 2019.04.21
기초사용법  (0) 2019.04.18
용어  (0) 2019.04.16

Elastic Search 란

Elastic Search
반응형

- 실시간 분산 검색엔진 서버

- 오픈 소스

- 아파치 Lucene 기반

- JSON 기반 비정형 데이타 분산 검색과 분석 지원

- 설치, 확장이 용이

- 실시간 검색 서비스 지원, 분산 및 병령 처리, 멀티태넌시 기능 지원

- 아마존 웹 서비스의 클라우드 서비스와 빅 데이터 처리를 위한 하듭 연동 지원

 

고가용성

 

Elasticsearch 는 동작중에 죽은 노드를 감지하고 삭제하며 사용자의 데이터가 안전하고 접근가능하도록 유지하기 때문에, 동작 중에 일부 노드에 문제가 생기더라도 문제없이 서비스를 제공합니다.

 

 멀티 테넌시

 

클러스터는 여러개의 인덱스들을 저장하고 관리할 수 있으며, 독립된 하나의 쿼리 혹은 그룹 쿼리로 여러 인덱스의 데이터를 검색할 수 있습니다.

 

 전문 검색(Full text search)

 

Elastic search는 강력한 full text search를 지원합니다.

 

 문서 중심(Document oriented)

 

복잡한 현실세계의 요소들을 구조화된 JSON 문서 형식으로 저장합니다. 모든 필드는 기본적으로 인덱싱되며, 모든 인덱스들은 단일 쿼리로 빠르게 사용할 수 있습니다.

 

 Schema free

 

JSON 문서 구조를 통해 데이터를 인덱싱하고 검색가능하게 합니다. (NoSQL과 같은 스키마가 개념이 없음) 그리고 사용자의 데이터가 어떻게 인덱싱 될 것인가에 대한 것은 사용자가 커스터마이징 할 수 있습니다.

 

 플러그인 형태 구현

 

검색엔진을 직접 수행하지 않고 필요한 기능에 대한 플러그인을 적용하여 기능을 확장할 수 있습니다. 예를 들어 외부에서 제공하는 형태소 분석기나 REST API를 구현하여 적용할 수 있습니다.

 

[ 참조 ]

반응형

연습) Hello, World.

Node.js
반응형

1. HTTP Methods(HTTP-Verbs) - GET, POST, PUT, PATCH, DELETE

HTTP Methods ( = HTTP Verbs)의 종류 : GET, POST, PUT, PATCH, DELETE

참고) resource 의 종류 : html, binary(image, sound), db (db, json, xml, flat)

 

GET : 조회

POST : 등록

PUT : 수정(없을시 등록). 한 컬럼만 업데이트시에도 모든 컬럼 업데이트.

PATCH : 수정. 한 컬럼만 업데이트시 한 컬럼만 업데이트.

DELETE : 삭제

 

2. Express로 서버 실행하기 (GIT : https://github.com/a-mean-blogger/hello-world/tree/eaa13c5356ebaa06bd14df80bee96edb085fac46)

 

$ git clone https://github.com/a-mean-blogger/hello-world.git
$ cd hello-world
$ git reset --hard eaa13c5
$ npm install
$ atom .

 

위 git clone 없이 직접 해보기

$ git init

$ npm init

$ touch index.js

$ npm install --save express

$ atom . ( 혹은 vi index.js )

   index.js 에 아래 내용 입력

   -----------------------------------------

var express = require('express')
var app = express();

app.get('/', function (req, res) // '/' 로 get 요청시
{
  res.send('Hello World!');
})

app.listen(3000, function()
{
  console.log('Server On!');
})

   -----------------------------------------

$ node index.js

   Server On!

그리고, Chrome> localhost:3000 으로 접속하면, Hello World! 가 보인다.


3. Static 폴더 추가하기

index.js 를 아래내용으로 변경

// index.js

var express = require('express');
var app = express();

 

// __dirname = 현재 실행 위치

// app.use : 브라우저에서, / 으로 접속하면 /public/ 에 변경접속, /css 으로 접속하면 /public/css 으로 변경접속

// css 나 html 같은 고정 파일 위치에 사용한다. 아래 "4. EJS로 Dynamic Website" 에서 <link> 태그에 public 이 없어도 public 을 참조하게 된다.
app.use(express.static(__dirname + '/public')); 

app.listen(3000, function(){
 console.log('Server On!');
});

 

 

$ node index.js #재실행

   Server On!

그리고, Chrome> localhost:3000 으로 접속하면, 주황색 Hello World! 가 보인다.

 


4. EJS로 Dynamic Website 만들기

* 용어.EJS) EJS는 Embedded Javascript의 약자로 Express에서 dynamic website를 만들기 위해 template으로 사용되는 파일(확장자 이름은 .ejs)입니다.

 

$ npm install --save ejs # ejs 설치

 

> views 폴더와 views/hello.ejs 파일 추가

 

> index.js 내용 변경 -----------------------------------------

// index.js

var express = require('express');
var app = express();

app.set("view engine","ejs"); // ejs를 사용하기 위해서 express의 view engine에 ejs를 set하는 코드입니다.

 

// 이 라인을 없으면, 앞 views 옵션은 기본으로 views 폴더(뒤)를 가르키지면, 명시적으로 적어주자.

// 뒤의 views 는 사용자 마음대로 바꿀 수 있다.

// views 는 res.render 에서 사용된다.

app.set("views", "views"); 


app.use(express.static(__dirname + '/public'));

// 2
app.get("/hello", function(req,res){ //  http://localhost:3030/hello 호출시
 res.render("hello", {name:req.query.nameQuery}); // render 에는 hello.ejs의 파일명부분과  파라미터를 넘겨준다.
}); 

// 3
app.get("/hello/:nameParam", function(req,res){  //  http://localhost:3030/hello/이름 호출시
 res.render("hello", {name:req.params.nameParam});  // render 에는 hello.ejs의 파일명부분과  파라미터를 넘겨준다.
});

app.listen(3000, function(){
console.log('Server On!');
});

 

 

> views/hello.ejs 에는 아래 내용 추가

2

<!-- views/hello.ejs -->

<!DOCTYPE html>
<html>
 <head>
  <meta charset="utf-8">
  <title>Hello World!</title>
  <link rel="stylesheet" href="/css/master.css">
 </head>
 <body>
  <h1>Hello
   <% if(name){ %>
    <span class="name"><%= name %>!</span>
   <% } else { %>
    <span class="stranger">Stranger!</span>
   <% } %>
  </h1>
 </body>
</html>

 

> http://localhost:3000/hello 와 localhost:3000/hello/superman 으로 접속테스트 해보자.

 

[참조] https://www.a-mean-blog.com/ko/blog/Node-JS-%EC%B2%AB%EA%B1%B8%EC%9D%8C/Hello-World/HTTP-Methods-HTTP-Verbs-GET-POST-PUT-PATCH-DELETE

 

반응형

'Node.js' 카테고리의 다른 글

각종 설치 참조  (0) 2019.04.17
Atom 설치  (0) 2019.04.17
설치 (Windows)  (0) 2019.04.16
내장 모듈  (0) 2018.10.31
Process 객체, exports 객체  (0) 2018.10.31