참고 : http://blog.naver.com/PostView.nhn?blogId=omg92&logNo=60137609376

ERwin 재설치(Event Log Watch 서비스 또 기동 안되는 현상 -> ERwin 기동 안됨)
 
1. 프로그램 추가삭제에서 ERwin을 제거 한다.

 

2. CA_LIC 폴더까지 제거한다. (lic98_uninstaller.zip 활용)
  A. C:\\Program Files\\CA\\SharedComponents\\CA_LIC 폴더에 lic98_unintaller.zip파일을 압축 해제 한다.
  B. rmlicense.bat 파일을 실행한다.
  C. CA_LIC 폴더가 삭제 된다.

 

3. Registry에서 Event Log Watch로 검색 하여 값을 삭제 한다.

 

4. Vista인 경우 제어판 -> 사용자계정 -> 사용자 계정 컨트롤 사용 안 함으로 체크 한다.

 

5. Erwin을 재설치 한다.

 

6. 만약 서비스에 Event Log Watch의 서비스 실행 속성이 수동으로 되어 있으면 자동으로 수정한다.

 

7. 시리얼 키 등록이 안된다면 Registry에서 해당 시리얼 키로 검색하여 값을 삭제 한다.



출처 : http://www.jnetwork.co.kr/bbs/board.php?bo_table=useguide&wr_id=138

find 명령어로 일정기간, 특정용량 파일 삭제 및 찾기 

*  일정기간 지난 파일 삭제 명령 - 7일 지난 파일 삭제 예 
find [디렉토리] -ctime +7 -exec rm -f {} \;

* 특정용량 이상되는 파일 찾기 - 10MB 이상 되는 파일 찾기 예
find [디렉토리] -size +1000k -exec ls -al {} \;

*  생산된지 30일 이상 된 파일만 삭제
find [디렉토리] -type f -ctime +30 -exec rm -rf {} \;

*  생산된지 30일 이상 된 비어있는 디렉토리만 삭제
find [디렉토리] -empty -type d -ctime +30 -exec rmdir {} \;
※ 리눅스 버전에 따라 -ctime 이 먹지 않는 경우가 있다. 이때는 -mtime 으로 대체한다 (의미는 다르지만....)

*  현재 디렉토리( . ) 이하에 확장자가 .html ( -name "*.html" ) 인 파일만 ( -type -f ) 
find . -name "*.html" -type f -ls
* 현재 디렉토리 이하에서 확장자가 .php 인 파일만 삭제하기
find . -name '*.php' -exec rm -f {} \;

* 파일크기가 300KB 이상 ( -size +300k ) 인 파일만 (호스팅 되는 홈피내에 큰 사이트의 파일이 있는지 찾을 때 유용)
find . -size +300k -ls

* 파일크기가 500bytes 이하 ( -size -500c )인 파일만
find . -size -500c -ls

* 수정한지 20일 이상 ( -mtime +20 ) 된 파일과 디렉토리
find . -mtime +20 -ls

* 수정한지 20일 이상된 파일만
find . -mtime +20 -type f -ls

* 수정한지 20일 이상된 파일만 삭제 ( -exec rm {} \; ) ( 정기적으로 20일지 지난 파일을 삭제할 때 유용 )
find . -mtime +20 -type f -ls -exec rm {} \;

* 수정한지 3일 이내 ( -mtime -3 ) 의 파일만 ( 백업할 때 유용 )
find . -mtime -3 -type f -ls

* 수정한지 30분 이내 ( -mmin -30 ) 의 파일만
find . -mmin -30 -type -f -ls


출처 : http://faq.hostway.co.kr/?mid=Linux_ETC&page=9&document_srl=1423

관리자가 없어 자주 확인을 하지 않는 서버들의 경우는 홈페이지가 열리지 않는 경우 
하드웨어 장애가 아닐 경우에 상당수 많은 부분을 차지 하는 것이 파티션 사이즈가 100% 가 되면서 문제가 발생되곤 합니다.

이 경우 근본적인 해결책은 로그를 logrotate와 같은 형태로 분할 진행할 수 있겠지만, 
급한대로 로그를 비워야할 때 어떻게 해야 할지 모르는 경우가 있다.

 

1. Log file은 apache, mysql, 등 어플리케이션 설정내에서 경로가 지정되어 있기 때문에, 삭제 하

    게 되면 오류가 발생 하게 됩니다.
   아래와 같이 /usr 혹은 /var 파티션이 100%가 되는 경우가 상당 수 발생.

   [root@hostway /]# df -Th
   Filesystem    Type    Size  Used Avail Use% Mounted on
   /dev/sda1     ext3    1.9G  826M  963M  47% /
   /dev/sda6     ext3    950M   19M  884M   3% /tmp
   /dev/sda3     ext3    4.6G  485M  3.9G  11% /var
   /dev/sda2     ext3    9.2G  9.2G  0G  100% /usr
   /dev/sda7     ext3     92G   64G   24G  74% /home
   /dev/sda8     ext3    118G   93G   20G  83% /data

2. 이 경우 어떤 파일 혹은 디렉토리가 큰 용량을 차지하고 있는지 확인이 필요 합니다.

 

   방법 1) du 명령을 통해 용량이 큰 디렉토리 및 파일 확인


   [root@hostway ~]# cd /usr


   [root@hostway usr]# du -sh *
   578M    lib
   55M     libexec
   7.2G    local
   16K     lost+found
   
   [root@hostway usr]# cd local

   [root@hostway local]# du -sh *


  위와 같은 형태로 찾아 찾아 들어가는 형태로 파일이 커진 파일을 확인 할 수 있습니다.


   방법 2) find를 이용해 /usr 디렉토리 밑에 200M 이상 파일들 찾는 방법 예시
 
   [root@hostway usr]# find /usr -size +200000 -print

   위 방법들로 파일 사이즈가 큰 것들을 찾을 수 있습니다.

 

3. 보통 문제가 되는 파일들은 /usr/local/apache2/logs/~~  경로와 같이 웹 로그 파일들이 쌓이는

   부분에서 문제가 발생 합니다.
   예를 들어 /usr/local/apache2/logs/access.log 파일의 크기가 3.5G나 되는 경우 로그를 여는데도

   상당 수 시간이 소요되며, 서버의 부하가 발생 합니다.
   이 경우 로그가 꼭 필요하다면, 여유가 있는 다른 파티션으로 이동 후 비워주는 작업을 해주셔야

   합니다.

   아래 명령을 수행 하게 되면 null (0) 값으로 access.log를 채우게 되면서 결과적으로는 사이즈가 
   0이 되어지고 파일은 남아있습니다.

   [root@hostway usr]# cat /dev/null > /usr/local/apache2/logs/access.log   

   /usr 파티션에는 아래와 같이 3.5G 여유공간이 생깁니다.


   [root@hostway /]# df -Th
   Filesystem    Type    Size  Used Avail Use% Mounted on
   /dev/sda1     ext3    1.9G  826M  963M  47% /
   /dev/sda6     ext3    950M   19M  884M   3% /tmp
   /dev/sda3     ext3    4.6G  485M  3.9G  11% /var
   /dev/sda2     ext3    9.2G  5.7G  3.5G  70% /usr
   /dev/sda7     ext3     92G   64G   24G  74% /home
   /dev/sda8     ext3    118G   93G   20G  83% /data

 

   위와 같은 원인이 발생하는 이유는 공간부족으로 인해 데몬이 구동하기 위해 필요한 pid 파일이

   생성되지 못하기 때문입니다.


  - Mysql의 bin log 같은 경우엔 주의가 필요로 합니다.
    제일 마지막 번호의 log 인 즉 데몬이 쿼리를 쌓고 있는 파일은 비우시면 안됩니다.


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

2>/dev/null 의미란??

출처 : http://shakii.tistory.com/94

오늘 해커스쿨 운동장(?)에서 놀다 보니 2>/dev/null 관련된 문제가 있었다

   

일단 문제는 역시 내 수준하고는..... 너무 어려워 ㅜㅜ

   

암튼 그래서 먼저 풀어 보신분들의 해답(?)등을 참고 하다보니 위에 같은 명령어가 나오길래...

   

/dev/null 알겠는데...

   

1>/dev/null

2>/dev/null

   

은 처음 보는거라 생소 했다.. 그래서 네이버에게 물어보니 이러한 답변이...

   

A.

   

B.

   

C.

   

일단 A와 B은 같은 의미

   

그럼 B와 C의 차이는 뭐냐

   

1의 의미는 STDOUT(standard output)

2의 의미는 STRERR(standard error)

   

STDOUT은 표준출력으로, 정상적인 메시지를 출력하고

STDERR은 표준에러로, 에러메시지를 출력하는것이다

   

다시 말해

B는 표준출력을 /dev/null로 redirection하고 (정상적인 메시지를 null로)

C는 표준에러를 /dev/null로 redirection 한다 (에러메시지를 null로)

   

정상적인 메시지는 안보인다

   

위와 다르게 Permission denied인 에러메시지들은 안보인다

   

   

표준출력, 표준에러 그리고 표준입력도 있는데 이것을 리눅에서는 "파일"이라고 부른다.

   

   



PS: /dev/null 자체를 모르시는 분도 계실듯..

나는 이것을 쉽게 생각해서 "블랙홀"이라고 배웠다

이파일에 쓰는 모든것은 영원히 사라진다는것으로 아무것도 아닌(null) 장치파일이라고 볼수 있다(?)

어떠한 작업의 출력되는 내용을 보고 싶지 않을때, 이곳으로 그 출력을 보내버리면,

아무것도 보여지지 않게 되는것이다. 이럴때 아주 유용하게 쓰이게 된다

파일을 지울때는 rm 명령어로 지우면 되겠지만 텍스트로 이루어진 로그파일이라도

그 로그파일이 시스템에서 사용중일수 있다 그러면 삭제하는것은 위험 하기 때문에

그럴때

"/dev/null > 로그파일.log"

위와 같이 해주면 로그파일의 속(?)을 비워주게 되는것이다.



출처 : http://jyates.github.io/2012/11/05/rolling-java-gc-logs.html


If you are running a java process, you probably want to keep track of what the garbage collector is doing. You can access this via jconsole or by logging the gc actions by adding:

-Xloggc:gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps

which logs to the ‘gc.log’ file.

And for simple cases, that will probably work just fine…until your process starts running row more than a few days. The GC log is not rolled automatically, potentially resulting in a log that can easily grow out of control and fill up your filesystem.

Bad news bears!

What you really want to do roll the logs periodically. You could do this manually with a cron job (which means you might missing some elements), or every time you restart the process (but if you don’t restart often, you’re up a creek) or send the log to your own custom logger (which is can be tricky to get right).

All pretty ugly solutions. I sure wish we had something better…

As of Oracle Java 1.6_34 (or 1.7_2 in the latest minor version), we do! GC logs can be automatically rolled at a certain size and retain only a certain number of logs.

To turn on simple log rolling, you only need to add (in addition neccessay gc log arguments mentioned above) to your java command line options:

-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=<number of files> -XX:GCLogFileSize=<size>

where <number of files> is just an integer and <size> is the size of the file (e.g 16K is 16 kilobytes, 128M is 128 megabytes, etc.). Rolled files are appened with .<number>, where earlier numbered files are the older files.

Suppose you ran an java program with the parameters:

$ java -Xloggc:gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=128K

you might see something like the following show up in your directory:

-rw-r--r--   1 jyates  staff    90K Nov  5 18:25:39 2012 gc.log.0
-rw-r--r--   1 jyates  staff   128K Nov  5 18:25:25 2012 gc.log.1
-rw-r--r--   1 jyates  staff   128K Nov  5 18:25:29 2012 gc.log.2
-rw-r--r--   1 jyates  staff   128K Nov  5 18:25:33 2012 gc.log.3
-rw-r--r--   1 jyates  staff   128K Nov  5 18:25:36 2012 gc.log.4

What’s really nice note here is that GC logs beyond the specified number areautomatically deleted, ensuring that you know exactly (+/- a few kilobytes for the occasional heavy load) how many log files you will have.

Pretty cool!

Unfortunately, if you attempt to turn on log rolling and forget to include the number of files or the size, the jvm will not turn on logging and instead tell you:

To enable GC log rotation, use -Xloggc:<filename> -XX:+UseGCLogRotaion -XX:NumberOfGCLogFiles=<num_of_files> -XX:GCLogFileSize=<num_of_size>
where num_of_file > 0 and num_of_size > 0
GC log rotation is turned off

this is wrong!

Double check your other parameters, and try again; you definitely want to use -XX:+UseGCLogFileRotation.

Hopefully this helps you setup your own log rolling. If you have any other JVM/GC tricks, I’d love to hear about them.

Notes:

  1. This is actually a best effort rolling process. If you are doing a lot GC work (e.g. leaning on the ‘garbage collect’ button in jconsole), the log may grow larger. However, as soon as the jvm has a chance it will then roll the log.


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


출처 : https://confluence.atlassian.com/display/CONFKB/Enable+Garbage+Collection+Logging

Enable Garbage Collection Logging

Why Garbage Colllection Logging?

Garbage Collection logs are useful when trying to isolate issues within Java based applications as they will pinpoint blocked, hung or stuck threads that may be causing downstream effects in the application. It is always useful to collect at least 10 minutes of garbage collection logs, but analysis accuracy is often increased by the amount of recent log data to review.

For Linux

Add the following parameters into your Confluence System Properties, in setenv.sh (be sure to enter the path for your <confluence-home> directory)

-Xloggc:<confluence-home>/logs/`date +%F_%H-%M-%S`-gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:-PrintTenuringDistribution -XX:+PrintGCCause
-XX:+PrintGCApplicationStoppedTime -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M

The parameter -XX:+PrintGCCause was introduced within Java 1.7.0_45 and will not work if you are using a version of Java prior to that version. Please check the version of Java that is being used by your instance of Confluence prior to using this flag.

For Windows

Batch file

 

If you start Confluence using 'start-confluence.bat', add the below code to setenv.bat

 

rem Create a timestamp with date and time, replacing ' ' with '0' and '/' with '-'
set atlassian_timestamp=%DATE:~-4%.%DATE:~4,2%.%DATE:~7,2%_%TIME:~0,2%.%TIME:~3,2%.%TIME:~6,2%
set atlassian_timestamp=%atlassian_timestamp: =0%
set atlassian_timestamp=%atlassian_timestamp:/=-%
set atlassian_logsdir=%~dp0..\logs
 
set CATALINA_OPTS=%CATALINA_OPTS% -Xloggc:"%atlassian_logsdir%\gc-%atlassian_timestamp%.log"
set CATALINA_OPTS=%CATALINA_OPTS% -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M -XX:+PrintGCCause
set CATALINA_OPTS=%CATALINA_OPTS% -XX:+PrintGCApplicationStoppedTime -XX:-PrintGCDetails -XX:+PrintGCTimeStamps -XX:-PrintTenuringDistribution

NB: This will create the GC logs in the <confluence-install> directory.

Service

If you start Windows as a service, add the below to the service by following these steps (be sure to enter the path for your <confluence-home> directory)

-Xloggc:<confluence-home>/logs/gc.log
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+PrintGCCause
-XX:+PrintGCApplicationStoppedTime
-XX:-PrintTenuringDistribution
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=5
-XX:GCLogFileSize=2M

NB: There is no way to include the DATE and TIME variables in the filename when starting as a Windows Service. This means the gc.log file will be overwritten on each startup. If you need to analyse the file, be sure to copy it before restarting the service.




출처 : http://luckyyowu.tistory.com/122


리눅스에 JDK와 Tomcat을 설치해 JSP 서비스가 가능하도록 만들어 보겠습니다. 이번학기 수강하는 '객체지향 패러다임' 수업에서는 Windows에서 Tomcat Server를 구동해서 실습하지만 저는 리눅스를 좋아하니깐? 리눅스에 설치하겠습니다. (죄송합니다 교수님) 운영체제는 CentOS Linux 6.5 배포판이며 JDK와 Tomcat의 버전은 2014. 04. 10 기준 최신버전인 JDK 1.8.0, Tomcat 8.0.5를 설치하겠습니다.




JDK 다운로드 & 설치


이번 포스팅에서는 우선 JDK만 설치하며, Tomcat은 JDK의 설치 후 진행됩니다. 계정은 기본적으로 슈퍼유저의 권한을 가진 root 계정으로 진행하며 우선 jdk와 tomcat의 설치파일을 다운받을 디렉토리를 생성합니다.


# cd /usr/local/src

# mkdir tomcat


JavaSE JDK 설치파일 홈페이지(오라클)

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html


먼저 JDK부터 설치하도록 합시다. 오라클 홈페이지에서 JDK 설치 파일을 다운 받습니다. rpm 확장자를 가진 패키지 설치 파일과 tar.gz 확장자를 가진 압축파일 두가지가 제공됩니다. 저는 압축파일로 설치할 것이므로 tar.gz 파일을 선택합니다. 또한 CentOS 6.5 리눅스 32비트 버전이므로 jdk-8-linux-i586.tar.gz 파일을 받겠습니다. 64비트 버전이라면 해당 버전에 맞는 파일을 받으시면 됩니다.


다운받는 방법은 wget, ftp 등 여러가지가 있겠지만 저는 윈도우에서 다운받은 후 rz 명령어로 리눅스로 옮겼습니다. 설치파일이 tar, gz으로 압축되어 있으니 풀어줍시다.


# gunzip jdk-8-linux-i586.tar.gz

# tar -xvf jdk-8-linux-i586.tar


압축을 풀면 jdk1.8.0 디렉토리가 생성됩니다.


생성된 jdk1.8.0 디렉토리를 /usr/local 디렉토리로 이동시킵시다. 그리고 심볼릭 링크 파일을 만들어줍니다. 심볼릭 링크를 만드는 이유는 여러가지가 있겠지만 나중에 JDK 버전이 업데이트 됬을 시 환경 설정을 변경하지 않고 심볼릭 링크의 내용만 수정해 주면 된답니다. 


# mv jdk1.8.0 /usr/local

# cd /usr/local

# ln -s jdk1.8.0 java


/usr/local 디렉토리로 jdk1.8.0 디렉토리가 이동했고 java란 심볼릭 링크가 생성된걸 확인해줍시다.


이제 명령어를 사용하기 /etc/profile의 내용을 수정합시다. vim 에디터를 열어 상단에 다음 내용을 추가합니다. (vi 사용법은.. 음... 파이팅)


# vi /etc/profile


JAVA_HOME=/usr/local/java

CLASSPATH=.:$JAVA_HOME/lib/tools.jar

PATH=$PATH:$JAVA_HOME/bin

export JAVA_HOME CLASSPATH PATH


리눅스에 기본적으로 설정된 java 명령어 위치의 인식을 피하기 위해 /usr/bin 디렉토리의 java 파일 이름을 바꿔줍시다. 그 후 source 명령어를 사용해 /etc/profile의 내용을 현제 쉘에 적용시킵니다. 그리고 java, javac 명령어로 버전을 확인해서 설치된 버전이 출력되면 제대로 설치 된겁니다.


# mv /usr/bin/java /usr/bin/java-old

# source /etc/profile

# java -version

# javac -version


JDK를 설치하는 이유는 JSP 서비스를 구동해주는 톰캣에서 JDK를 사용해 클래스를 컴파일하기 때문입니다. 다음 포스팅에서는 리눅스에 Tomcat를 설치해 JSP 서비스를 구동해 보도록 하겠습니다.

참고 : http://webdir.tistory.com/120


시간을 동기화하는 방법으로 NTP 와 rdate 를 이용하는 방법을 사용합니다. 소수점까지 정확한 단위의 동기화가 필요하다면 원자단위의 NTP 를 이용해야 합니다.

NTP 시간 동기화

NTP(Network Time Protocol)는 인터넷상의 시간을 정확하게 유지시켜 주기 위한 통신망 시간 규약이다. 라디오나 원자시계에 맞추어 시간을 조정하며 밀리초 1/1000초 단위까지 시간을 맞출 수 있다.

기본적으로, NTP 방식은 straum이라는 계층구조를 가지는데 straum 0 은 GPS나 세슘 원자 시계등 시간을 구하는 장비를 말하며, straum 1은 GPS 나 세슘 원자 시계등에서 직접 시간을 동기화하는 서버를 의미한다. strum 2 부터는 트리 구조를 형성하게 된다. 보통 straum 2에서 동기화를 하고, 이 동기화를 받은 straum 3 서버에서 나머지 같이 운영하는 서버들을 peer로 해서 동기화를 시키므로써 straum 1 서버들의 부하를 줄인다.

NTP 는 UDP 123을 기본 포트로 사용(포트 개방 필요)한다.

우리나라에서 운영되고 있는 NTP 서버

  • kr.pool.ntp.org
  • time.bora.net
  • time.nuri.net

NTP 설치

CentOS 6.4 Minimal 버전에는 NTP 가 설치되어 있지 않다. yum 을 이용해서 설치하자.

yum install ntp

  ================================================================================
   Package        Arch          Version                         Repository   Size
  ================================================================================
  Installing:
    ntp          x86_64        4.2.4p8-3.el6.centos              base        444 k

  Installing for dependencies:
    libedit      x86_64        2.11-4.20080712cvs.1.el6          base         74 k
    ntpdate      x86_64        4.2.4p8-3.el6.centos              base         58 k

  Transaction Summary
  ================================================================================
  Install       3 Package(s)

NTP 설정

peer 설정이다. 즉, 시간 동기화를 받기 위한 설정내용이다. 기본적으로 입력되어있는 server 0.centos.pool.ntp.org등을 주석처리하거나 삭제하고 국내 NTP 서버로 대체한다.

vi /etc/ntp.conf

  # Use public servers from the pool.ntp.org project.
  # Please consider joining the pool (http://www.pool.ntp.org/join.html).
  #server 0.centos.pool.ntp.org
  #server 1.centos.pool.ntp.org
  #server 2.centos.pool.ntp.org
  server kr.pool.ntp.org
  server time.bora.net
  server time.kornet.net

NTP 서비스를 시작프로그램에 등록한다.

chkconfig ntpd on

NTP 서비스 등록 확인

chkconfig --list | grep ntpd

  ntpd            0:해제  1:해제  2:활성  3:활성  4:활성  5:활성  6:해제

NTP 서비스를 시작한다.

/etc/init.d/ntpd start

  ntpd (을)를 시작 중:                                       [  OK  ]

NTP 는 동기화하기까지 5~10분의 시간이 걸리니 여유를 갖도록 하자.

ntpq -p

      remote           refid      st t when poll reach   delay   offset  jitter
  ==============================================================================
  *121.182.147.191 .GPS.            1 u   24   64  377    9.611    9.432   4.998
  +time.bora.net   90.1.14.51       2 u    1   64  177    7.049   -4.907  12.329
  +ntp1.sjtel.net  192.168.18.6     2 u    4   64  377    9.096   10.322   5.248
  • * : 현재 sync 를 받고 있음을 의미
  • + : ntp 알고리즘에 의해 접속은 가능하지만 sync 를 하고 있지는 않음을 의미
  • - : ntp 알고리즘에 의해 접속은 가능하지만 sync 가능 리스트에서 제외
  • blank : 접속이 불가능함을 의미

remote는 sync 를 하는 straum 2 서버주소를 가리키며, refid는 각 straum 2 서버가 현재 sync 를 하고 있는 straum 1 서버를 보여준다. st가 16일 경우 해당 서버에 접속 할 수 없음을 의미한다.

NTP 서버 설정

단순히 시간 동기화가 목적이 아니라 자체 동기화 서버를 구축하려는 경우 아래의 설정이 도움이 될지도 모르겠다.

vi /etc/ntp/ntp.conf 

  restrict default nomodify notrap noquery 
  restrict 127.0.0.1 
  restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap 

  # straum 2 server list 
  server ntp.ewha.net 
  server ntp1.epidc.co.kr 
  server time.bora.net 
  server time.wonkwang.ac.kr 
  server time.korserve.net 
  server noc6-3.koren21.net 

   driftfile /var/lib/ntp/drift 
   broadcastdelay 0.008 
   keys /etc/ntp/keys 
  • /etc/ntp.conf와 driftfile 과 keys의 경우 배포본마다 위치가 다를 수 있으니 확인을 하도록 한다.
  • restric 설정은 peer 들이 본 서버로 sync 하는 것에 대한 제한을 한다.
  • restrict default nomodify notrap noquery 설정은 기본으로 모든 권한을 주지 않음을 의미한다.
  • restrict 127.0.0.1 설정은 127.0.0.1 즉, 서버 자신에서는 모든 권한을 가진다.
  • restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap 설정은 192.168.0.0 ~ 192.168.0.255 c class 에서는 질의를 할 수 있는 권한을 가진다. 즉, 위의 2 라인은 항상 기본으로 들어가는 설정이며, peer 를 거느릴 서버에서는 (즉 A 의 입장에서는) 하위 peer 들의 질의를 받을수 있도록 3 번째 라인과 같이 restrict 설정을 해 주어야 한다.

설정을 마쳤다면, service ntpd restart 명령으로 ntpd 데몬을 시작하고, ntpq 명령을 이용하여 sync 를 잘 하고 있는지 확인을 한다.

출처 : http://mansoo.tistory.com/entry/Eclipse-Referenced-file-contains-errors-%EB%B0%9C%EC%83%9D-%EC%8B%9C


소스 내에는 에러가 없는데 error 나 markers 창에


Referenced file contains errors (
http://tuckey.org/res/dtds/urlrewrite2.6.dtd).  
For more information, right click on the message in the Problems View and select "Show Details..." urlrewrite.xml ......

등과 같은 에러가 발생하는 경우가 있다. 무시하면 아무 문제없지만 난 빨간 X 표시를 그냥 넘어갈 수 있는 성격이 아니라서......

이런 경우에는 

Window > Preferences > General > Network Connections > Cache 에서 해당 url(위 빨간색 부분) 을 지워주면 해결된다.



참고 : https://developer.mozilla.org/ko/docs/Web/Guide/CSS/Using_CSS_transitions


* 예제

transition:border-color .4s,box-shadow .4s,background .4s,color .4s,opacity .4s 


출처 : http://slipp.net/questions/123

오늘 애플리케이션 개발할 때 retry는 어떤 식으로 구현하고 있나? (http://www.slipp.net/questions/122)에에) 대한 질문을 올렸다. 이 질문을 올린 후에 곰곰히 생각해 봤다. 지금까지 애플리케이션을 구현하면서 retry를 구현하는 경우가 많지 않았는데 유독 slipp.net 소스에 retry 구현이 많지 않은가? 분명 어딘가 문제가 있다는 생각이 들었다.

그 래서 retry를 이렇게 많이 사용하게된 원인을 파악해 봤다. 그랬더니 페이스북으로 글을 전송할 때 가끔씩 정상적으로 동작하지 않아 문제를 해결하려다보니 retry를 무분별하게 사용하게 되었다는 것이 떠올랐다. 그렇다면 왜 페이스북으로 글을 전송할 때 문제가 발생했을까? 원인을 찾아보니 페이스북 전송에 문제가 있었던 것이 아니라 Async로 처리하는 부분에서 데이터베이스에 저장된 데이터가 정상적으로 조회되지 않는다는 것이 가장 이슈였다. 원인은 다음 상황에서 발생하고 있었다.

@Transactional
public class QnaService {
    public Question createQuestion(SocialUser loginUser, QuestionDto questionDto) {
        [...]


        if (questionDto.isConnected()) {
             facebookService.sendToQuestionMessage(loginUser, savedQuestion.getQuestionId());
        }
        return savedQuestion;
    }
}

위 소스 코드와 같이 글을 쓰는 시점에 페이스북으로 전송 상태이면 facebookService.sendToQuestionMessage()를 호출해 페이스북으로 글을 전송한다. facebookService.sendToQuestionMessage() 내부를 살펴보면 다음과 같다.

@Service
@Transactional
public class FacebookService {
    @Async
    public void sendToQuestionMessage(SocialUser loginUser, Long questionId) {
        Question question = questionRepository.findOne(questionId);
        if (question == null) {
            question = retryFindQuestion(questionId);
        }


        [...]
    }


}

위 소스 코드를 보면 알 수 있듯이 sendToQuestionMessage()는 Async로 동작하도록 구현하고 있다. 이 때 문제가 발생하는 부분은 questionRepository.findOne(questionId)를 호출할 때 Question 데이터가 null이 되는 경우가 가끔 발생한다는 것이 문제의 원인이었다. 이 문제에 대한 해결책으로 retry를 선택한 것이다. 하지만 위와 같이 retry를 하더라도 문제는 완전히 해결되지 않았다. 왜 이와 같은 현상이 발생하는지 살펴보자.

먼저 위와 같이 구현할 경우의 데이터 처리 상태를 파악해 보자.

QnaService.createQuestion()에서 Transaction이 시작된다.

데이터베이스에 Question 데이터를 저장한다. 하지만 아직까지 commit이 완료되지 않았기 때문에 데이터베이스에 완전히 저장된 것은 아니다.

facebookService.sendToQuestionMessage() 메소드를 호출해 페이스북에 메시지를 전송한다.

QnaService.createQuestion() 메소드가 종료되면서 commit을 한다.

위 과정에서 문제의 원인이 된 부분은 4번 과정이 완료되지 않은 상태에서 3번 과정이 먼저 실행되면서 4번에서 commit 후에 저장해야 될 Question 데이터를 조회하기 때문에 조회할 수 없는 상황이 발생한 것이다. 3번과 4번의 실행 순서가 어떻게 되느냐에 따라 기능이 정상 동작하거나 동작하지 않는 상황이 발생한 것이다.

이에 대한 문제를 인지하고 자료를 찾아보니 몇 일 전에 올라온 따끈따끈한 자료가 있어 참고해서 문제를 해결할 수 있었다.

http://architects.dzone.com/articles/synchronizing-transactions : 이틀 전에 올라온 글이다. ㅋㅋ

이 글을 참고해서 다음과 같이 코드를 수정했다.

public class QnaService {
    public Question createQuestion(final SocialUser loginUser, QuestionDto questionDto){
        Set<Tag> tags = tagService.processTags(questionDto.getPlainTags());


        Question newQuestion = new Question(loginUser, questionDto.getTitle(), questionDto.getContents(), tags);
        final Question savedQuestion = questionRepository.saveAndFlush(newQuestion);


        if (questionDto.isConnected()) {
            TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
                public void afterCommit() {
                    facebookService.sendToQuestionMessage(loginUser, savedQuestion.getQuestionId());
                }
            });
        }
        return savedQuestion;
    }
}

위 소스 코드와 같이 TransactionSynchronizationManager.registerSynchronization()를 활용해 구현해 봤다. 아직까지 모든 문제가 완료된 것인지는 확인하지 못했다. 당분간 운영해 보면 문제가 정상적으로 해결되었는지 확인해 볼 수 있을 듯하다. 이 이슈를 경험하면서 Async 기능을 구현할 때는 고려해야할 부분이 많다는 것을 다시 한번 느꼈다. 한 가지 기능에 대해 여러 개의 Thread가 동작하는 경우 Transaction이 어떻게 동작하는지 정확하게 이해하고 사용할 필요가 있을 것으로 생각한다.


참고 : https://issues.jboss.org/browse/AS7-659
       http://blog.beany.co.kr/archives/3672
       http://www.mastertheboss.com/jboss-web/jbosswebserver/how-do-i-reload-dynamically-my-jsp-from-an-ear

JSP Compile 옵션 활성화


1. {JBoss Node}/configuration/standalone-ha.xml 파일을 수정
   Domain 방식일 경우 
{JBoss Node}/domains/master/configuration/domain.xml 파일을 수정.

2. 배포된 서버 profile을 찾아 아래처럼 변경
    
enable-welcome-root : 기본은 true
                                   false로 선언 시 context root 로 접근 시 welcome 페이지를 직접 web.xml 등으로 설정할 수 있다.

<?xml version='1.0' encoding='UTF-8'?> <server xmlns="urn:jboss:domain:1.5">      <profile>
 
        <subsystem xmlns="urn:jboss:domain:web:1.5" default-virtual-server="default-host" instance-id="${jboss.node.name}" native="false">
            <configuration>
                <jsp-configuration development="true" keep-generated="false" check-interval="1" modification-test-interval="1" recompile-on-fail="true" />
            </configuration>
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
            <virtual-server name="default-host" enable-welcome-root="false">
                <alias name="localhost"/>
                <alias name="example.com"/>
            </virtual-server>
        </subsystem> 
    </profile>

</server> 


Note for JBoss AS 7 users: make sure you have set the development attribute to "true" in your jsp-configuration :

<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
            <configuration>
                <jsp-configuration development="true" keep-generated="false" check-interval="1" modification-test-interval="1" recompile-on-fail="true"/>
            </configuration>
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <virtual-server name="default-host" enable-welcome-root="true">
                <alias name="localhost"/>
                <alias name="example.com"/>
            </virtual-server>
</subsystem>


WildFly users, on the other hand, need to specify development mode to true in the jsp-config element:

<subsystem xmlns="urn:jboss:domain:undertow:1.1">
    <servlet-container name="default" default-buffer-cache="default" stack-trace-on-error="local-only">
    <jsp-config development="true" check-interval="1" modification-test-interval="1" recompile-on-fail="true"/>
</servlet-container><br></subsystem>


+ Recent posts