sudo npm install pm2@latest -g ; pm2 update


'nodejs' 카테고리의 다른 글

디버그 with development  (0) 2018.06.19
pm2.json 파일 실행  (0) 2018.04.19
pm2 로그보기  (0) 2018.02.26
pm2  (0) 2018.02.22
우분투 node 설치  (0) 2017.11.17
  • 포트변경
$ vim /etc/apache2/ports.conf


$ service apache2 restart


경로변경


apache2에서 기본문서 경로는 /var/www/html 이다.

  이 폴더를 변경하고 싶으면 /etc/apache2/sites-available/000-default.conf 파일에서 경로 수정



sudo pm2 monit


sudo pm2 show 0


tail -f /home/coupon/.pm2/logs/app-out-0.log



'nodejs' 카테고리의 다른 글

pm2.json 파일 실행  (0) 2018.04.19
pm2 node.js 버전 업데이트  (0) 2018.03.26
pm2  (0) 2018.02.22
우분투 node 설치  (0) 2017.11.17
KILL PID  (0) 2017.11.15

pm2 start app.js --name "test"

pm2 list

pm2 show <name>

pm2 restart <name>

pm2 logs <name>

pm2 plush

pm2 reload <name>

pm2 monit


클러스터 실행

pm2 start app.js -i 0 --name "test"

'nodejs' 카테고리의 다른 글

pm2 node.js 버전 업데이트  (0) 2018.03.26
pm2 로그보기  (0) 2018.02.26
우분투 node 설치  (0) 2017.11.17
KILL PID  (0) 2017.11.15
node 죽이기  (0) 2017.10.03

[brew install mysql로 설치했을경우]

$ sudo rm -rf /usr/local/var/mysql
$ sudo rm -rf /usr/local/bin/mysql*
$ sudo rm -rf /usr/local/Cellar/mysql

[mysql 홈페이지에서 DMG파일로 설치했을 경우]

$ sudo rm -rf /usr/local/mysql*
$ sudo rm -rf /Library/PreferencePanes/My*
$ sudo rm -rf /var/db/receipts/com.mysql.*


'mysql' 카테고리의 다른 글

blocked because of many connection errors  (0) 2018.06.12
그룹내 시퀀스 생성  (0) 2017.03.09

1. Instance 생성

2. Elastic IP 지정

3. Image 생성

4. Image 로부터 Inatance 생성 (AMI > Launch > Instanc Type 을 기존 Instance 보다 고사양으로 늘린다.)

5. 2에서 생성한 Instance 의 Elastic IP 를 4에서 생성한 Elastic IP 로 세팅 

- Elastic IPs > Associate Address 붙인다. 이때 1의 Instance 에 2의 Elastic IP 가 지정되어 있기 때문에 2에 지정한 Elastic IP 를 헤제한후 (Disassociate Address) 4에서 생성한 Instance 에 할당한다. (Associate Address)


=====================================================================================================

- Instance 를 이미지화 하고 이미지화 한 Instance 를 다시켜서 더 좋은 Instance Type 으로 바꾸면 Scale Up 이 된다.

- Instance 를 재시작하면 Instacne 의 IP 가 달라진다.

- Elastic IP 를 할당받으면 고정IP 로 지정가능 (유료)

- IP 하나를 할당받은후 인스턴스와 연결하면 무료

- IP 하나를 할당받은후 가지고만 있으면 한달에 3,600 원 과금

- IP 여러개를 할당받은후 한개의 Instance 에 여러개의 IP 를 할당하면 IP 하나당 과금


'AWS' 카테고리의 다른 글

부하발생 명령어  (2) 2018.08.02
aws 시간 변경  (0) 2017.12.13
AWS S3 파일 업로드  (0) 2017.12.12
아파치 설치  (0) 2017.12.11
ELB 테스트  (0) 2017.12.08

http://ora-sysdba.tistory.com/entry/Cloud-Computing-Amazon-EC2-%EC%9D%B8%EC%8A%A4%ED%84%B4%EC%8A%A4%EC%9D%98-TIMEZONE-%EB%B3%80%EA%B2%BD

'AWS' 카테고리의 다른 글

부하발생 명령어  (2) 2018.08.02
Scale Up  (0) 2017.12.15
AWS S3 파일 업로드  (0) 2017.12.12
아파치 설치  (0) 2017.12.11
ELB 테스트  (0) 2017.12.08

sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 3000 -j REDIRECT --to-port 80

라고 실행을 하고 나서 nodemon *****.js를  실행하고 나서 

접속할때는 dns 주소, 혹은 http://*********/  로 붙으면 된다.

'Linux' 카테고리의 다른 글

crontab 추가  (0) 2018.05.13
iwinV 포트 경로  (0) 2018.03.28
계정 변환  (0) 2017.11.15
history 검색  (0) 2017.03.28
vim  (0) 2017.03.23

1.  윈도 : C:\Users\사용자\.aws\credentials

리눅스 : ~/.aws/credentials


2.  credentials 파일수정


[default]

aws_access_key_id = <aws_access_key_id>

aws_secret_access_key = <aws_secret_access_key>

'AWS' 카테고리의 다른 글

Scale Up  (0) 2017.12.15
aws 시간 변경  (0) 2017.12.13
아파치 설치  (0) 2017.12.11
ELB 테스트  (0) 2017.12.08
부하 발생기 테스트  (0) 2017.12.08

sudo apt-get install apache2

sudo apt-get update;

'AWS' 카테고리의 다른 글

Scale Up  (0) 2017.12.15
aws 시간 변경  (0) 2017.12.13
AWS S3 파일 업로드  (0) 2017.12.12
ELB 테스트  (0) 2017.12.08
부하 발생기 테스트  (0) 2017.12.08

Load Balancers 테스트


1. 웹서버를 만든다

2. 1에서 만든 웹서버로 이미지를 만든다.

3. 2에서 Instance 웹서버를 생성한다.

4. 1, 3 에서 만든 웹서버를 Elb 에 추가한다.


1, 3번 서버 터미널에서 명령어 실행

sudo tail -f /var/log/apache2/access.log


'AWS' 카테고리의 다른 글

Scale Up  (0) 2017.12.15
aws 시간 변경  (0) 2017.12.13
AWS S3 파일 업로드  (0) 2017.12.12
아파치 설치  (0) 2017.12.11
부하 발생기 테스트  (0) 2017.12.08

1.aws 에 서버 2대 설치 (defense, attack)

1-1. defense (Instance 생성시 AWS Marketplace 에서 workpress 조회후 WordPress powered by Bitnami(HVM) 선택 )

1-2. attack (Instance 생성시 ubuntu SSH 만 필요함)


2. [defense] ssh 로그인

sudo apt-get update;

CPU 점유율확인 명령어 실행 : top


3. [attack] ssh 로그인

1. sudo apt-get update;

2. sudo apt-get install apache2-utils 

3. ab -n 400 -c 1 http://XXX.XXX.XXX.XXX/      (-n : 몇번 접속할건지여부, -c : 동시접속자수)

-n 이 1 이고 -c 가 100 이면 한번 접속하고 다시 한번 접속한다.

-n 이 10 이고 -c 가 100 이면 동시접속자수가 10 이다.


4. 결과값 작성

 요청

동시접속 

총 소요시간 

(Time taken for tests)

 실패

(Failed requests)

초당처리속도 

(Requests per second)

개별처리속도(초) 

(Time per request)

 400

 1

 

 

 400

 2 

 

 

 

 

 400

10 

 

 

 

 

 40020     
 40050     

 400

100     
 400200     


5. (웹서버)

sudo apt-get install apache2 


6. (웹서버)

php 설치 

sudo apt-get install php5


7. (웹서버)

php 파일 생성

cd /var/www/html

sudo nano index.php

<?php

for($i=0;$i<100000000;$i+){


}

?>


ctrl + O 저장 (WriteOut)

8. (부하발생기)

ab -n 100 -c 1 http://XX.XXX.XXX.XXX/index.php (100번의 request, 동시접속 1)


9. (웹서버)

top

10 (부하발생기)

ab -n 1000 -c 10 http://XX.XXX.XXX.XXX/index.php (1000번의 request, 동시접속 10)



'AWS' 카테고리의 다른 글

Scale Up  (0) 2017.12.15
aws 시간 변경  (0) 2017.12.13
AWS S3 파일 업로드  (0) 2017.12.12
아파치 설치  (0) 2017.12.11
ELB 테스트  (0) 2017.12.08
JSON.stringify(
                                {
                                    'result' :
                                    {
                                        code : 'success',
                                        message : "OK",
                                        headers : headers,
                                        items : items
                                    }
                                }
                            ,null,4)


'javascript' 카테고리의 다른 글

더미 데이타 만들기  (0) 2017.09.13
tableToExcel  (0) 2017.08.18
promise  (0) 2017.03.12
json data roop  (0) 2012.02.29
DOM  (0) 2012.02.17
1. nvm 설치

  • curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash


2. nvm install v8.9.1

3. nvm use v8.9.1




'nodejs' 카테고리의 다른 글

pm2 로그보기  (0) 2018.02.26
pm2  (0) 2018.02.22
KILL PID  (0) 2017.11.15
node 죽이기  (0) 2017.10.03
ejs  (0) 2017.09.28

윈도우에서 


pm2 start start.js


taskkill /f /pid 13076

'nodejs' 카테고리의 다른 글

pm2  (0) 2018.02.22
우분투 node 설치  (0) 2017.11.17
node 죽이기  (0) 2017.10.03
ejs  (0) 2017.09.28
async  (0) 2017.09.20

일반계정 => root 계정


su sudo


root 계정 => 사용자계정


su - bitnami

'Linux' 카테고리의 다른 글

iwinV 포트 경로  (0) 2018.03.28
포트 변경  (0) 2017.12.12
history 검색  (0) 2017.03.28
vim  (0) 2017.03.23
grep  (0) 2017.03.22


git config credential.helper store

또는

git config --global credential.helper store

'git' 카테고리의 다른 글

merge tool  (0) 2018.08.08
branch  (0) 2018.08.07
실행순서  (0) 2018.08.07
git config 계정설정  (0) 2017.11.06
repository not found  (0) 2017.11.06
$ git config --global user.name "sonagisw"
$ git config --global user.email tnsdnjs@gmail.com

프로젝트 마다 다른 Email을 사용하고 싶으면 --global 옵션을 제거하면 된다.



'git' 카테고리의 다른 글

merge tool  (0) 2018.08.08
branch  (0) 2018.08.07
실행순서  (0) 2018.08.07
git password 저장  (0) 2017.11.06
repository not found  (0) 2017.11.06

git credential-manager uninstall


git credential-manager install

'git' 카테고리의 다른 글

merge tool  (0) 2018.08.08
branch  (0) 2018.08.07
실행순서  (0) 2018.08.07
git password 저장  (0) 2017.11.06
git config 계정설정  (0) 2017.11.06

윈도 : taskkill /F /IM node.exe


리눅스 : killall node


맥 :  sudo killall node



'nodejs' 카테고리의 다른 글

우분투 node 설치  (0) 2017.11.17
KILL PID  (0) 2017.11.15
ejs  (0) 2017.09.28
async  (0) 2017.09.20
미들웨어  (0) 2017.09.14

var fs = require('fs');


fs.readFile('ejsPage.ejs', 'utf-8', function(error, data){

response.writeHead(200, {'Content-Type': 'text-html'});

response.end(ejs.render(data));

});

'nodejs' 카테고리의 다른 글

KILL PID  (0) 2017.11.15
node 죽이기  (0) 2017.10.03
async  (0) 2017.09.20
미들웨어  (0) 2017.09.14
npm start  (0) 2017.09.13

var async = require('async');


var files = ['Txt1.txt', 'Txt2.txt','Txt3.txt'];


async.forEach(files, function(item, index){

console.log(item);

});


async.map(files, fs.readFile, function(error , results){

console.log(results);

});


//순차실행

async.series([

function (callback){

console.log("11111111");

callback(null, 1);

},
function(callback){

console.log("22222222");

callback(null, 2);

}

], function(error, result){

console.log("333333", result);

});



//동시실행

async.parallel([

function (callback){

console.log("11111111");

callback(null, 1);

},
function(callback){

console.log("22222222");

callback(null, 2);

}

], function(error, result){

console.log("333333", result);

});


460 P 참고



'nodejs' 카테고리의 다른 글

node 죽이기  (0) 2017.10.03
ejs  (0) 2017.09.28
미들웨어  (0) 2017.09.14
npm start  (0) 2017.09.13
nvm 설치  (0) 2017.09.12

클라이언트에서 요청시 로그를 남기는 간단한 기능을 함수로 만든후 use() 메서드를 사용해 미들웨어로 등록해 두면 모든 클라이언트 요청이 이 미들웨어를 거치면서 로그를 남기게 된다. 


각각의 미들웨어는 next() 메서드를 호출하여 다음 미들웨어가 처리할수 있도록 순서를 넘길수 있다.

'nodejs' 카테고리의 다른 글

ejs  (0) 2017.09.28
async  (0) 2017.09.20
npm start  (0) 2017.09.13
nvm 설치  (0) 2017.09.12
express  (0) 2017.05.26

package.json 파일의 start 속성에 적힌 명령이 실행

'nodejs' 카테고리의 다른 글

async  (0) 2017.09.20
미들웨어  (0) 2017.09.14
nvm 설치  (0) 2017.09.12
express  (0) 2017.05.26
DummyDB  (0) 2017.05.26

var DummyDB = (function(){

var DummyDB = {};

var storage = [];

var count = 1;


DummyDB.get = function(id){

if(id){

id = (typeof id == 'string') ? Number(id):id;


for(var i in storage) if (storage[i].id == id){

return storage[i];

}

}

else{

return storage;

}

};


DummyDB.insert = function(data){

data.id = count++;

storage.push(data);

return data;

};


DummyDB.remove = function(id){

//변수 가공

id = (typeof id == 'string') ? Number(id) : id;


for(var i in storage) if (storage[i].id == id){

storage.splice(i, 1);


return true;

}


return false;

};


return DummyDB;

})();

'javascript' 카테고리의 다른 글

json stringify  (0) 2017.11.18
tableToExcel  (0) 2017.08.18
promise  (0) 2017.03.12
json data roop  (0) 2012.02.29
DOM  (0) 2012.02.17

1. nvm windows 설치


2. nvm install 버전 (node 설치)


3.nvm use 버전



'nodejs' 카테고리의 다른 글

미들웨어  (0) 2017.09.14
npm start  (0) 2017.09.13
express  (0) 2017.05.26
DummyDB  (0) 2017.05.26
nodemon  (0) 2017.02.27

.progress4 {

        position: relative;

        width: 100px;

        height: 100px;

    }

    

    .progress4:hover:after {

        background: #333;

        background: rgba(0,0,0,.8);

        border-radius: 5px;

        bottom: 26px;

        color: #fff;

        content: attr(data-tooltip);

        left: 20%;

        padding: 5px 15px;

        position: absolute;

        z-index: 98;

        width: 300px;

        white-space: pre-line;

        text-align:left;

        keep-all: break-all;

        margin-left: -250px; 

    }

    

    .progress4:hover:before {

        border: solid;

        border-color: #333 transparent;

        border-width: 6px 6px 0 6px;

        bottom: 20px;

        content: "";

        left: 50%;

        position: absolute;

        z-index: 99;

    }




<span style="color:#ffffff" data-html="true" class="progress3" 

data-tooltip="정상:

국가 전력수급 현황

- 500만KW 이상 ~ 50000만KW 이하

빌딩내 전력수급 현황

- 500KW 이상 ~ 50000KW 이하">정상</span>

                 var tmpVar = {};

                angular.copy($scope.query, tmpVar);

                tmpVar.energyGroupId = obj.energyGroupId;

'angular' 카테고리의 다른 글

Daterange picker  (0) 2017.06.30
sample  (0) 2017.06.28
visual studio code angular intellisense  (0) 2017.06.25
Json 바인딩  (0) 2017.03.01
ngModel 과 양방향 바인딩  (0) 2017.02.25

<if test='energyGroupList != null and energyGroupList != ""'>

AND X.M_ENERGY_GROUP_ID IN <foreach item="item" index="index" collection="energyGroupList" open="(" separator="," close=")">#{item}</foreach> 

</if>

function tableToExcel(table, fileName, sheet){

 var uri = 'data:application/vnd.ms-excel;base64,'

   , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--><meta http-equiv="content-type" content="text/plain; charset=UTF-8"/></head><body><table border=1>{table}</table></body></html>'

   , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }

   , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }

   

var ctx = {worksheet: sheet || 'Worksheet', table: $("#" + table).html()}

  var link = document.createElement("a");

  link.download = fileName + ".xls";

  link.href = uri + base64(format(template, ctx));

  link.click();

}

'javascript' 카테고리의 다른 글

json stringify  (0) 2017.11.18
더미 데이타 만들기  (0) 2017.09.13
promise  (0) 2017.03.12
json data roop  (0) 2012.02.29
DOM  (0) 2012.02.17

+ Recent posts