1. Node.js 설치


1-1. 빌드된 패키지로 설치(apt-get 패키지)

#!/bin/sh

# install node.js v6.x -------------------------------------
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
echo

read -p "Press [Enter] key to next step..." key
echo

# check node.js version ------------------------------------
node -v
npm -v
npm list -g -depth 0
echo

read -p "Press [Enter] key to next step..." key
echo

# update npms ----------------------------------------------
sudo npm update -g
echo
 

1-2. edge 패키지를 사용하기 위하여 소스로 빌드하여 설치

#!/bin/sh

# install node.js ------------------------------------------
sudo apt-get -y install python

wget https://raw.githubusercontent.com/tjanczuk/edge/master/tools/debian_ubuntu_clean_install.sh

mv debian_ubuntu_clean_install.sh debian_ubuntu_clean_install.sh.orig
sed -e "s/4.2.3/6.1.0/g" debian_ubuntu_clean_install.sh.orig > debian_ubuntu_clean_install.sh
rm debian_ubuntu_clean_install.sh.orig

export USERNAME=$USER
sudo bash debian_ubuntu_clean_install.sh
echo

read -p "Press [Enter] key to next step..." key
echo

# update npms ----------------------------------------------
sudo npm update -g
echo
 


2. MongoDB 설치

#!/bin/sh

# install mongodb ------------------------------------------
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
echo

read -p "Press [Enter] key to next step..." key
echo

# setting mongodb ------------------------------------------
wget https://github.com/mongodb/mongo/raw/master/debian/mongod.service

sudo mv mongod.service /lib/systemd/system
sudo chmod g-w /lib/systemd/system/mongod.service
sudo chown root:root /lib/systemd/system/mongod.service

# service enable -------------------------------------------
sudo systemctl enable mongod
echo

read -p "Press [Enter] key to next step..." key
echo

sudo vi /etc/mongod.conf
echo
 

2-1. MongoDB 설정 파일

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
  directoryPerDB: true

# network interfaces
net:
  port: 27017
  http:
    enabled: true
    RESTInterfaceEnabled: true

# security
security:
  authorization: enabled


3. 다운로드

shell_scripts.zip


Posted by jungtae17
,

새로운 DB로 백업 DB를 전체 복구하는 방법


1. 새로운 DB 설치를 위하여 MongoDB 서버를 실행한다. (DB 생성, 인증 생략)

mongod.exe ^
  --port 27017 ^
  --dbpath "{새로운 DB 경로}" ^
  --directoryperdb ^
  --noauth ^
  --rest

2. 백업된 DB를 복구한다. (전체 복구)

mongorestore.exe ^
  /port 27017 ^
  /drop ^
  "{백업 DB 경로}"

3. 재시작을 위하여 MongoDB 서버를 종료한다.


4. 운영을 위한 MongoDB 서버를 실행한다. (인증 포함)

mongod.exe ^

  --port 27017 ^

  --dbpath "{새로운 DB 경로}" ^

  --directoryperdb ^

  --auth ^

  --rest



Posted by jungtae17
,

ES2015 에 대하여

JavaScript 2016. 3. 3. 16:01

JavaScript 의 새로운 표준으로 ES2015 가 뜨고 있다. 그래서 웹에서 ES2015 에 대하여 검색해봤더니 아래와 같은 정보를 찾을 수 있었다.


JavaScript 표준안http://www.ecma-international.org/ecma-262/6.0/


ES2015 바뀐 내용https://babeljs.io/docs/learn-es2015/


Node.js 에서 지원하는 최신 JavaScript 기능https://nodejs.org/en/docs/es6/



'JavaScript' 카테고리의 다른 글

Promise 사용법  (0) 2015.12.21
if문에서 Array.prototype.indexOf() 응용하기  (0) 2015.11.23
Function 객체의 Methods 소개  (0) 2015.11.23
C#에서 JSON 변환하기  (0) 2015.11.19
비교 연산자(&&,||)를 이용한 변수 할당  (0) 2015.11.19
Posted by jungtae17
,