app.js 파일 중 일부

// ..
app.set('view engine', 'ejs');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.cookieParser());
app.use(express.bodyParser());
// ..

log 파일 중 일부

GET / 200 119ms - 505b

GET /stylesheets/style.css 304 27ms


log를 좀더 자세히 보고 싶은 경우

app.use(express.logger({ format: ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"' }));


format 설정을 위와 같이 넣어 준다.

192.168.0.xx - - [Thu, 01 Aug 2013 01:53:19 GMT] "GET / HTTP/1.1" 200 505 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36"


위와 같이 상세하게 정보를 볼 수 있다.




localhost 에서 접속 시도 하는 경우 발생 하는 에러 이다. socket 설정을 해줘야 한다.


Step 1.  mysql 설정 파일 변경 하기

/etc/my.cnf 파일에 추가 한다.


[client]

port    = 3306

socket  = /var/lib/mysql/mysql.sock


[mysqld]

port    = 3306

socket  = /var/lib/mysql/mysql.sock


Step 2.  mysql 재시작 하기

서버를 재시작 한다.


sudo service mysqld restart

Shutting down MySQL.. SUCCESS! 

Starting MySQL. SUCCESS! 


Step 3.  접속 확인 하기

mysql -u[username] -p[password] [database]

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A


Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.6.12 Source distribution


Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql>


접속을 확인 할 수 있다.



Step 1.  상태 값 확인 하기

사용 방법: sudo ufw status


whitelife@whitelife-srv:~$ sudo ufw status

[sudo] password for whitelife:

Status: active


To                         Action      From

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

22/tcp                     ALLOW       Anywhere

7009/tcp                   ALLOW       Anywhere

80/tcp                     ALLOW       Anywhere

5432/tcp                   ALLOW       Anywhere

10022/tcp                  ALLOW       Anywhere

3306/tcp                   ALLOW       Anywhere

3389/tcp                   ALLOW       Anywhere

22/tcp                     ALLOW       Anywhere (v6)

7009/tcp                   ALLOW       Anywhere (v6)

80/tcp                     ALLOW       Anywhere (v6)

5432/tcp                   ALLOW       Anywhere (v6)

10022/tcp                  ALLOW       Anywhere (v6)

3306/tcp                   ALLOW       Anywhere (v6)

3389/tcp                   ALLOW       Anywhere (v6)


Step 2.  특정 포트 열기

사용 방법: sudo ufw allow [port]/[protocol]


whitelife@whitelife-srv:~$ sudo ufw allow 3389/tcp

Rule added

Rule added (v6)


Step 3.  특정 포트 삭제

사용 방법: sudo ufw delete allow [port]/[protocol]


whitelife@whitelife-srv:~$ sudo ufw delete allow 3389/tcp

Rule deleted

Rule deleted (v6)


Step 4.  특정 포트 닫기

사용 방법: sudo ufw deny [port]/[protocol]


whitelife@whitelife-srv:~$ sudo ufw deny 3389/tcp

Rule updated

Rule updated (v6)


'Linux' 카테고리의 다른 글

gcc 컴파일 시 pcap.h no such file and directory 해결 방법  (0) 2013.11.08
find 명령어 사용하기  (0) 2013.11.07
VirtualBox 폴더 공유 하기  (0) 2013.07.28
CentOS 방화벽 설정 하기  (0) 2013.04.26
Ubuntu 스크린샷 찍기  (0) 2013.04.24


예전에는 Windows에서 개발을 다 했지만, Ubuntu도 많이 이용하고 있다. 양쪽 OS에서 각각 파일이 필요한 경우가 있는데 유연하게 사용하기 위해서는 폴더 공유 기능을 사용하면 된다.


준비.

폴더 공유를 하기 위해서는 게스트 확장 설치가 선행 되어야 한다.


Step 1.  공유 폴더 설정 하기

사용하고 있는 가상 머신의 설정 메뉴로 이동 한다. 폴더 추가 아이콘을 클릭 하여 설정 한다.



Step 2.  가상 머신 설정 하기 

사용 방법: sudo mount -t vboxsf [공유 폴더 이름][가상 머신 마운트 폴더]



min@min-ubuntu:/mnt$ sudo mount -t vboxsf min /mnt/share



마운트가 완료 되면 공유 파일을 볼 수 있다.




'Linux' 카테고리의 다른 글

find 명령어 사용하기  (0) 2013.11.07
Ubuntu 방화벽 설정 하기  (0) 2013.07.28
CentOS 방화벽 설정 하기  (0) 2013.04.26
Ubuntu 스크린샷 찍기  (0) 2013.04.24
Ubuntu gnome3 theme 적용하기  (0) 2013.04.23


Step 1.  Database 확인 하기


SELECT datname FROM pg_database;


Step 2.  Table name 확인 하기


SELECT table_name FROM information_schema.tables WHERE table_schema = 'schema name';


Step 3.  Column name 확인 하기


SELECT column_name FROM information_schema.columns WHERE table_name = 'table name';


Query 로 정보 확인이 가능 합니다.





하드를 살때가 됬는데~ 여기 가격도 저렴하고 좋네요.

링크: http://www.icoda.co.kr/


'IT' 카테고리의 다른 글

개발자에 대한 고찰  (0) 2017.05.02
Windows 7 최대 절전 모드 해제 하기  (0) 2014.10.20
Windows 8, 8.1 에서 파티션 설정 하기  (0) 2014.10.11
IT 전문가를 공포에 떨게 하는 한마디  (0) 2013.11.08
야근은 스포츠...  (0) 2013.03.14


npm 저장소에 있는 pg library 를 설치 할 경우 아래 경고 메시지가 적용이 된다.


WARNING!!

pg.connect(function(err, client) { ...}) is deprecated and will be removed it v1.0.0 (very soon)

instead, use pg.connect(function(err, client, done) { ... })

automatic releasing of clients back to the pool was a mistake and will be removed

please see the following for more details:

https://github.com/brianc/node-postgres/wiki/pg

https://github.com/brianc/node-postgres/issues/227

https://github.com/brianc/node-postgres/pull/274

feel free to get in touch via github if you have questions


- Connect

기존 방식

pg.connect(function(err, client) { ...});


위의 형태로 connection을 생성 한다면 connection pool에 반환이 되지 않으므로 pool error 가 발생 한다.

connection 자원을 받을 수 없으므로 db와의 통신 불능 상태가 된다.


해결 방법


Result 1.  connect 방식 변경

pg.connect(function(err, client, done) { 

  // ...

  done();

});


done을 call 함으로서 connection pool 에 자원을 반환 한다.


Result 2.  version 0.14.1 이용

0.14.1 을 이용하면 기존 방식으로도 통신이 가능 하다.




개발을 하다보면 Http 요청을 해서 테스트 해야할 경우가 생긴다.

매번 테스트 페이지를 생성 하기는 번거로울 수 있으니 그걸 편하게 해주는 기능이 있다.


크롬 확장프로그램 Advanced Rest Client 를 설치해 보자.

Chrome 는 설치 되어 있다고 가정 한다.


Step 1.  확장 프로그램 설치 하기

설정 -> 확장 프로그램 -> 더 많은 확장프로그램 다운로드 

advance rest client로 검색 한 후 설치 한다.



Step 2.  확장 프로그램 실행 하기

설치가 완료된 후 새 탭 열기를 해보자 실행 하자.



Step 3.  사용해 보기

실행 하게 되면 Http method 정의, form 타입 정의 등 파일 업로드도 가능하다. 테스트를 해보자.



위 기능들을 사용 한다면 좀더 편한 환경에서 개발이 가능할 것이다.



+ Recent posts