'분류 전체보기'에 해당하는 글 655건


postfix 를 사용해서 메일을 보내고 있다.

언제 부터인가 다음과 같은 에러메시지가 보인다. 메일이 전송이 안된다.

sendmail: fatal: parameter inet_interfaces: no local interface found for ::1

얼마전 ipv6 관련 설정을 변경한 것 같은데, 그것과 관련이 있을 듯 하다.

/etc/postfix/main.cf 에서

inet_interfaces = all

또는 

inet_interfaces = {서버IP}

처럼 써준다.


ipv6 관련 설정을 다시 확인해서 바꿔봐야 겠다.(원인파악)
일단 위와 같이 해결.



반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

흠. 솔루션 관련해서 고도몰을 사용하고 있다.

솔루션 고객들이 쓰는 것을 봐주는 경우가 간혹있다. 오래되었다 보니 잘 만들긴 한듯 하다.(보이는 부분)


그런데, 대용량에 대한 설계가 안되어 있는 듯 하다.

그동안 버전업 하면서 성능에 대한 개선은 어려웠는지 상품이 10만개가 넘어가면 현저하게 느려진다.

지금 17만개정도 상품이 있는 쇼핑몰의 상품을 지우는데(관리자페이지 에서)

세월아! 네월아!  300여개 지우는데 10분이 넘어간다. 그냥 DB 에서 삭제할까라는 생각이 든다.

다른 부분에 영향이 없을까 그냥 관리자에서 지우고 있는데, 이거 너무한 듯 싶다.


고도몰에서 호스팅 사업도 하고 있으니 "더 좋은 서버를 쓰세요" 라는 마케팅 전략일지도 모르겠다.


네이버에서 인수했으니(정확히는 NHN 인가?) 좀 개선좀 해주면 좋겠다.

당분간 고도몰을 써야할 듯 한데, 조금씩 영카트 등 완전 오픈소스로 이전을 해야겠다.


솔루션 고객들에게 추천을 못하겠다.


반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

아마존 API 를 사용하면서 (Product Advertising API)

https://affiliate-program.amazon.com 의 광고수수료 도 테스트 중이다.


솔루션내에서 Product Advertising API 가 필요해서 연결중인데, 수익을 목적으로 하는 것은 아니고, 잘 되나 확인중이다.

1월경부터 시작해서, 이제야 적립이 된 듯 하다.

1월에는 금액이 별로 없다.(현재 400$ 이상 쌓인 듯 하다)

정산(?)이 2개월주기로 되는 듯 하다.

Unpaid Balance 인것을 보니, 아직 미 지급 된듯 한데, 글을 찾아보니 말경에 되는 듯 하다.

그러면 꼬박 3개월은 되어야 손에 수수료를 쥘 수 있는 듯 하다.

뭐! 부수입으로는 괜찮겠지만, 정산주기가 너무 길다.


추가 30 일 경에 드디어 입금이 되었다.

payoneer 계정으로 입금받도록 했는데, 입금이 되었다. payoneer 연회비로 대부분 빠져나갔다.
거의 첫 정산은 3달만에 이뤄진다. 다음달 부터는 한달단위로 되겠지.
(페이오니아 는 25$ 프로모션을 하고 있다. - 가입후 100$ 이 계좌로 입금되면 25$ 리워드?를 준다.)

추가 2달째 이번에는 300불가량 입금되었다.

이제 한달 단위로 된다.

API 승인 받는 부분에 대한 리포트는 별도로 할 예정. 끝





반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

우분투 저장소를 ftp.daum.net 으로 사용하고 있다.

그런데, ftp.daum.net 이 접속이 안된다. 

오늘 virtualbox 를 설치하려고 보니 ftp.daum.net 쪽에서 데이터를 받아오지 못하는 것을 발견했다.


http://daumdna.tistory.com/839

를 확인해보니 80 포트는 유지한다는 것 같은데. 안된다.

일시적인지는 모르겠지만,  ftp.daumkakao.com  로 바꾸면 잘 된다.


우분투 서버들을 ftp.daumkakao.com 로 바꿔야 겠다.
정확히는 http://ftp.daumkakao.com  로 변경.



반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

개발도 서비스.

생각할일 2015. 2. 22. 17:59
예전에는 개발만 잘하면 되었던 것 같다.
개발스펙에 맞춰 개발하고 마무리.

이런식으로 작업하던것은 이제 없을 것 같다.
개발도 이제 서비스가 되었다.
한번 개발후 끝나는 것이 아니라, 개선하고 수정하고 요구사항에 맞춰 서비스의 방향이 바뀌기도 한다.

누군가에게 납품하는것은 예전방식대로 해야겠지만, 직접 서비스를 하는것은 정말 끝이 없는 것 같다.

수십명을 위한 서비스도 그런데, 수백 수천만명을 위한 서비스는 감도 잡기 어렵다.

역시나 팀의 소중함을 느낀다.
그런 이슈들을 해결하려면 혼자만의 역량으로는 한계가 있다.


반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

그동안 Digital Ocean 과 Linode 를 사용하고 있다.
내부 서비스에 작은 클라우드가 많이 필요해서 현재 수십대를 사용하고 있다.

둘다 별다른 불만은 없다.

좀더 다양한 지역분산 위해 VPS호스팅이 눈에 띄면 테스트 해보고 있다.


2016-07 월 특별 프로모션 중 

http://www.vultr.com/?ref=6923034-3B



몇개중에 vultr 이 눈에 띈다. http://www.vultr.com/?ref=6822762

vulture 의 줄임말인가? 뭐라 읽어야 하지? 벌쳐?

5$ 부터 시작한다. DO 보다 램이 조금 높다. 가격 우위에서 앞선다.


배포도 편하다. 일본지역이 있어서 좋다.
느낌은 DO 와 비슷하다. ssh key 등록도 되어 편하다.

성능은 배포해서 써보고 있는데, 무난한 것 같다.(뭐 기술적으로 비슷할테니...)

paypal 도 있고, 신용카드 결제도 가능핟.

bitcoin 으로도 결제 가능한 것이 특이하다.


프로모션 코드로 'SSDVPS' 를 입력하면 $20 credit 을 준다.(단, 1개월내에 소진해야 한다.)
언제까지 적용가능한지는 모르겠다.
신청하기 : http://www.vultr.com/?ref=6822762

5$ / 15$ plan 을 신청하고 1달써보고 테스트 해볼 예정이다.

검증해보고, 서비스로 쓸 만하다 싶으면, 서비스에 적용해야 겠다.



[기타 관련글]

가상서버들 간단한 사용기 - 스마일서브 / 디지털오션 / 벌쳐(vultr) 등

테스트 중인 가상서버 업체(USA)




반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

우분투의 기본설정으로 모니터 자동끄기를 사용하고 있었다.

그런데, 어떤 이유인지 모니터를 2개연결하니 작동이 이상해졌다.

그래서 그냥 스크립트로 만들었다.(외국의 스크립트를 내 입맛에 맞게 부분 변경함)


시스템설정 > 키보드 > 단축키 에서 사용자 설정으로 다음 실행파일을 실행시키는 방법으로 한다.

#!/bin/bash
screenOffLockFile=/tmp/screen-off-lock
systemLockFile=/tmp/system-lock

if [ -f $screenOffLockFile ];
then
        rm $screenOffLockFile
        rm $systemLockFile
        notify-send "Screen on." -i /usr/share/icons/gnome/48x48/devices/display.png
else
        touch $screenOffLockFile
        sleep .5
        notify-send "Screen off now." -i /usr/share/icons/gnome/48x48/devices/display.png
        touch $systemLockFile
        sleep 1
        gnome-screensaver-command -l
        while [ -f  $screenOffLockFile ]
        do
                xset dpms force off
                if [ -f $systemLockFile ];
                then
                        sleep 30
                else
                        sleep 10
                fi
        done
        xset dpms force on
fi

난 안쓰는 Pause / Break 키를 단축키로 매핑시켰다. (본인 취향에 따라 )


gnome-screensaver-command -l  => 이 부분은 모니터를 끄면서 잠금모드로 변경하도록 했다.

30초단위로 모니터가 꺼진다.(시간단위도 본인에 맞게 조정)

계속 꺼지게 되므로 켜짐모드로 하려면 단축키를 다시 눌러준다.



반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

목적은 다음과 같다. A 서버가 SXX 서버들에 API 데이터를 전송을 하는데, 서버호스팅의 트래픽이 몰리는 문제가 있다. 그래서 트래픽을 분산하고자 한다.가능한 코드를 적게 고쳐서 분산을 하고 싶다.

A -> SXX 로 바로 보내는 것이 아니라,  A -> B(proxy) -> SXX 로 보내게 된다.
그래서 트래픽을 A / B 가 나누어서 나오게 된다.

SXX.domain.co.kr 으로 원래 가던 트래픽이 SXX.domain.kr 으로 쏴주면 proxy 를 거쳐 원래주소로 가게된다.(SXX.domain.kr 은 B 서버로 설정해준다)

B서버의 nginx 설정은 다음과 같다.

server {
        listen 80;
        server_name ~^(?<subserv>.+)\.domain\.kr$ ;
        location / {
                resolver 168.126.63.1 ;
                proxy_pass http://${subserv}.domain.co.kr ;
                proxy_set_header Host $subserv.domain.co.kr ;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
}

위와 같은 방식으로 해준다.


위 진한 부분의 resolver 를 주지 않으면 proxy_pass 의 ${subserv} 부분때문에 다음과 같은 에러가 난다.

2014/10/17 13:38:11 [error] 9577#0: *1 no resolver defined to resolve s13.domain.co.kr, client: 11.22.33.44, server: s13.domain.kr, request: "GET /aaa HTTP/1.1", host: "s13.domain.kr"
2014/10/17 13:40:44 [error] 15697#0: *1 no resolver defined to resolve s13.domain.co.kr, client: 11.22.33.44, server: ~^(?<subserv>.+)\.domain\.kr$, request: "GET /aaa HTTP/1.1", host: "s13.domain.kr"
2014/10/17 13:47:20 [error] 19726#0: *3 no resolver defined to resolve s13.domain.co.kr, client: 11.22.33.44, server: ~^(?<subserv>.+).domain.kr$, request: "GET /aaa HTTP/1.1", host: "s13.domain.kr"
2014/10/17 13:50:41 [error] 26918#0: *1 no resolver defined to resolve domain.co.kr, client: 11.22.33.44, server: ~^(?<subserv>.+)\.domain\.kr$, request: "GET /aaa HTTP/1.1", host: "s13.domain.kr"
2014/10/17 13:52:07 [error] 27502#0: *1 no resolver defined to resolve domain.co.kr, client: 11.22.33.44, server: ~^(?<subserv>.+)\.domain\.kr$, request: "GET /aaa HTTP/1.1", host: "s13.domain.kr"





반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

casperjs 로 phantomjs 를 띄워서 사용하고 있다.

가끔 https 사이트들이 다음과 같은 에러가 발생한다.

[warning] [phantom] Loading resource failed with status=fail: https://www.jcrew.com/baby/coveralls/PRDOVR~A8273/A8273.jsp

보통 SSL 관련 되어 있다.

그런경우 옵션을 주어 해결한다. 

--ssl-protocol=tlsv1 실패

--ssl-protocol=any  이건 성공

--ignore-ssl-errors=yes  실패



참고 curl 등에서도 비슷한 이유로 수집이 안되는 경우 다음처럼 옵션을 준다.

            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);


반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

서버가 crash 되면서 mysql 데이터가 깨진듯 하다.

이런.

다음과 같은 메시지를 뿌리면서 실행이 안된다.

일단 force recovery 로 해봐야 겠다.

http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html

[mysqld]
innodb_force_recovery = 1

위 옵션을 넣고, 재실행해 본다.

잘 되야 할텐데...


1차실패 - 옵션값 1 을 주니 실패.

2차시도 - 옵션값을 6 으로 해봤다.

실행까지는 되는데, 로그에 다음과 같은 메시지가 계속 나온다.

140915 12:46:04  InnoDB: Waiting for the background threads to start
140915 12:46:05  InnoDB: Waiting for the background threads to start

찾아보니, 다음 옵션을 추가하라고 한다.

innodb_purge_threads=0


mysqlcheck --all-databases 를 해본다.

InnoDB: space id 74 did not exist in memory. Retrying an open.
140915 13:24:47  InnoDB: Warning: allocated tablespace 74, old maximum was 9
....
InnoDB: space id 83 did not exist in memory. Retrying an open

다음과 같은 메시지가 나온다.

점점 골치가 아파진다. 나에겐 InnoDB 는 사치인가?


이런 에러도 보인다.

 140915 20:04:43  InnoDB: Assertion failure in thread 140280661518080 in file fsp0fsp.c line 2113



이 방법으로 다시 해봐야 겠다.

http://www.percona.com/blog/2008/07/04/recovering-innodb-table-corruption/







반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

국내/해외 가상서버를 몇개씩 써봤다.

 - 기본조건 : 독립IP 를 할당 받을 수 있어야 한다.
 - 가격이점 : 가격부담이 크지 않아야 한다.


클라우드 서버들 조금씩 변하고 있고, 관리의 편리성을 개선하는 방향으로 가는 것 같다.


# 국내 가상서버.

  카페24(cafe24)

    1. 평이하다. 설치과정을 수동으로 하는지 설치비를 받는다.
    2. 가격대는 5천원대부터 시작한다.


  스쿨호스팅(phps.kr)

    1. 카페24 와 거의 동일하다. 가격대도 비슷함.


  스마일서브(cloudv)

    1. 국내에서는 유일하게 자동 설치가 되는 듯 하다.(1~2분내 개통이 되어 긴급대응이 가능하다)
    2. ikvm 이라고 원격서버를 관리할 수 있는 것이 강점.
    3. 물론 단점도 있다. 디스크를 iscsi 로 붙여서 사용하는 방식인데, iscsi 관련 트러블이 간혹 발생한다.
    4. 2015 업데이트 : iscsi 의 문제점을 보완한 SSD 전용 클라우드도 선보였다. (3만원대부터 시작하지만, 성능이 좋다.)


  기타 클라우드 : KT / SKT? 등 클라우드. 가격부담으로 제외했다.


# 해외 가상서버.

  디지털오션(digital ocean)

    1. 최근 부상하는 다크호스? 어디서 투자를 많이 받았는지 프로모션도 많이 뿌린다.
    2. 자동설치, 미리 준비한 이미지 사용가능, ssh key 등록 가능 등이 마음에 든다.
    3. API 도 제공하는데 아직 써보지는 못했다.
    4. 여러지역(미국, 유럽, 아시아)에 서버를 생성할 수 있는 것도 좋다.(아시아는 좀 더 많아졌으면 좋겠다)


  리노드(linode)

    1. 전통강자? 최근부터 쓰긴 했는데, 평이한듯 하지만, 기본기가 탄탄한 듯 하다.
    2. 디지털오션에서 제공하는 대부분이 가능한 것 같다.
    3. SSH key 를 미리 등록하지 못하는 것이 불편하다.

=> 2015.07 ( 독립기념일 신규가입 $20 credit FIREWORKS20 )


  벌쳐(Vultr) - 2015 최근에 추가

    1. 다른 VPS 를 찾다가 발견.
    2. 디지털오션과 흡사한 서비스가 많다.(장점들)
    3. SSH key 를 등록해서 사용할 수 있다.(이건 필수여야 한다)
    4. 특이점은 가격이 좀더 싸고, 비트코인으로 결제할 수 있다는 점.


해외쪽은 가끔가다 이벤트 프로모션을 한다.


# 최근에 추가 - 2015-08

  VPSIE - 2015.08 최근에 추가

    1. 한 2개월정도 테스트중.(2015.09)
    2. 디지털오션,벌쳐 등과 비슷함.
    3. SSH key 사용가능.(이건 필수여야 한다)
    4. 심플해서 좋다.


[기타 관련글]

괜찮은 VPS호스팅 발견 - vultr.com (20$ 프로모션)



반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

지난번 icinga 로 모니터링 서버를 만들었다.( http://blog.1day1.org/547 )

그런데, 서버가 자주 죽는다. vagrant 로 구축해서 그런가?

아니면 다른 문제일까? vagrant 에 icinga 만 세팅해놨다. icinga 가 불안한가?

좀더 상황을 지켜봐야 겠다.

그냥 리얼서버에 구축해야 할까?




반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

목적은 다음과 같다.

우분투 14.04 vino-server <==> ssh 터널링(putty) <==> 윈도우 vnc

이와 같은 목적으로 세팅을 했다. putty 에서 ssh 터널링 설정은 많으니 패스.

그런데, 윈도우에서 vnc 로 접속시 다음과 같은 메시지가 나온다.

Error in TightVNC Viewer: No security types supported. Server sent security types, but we do not support any of their.

tightvnc 먼저 테스트.

Unable to connect to VNC Server using your chosen security setting.
Either upgrade VNC Server to a more recent version from RealVNC, or select a weaker level of encryption.
혹시나 해서 realvnc. 둘다 마찬가지.


ssh 를 통과해서 security 관련 문제가 나타나는 듯 하다.

결국은 vino-server 대신 x11vnc 를 사용하기로 했다.

설치/설정 방법은 http://blog.1day1.org/561 를 참조한다.


x11vnc 로 바꾸고, 접속해보니 정상적으로 접속한다.



반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

우분투에서 vino-server 보다 x11vnc 가 나은듯 하다.

x11vnc 를 설치해보자

apt-get install x11vnc xinetd

로 설치해준다.

그리고, xinetd 는 x11vnc 를 자동실행시켜주기 위해 사용한다(취향에 따라 gdm 로그인시 자동실행시켜도 된다.)

/etc/xinetd.d/x11vnc 로 다음 내용을 저장한다.

service x11vnc
{
   port = 5901
   type = UNLISTED
   socket_type = stream
   protocol = tcp
   wait = no
   user = root
   server = /usr/bin/x11vnc
   server_args = -inetd -o /var/log/x11vnc.log -display :0 -auth /var/lib/gdm/:0.Xauth -xkb -repeat -many -bg -noxdamage -rfbauth /etc/x11vnc.passwd
   disable = no
}


여기서 조심할 항목은 /etc/x11vnc.passwd 의 암호를 지정하는 것이다.

x11vnc -storepasswd /etc/x11vnc.passwd


로 하면 암호를 물어보고, 해당 파일로 저장이 된다.

server_args 부분설명
  -noxdamage :  compiz 상에서 화면갱신등의 성능이 좋지 않는데, 저 옵션을 주면 좋아진다.

  -xkb -repeat  : shift 키가 안먹을때 넣어 준다.

  -auth {xauth} : ps aux | grep auth  명령으로 위치를 찾아준다.

/usr/bin/X -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch

ubuntu 14.04 에서는 위와 같다. lightdm 부분 /var/run/lightdm/root/:0 을 -auth 옵션뒤에 넣어준다.

 

설정 완료 후에는 xinetd 를 재시작 해준다.

service xinetd restart

 

[추가-2020-03-31]

우분투 18.04 에서는 lightdm 대신에 gdm 을 사용한다.(auth 부분이 /run/user/121/gdm/Xauthority 이다 )
특정 시스템의 문제인지 모르겠지만, 로그인 하면 검정화면이 된다.

해결 방법이 있을듯 하지만, 그냥 lightdm 을 설치해서 해결했다.

apt install lightdm

 

반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

올레별. 참 쓸데가 없다.

10만점 가량을 어머니 통화료 쓰시라고 보내드렸는데, 몇개월 쓰니까 종료한다고 나오네. 흠.
더욱 쓸데가 없어진 올레 별.

어따 쓰지.


오포인트? 라는 것으로 전환하면 뭔가 쓸데가 있으려나?





반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

btrfs 를 사용하고 있는데, 아직 익숙하지 않은지, 뭔가 이상한 부분들이 있다.

virtualbox 가상머신을 사용하던중 프리징 되는 현상이 발생했다. 그냥 강제종료를 하니 이제 뜨지 않는다.ㅜㅜ


커널에러가 발생하는 듯 싶다. 커널호환이 안되는 것인가?

다음과 같은 커널에러가 발생한다.

# cat kern.log-btrfs-panic
[  115.018518] ------------[ cut here ]------------
[  115.018540] kernel BUG at /build/buildd/linux-3.13.0/fs/btrfs/ctree.c:3166!
[  115.018563] invalid opcode: 0000 [#1] SMP
[  115.018578] Modules linked in: pci_stub vboxpci(OF) vboxnetadp(OF) vboxnetflt(OF) vboxdrv(OF) snd_hda_codec_hdmi snd_hda_codec_realtek x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm crct10dif_pclmul crc32_pclmul ghash_clmulni_intel dm_multipath scsi_dh aesni_intel aes_x86_64 lrw gf128mul glue_helper snd_hda_intel snd_hda_codec ablk_helper snd_hwdep cryptd rts5139(C) snd_pcm arc4 btusb snd_page_alloc rtl8723ae rtl8723_common rtl_pci rtlwifi snd_seq_midi snd_seq_midi_event mac80211 joydev snd_rawmidi serio_raw snd_seq cfg80211 snd_seq_device lpc_ich nouveau i915 snd_timer ttm mei_me drm_kms_helper mei drm snd i2c_algo_bit soundcore bnep rfcomm bluetooth mxm_wmi msi_wmi sparse_keymap binfmt_misc wmi parport_pc video mac_hid ppdev lp parport hid_generic hid_logitech_dj usbhid hid btrfs libcrc32c raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor psmouse ahci raid6_pq libahci raid1 raid0 alx mdio multipath linear dm_mirror dm_region_hash dm_log
[  115.018939] CPU: 1 PID: 732 Comm: btrfs-endio-wri Tainted: GF        C O 3.13.0-35-generic #62-Ubuntu
[  115.018966] Hardware name: Micro-Star International Co., Ltd. CR42 2M/GE40 2OC/MS-1492, BIOS E1492IMS.30O 01/29/2014
[  115.018996] task: ffff880222c8e000 ti: ffff8800b9a04000 task.ti: ffff8800b9a04000
[  115.019018] RIP: 0010:[<ffffffffa00f1a31>]  [<ffffffffa00f1a31>] btrfs_set_item_key_safe+0x161/0x170 [btrfs]
[  115.019063] RSP: 0018:ffff8800b9a05b70  EFLAGS: 00010246
[  115.019079] RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00000005e87b0000
[  115.019099] RDX: 0000000000000000 RSI: ffff8800b9a05c76 RDI: ffff8800b9a05b8f
[  115.019119] RBP: ffff8800b9a05bc8 R08: 0000000000000001 R09: ffff8800b9a05b90
[  115.019139] R10: 00000005e87b8000 R11: 00000000ffffffff R12: ffff8800b9a05b7e
[  115.019160] R13: ffff88003612a7e0 R14: ffff8800b9a05c76 R15: ffff880114d79680
[  115.019181] FS:  0000000000000000(0000) GS:ffff88022fa80000(0000) knlGS:0000000000000000
[  115.019204] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  115.019221] CR2: 00007f5d0c011088 CR3: 000000018e42b000 CR4: 00000000001427e0
[  115.019242] Stack:
[  115.019249]  ffff880035e61000 0118ffffa012a959 006c000000000000 1800000005e87b00
[  115.019274]  6c00000000000001 00000005e87b0000 ffff880114d79680 00000005e87b0000
[  115.019298]  0000000000000000 0000000000000ef7 ffff88003612a7e0 ffff8800b9a05cc0
[  115.019323] Call Trace:
[  115.019349]  [<ffffffffa0127ae1>] __btrfs_drop_extents+0x421/0xad0 [btrfs]
[  115.019374]  [<ffffffff810aafe2>] ? autoremove_wake_function+0x12/0x40
[  115.019406]  [<ffffffffa0128d10>] btrfs_drop_extents+0x60/0x90 [btrfs]
[  115.019435]  [<ffffffffa01188cc>] insert_reserved_file_extent.constprop.53+0x6c/0x290 [btrfs]
[  115.019467]  [<ffffffffa011e375>] btrfs_finish_ordered_io+0x2e5/0x570 [btrfs]
[  115.019495]  [<ffffffffa011e885>] finish_ordered_fn+0x15/0x20 [btrfs]
[  115.019523]  [<ffffffffa014219a>] worker_loop+0x15a/0x5c0 [btrfs]
[  115.019550]  [<ffffffffa0142040>] ? btrfs_queue_worker+0x310/0x310 [btrfs]
[  115.019572]  [<ffffffff8108b4a2>] kthread+0xd2/0xf0
[  115.019588]  [<ffffffff8108b3d0>] ? kthread_create_on_node+0x1c0/0x1c0
[  115.019608]  [<ffffffff8172ecbc>] ret_from_fork+0x7c/0xb0
[  115.019625]  [<ffffffff8108b3d0>] ? kthread_create_on_node+0x1c0/0x1c0
[  115.019644] Code: 48 8b 45 bf 48 8d 7d c7 4c 89 f6 48 89 45 d0 0f b6 45 be 88 45 cf 48 8b 45 b6 48 89 45 c7 e8 97 f2 ff ff 85 c0 0f 8f 48 ff ff ff <0f> 0b 0f 0b 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55
[  115.019750] RIP  [<ffffffffa00f1a31>] btrfs_set_item_key_safe+0x161/0x170 [btrfs]
[  115.019779]  RSP <ffff8800b9a05b70>
[  115.029262] ---[ end trace 642f12bbe4eff1cc ]---


일단 마운트 해제하고, btrfsck 를 해본다.

# btrfsck --repair /dev/vg_data/lv_data
enabling repair mode
Checking filesystem on /dev/vg_data/lv_data
UUID: c5cd286a-980e-414e-b10a-aacbf5c5e449
checking extents
checking free space cache
cache and super generation don't match, space cache will be invalidated
checking fs roots
root 5 inode 280 errors 180, file extent overlap, file extent discount
found 18378234624 bytes used err is 1
total csum bytes: 58871948
total tree bytes: 193949696
total fs tree bytes: 48832512
total extent tree bytes: 58753024
btree space waste bytes: 45925595
file data blocks allocated: 3653029335040
 referenced 52821159936
Btrfs v3.12

뭔가 고치긴 한것 같다.


그런데, virtualbox 를 다시 실행해도 같은 에러가 발생한다.

커널버전을 낮춰볼까?



다시 체크를 해보니

# btrfsck /dev/vg_data/lv_data
Checking filesystem on /dev/vg_data/lv_data
UUID: c5cd286a-980e-414e-b10a-aacbf5c5e449
checking extents
checking free space cache
free space inode generation (0) did not match free space cache generation (57150)
free space inode generation (0) did not match free space cache generation (57150)
free space inode generation (0) did not match free space cache generation (57151)
free space inode generation (0) did not match free space cache generation (57150)
free space inode generation (0) did not match free space cache generation (57147)
free space inode generation (0) did not match free space cache generation (57134)
free space inode generation (0) did not match free space cache generation (56404)
free space inode generation (0) did not match free space cache generation (57135)
free space inode generation (0) did not match free space cache generation (26053)
free space inode generation (0) did not match free space cache generation (56713)
free space inode generation (0) did not match free space cache generation (57137)
free space inode generation (0) did not match free space cache generation (57139)
free space inode generation (0) did not match free space cache generation (57148)
free space inode generation (0) did not match free space cache generation (57097)
free space inode generation (0) did not match free space cache generation (56684)
free space inode generation (0) did not match free space cache generation (57124)
free space inode generation (0) did not match free space cache generation (56680)
free space inode generation (0) did not match free space cache generation (56646)
free space inode generation (0) did not match free space cache generation (57050)
free space inode generation (0) did not match free space cache generation (56697)
free space inode generation (0) did not match free space cache generation (56681)
free space inode generation (0) did not match free space cache generation (57078)
free space inode generation (0) did not match free space cache generation (57087)
free space inode generation (0) did not match free space cache generation (57118)
free space inode generation (0) did not match free space cache generation (57078)
free space inode generation (0) did not match free space cache generation (57107)
free space inode generation (0) did not match free space cache generation (57147)
free space inode generation (0) did not match free space cache generation (57097)
free space inode generation (0) did not match free space cache generation (57097)
free space inode generation (0) did not match free space cache generation (57140)
free space inode generation (0) did not match free space cache generation (57147)
free space inode generation (0) did not match free space cache generation (57083)
free space inode generation (0) did not match free space cache generation (52539)
free space inode generation (0) did not match free space cache generation (56699)
free space inode generation (0) did not match free space cache generation (57141)
free space inode generation (0) did not match free space cache generation (57088)
free space inode generation (0) did not match free space cache generation (57097)
free space inode generation (0) did not match free space cache generation (57055)
free space inode generation (0) did not match free space cache generation (57087)
free space inode generation (0) did not match free space cache generation (57097)
free space inode generation (0) did not match free space cache generation (56527)
free space inode generation (0) did not match free space cache generation (57097)
free space inode generation (0) did not match free space cache generation (47463)
free space inode generation (0) did not match free space cache generation (57081)
free space inode generation (0) did not match free space cache generation (57097)
free space inode generation (0) did not match free space cache generation (57097)
free space inode generation (0) did not match free space cache generation (57056)
free space inode generation (0) did not match free space cache generation (57141)
free space inode generation (0) did not match free space cache generation (57150)
free space inode generation (0) did not match free space cache generation (57150)
free space inode generation (0) did not match free space cache generation (57147)
free space inode generation (0) did not match free space cache generation (57147)
free space inode generation (0) did not match free space cache generation (57147)
free space inode generation (0) did not match free space cache generation (57147)

free space inode generation (0) did not match free space cache generation (57147)
free space inode generation (0) did not match free space cache generation (57070)
free space inode generation (0) did not match free space cache generation (57090)
free space inode generation (0) did not match free space cache generation (57148)
free space inode generation (0) did not match free space cache generation (57147)
free space inode generation (0) did not match free space cache generation (57147)
free space inode generation (0) did not match free space cache generation (57122)
free space inode generation (0) did not match free space cache generation (57147)
free space inode generation (0) did not match free space cache generation (57118)
free space inode generation (0) did not match free space cache generation (57147)
free space inode generation (0) did not match free space cache generation (57097)
checking fs roots
root 5 inode 280 errors 180, file extent overlap, file extent discount
found 45291307607 bytes used err is 1
total csum bytes: 58871948
total tree bytes: 193966080
total fs tree bytes: 48832512
total extent tree bytes: 58769408
btree space waste bytes: 45951279
file data blocks allocated: 3653012492288
 referenced 52804317184
Btrfs v3.12

이런 엄청난 메시지가..

btrfsck 로는 해결이 안되는 것 같다.

그냥 btrfs 를 버리고 ext4 로 해야겠다.
btrfs 의 데이터를 다른곳으로 옮기고, mkfs.ext4 로 다시 생성, 다시 복사. 끝.

ext4 로 바꾸고 다시 해보니 일단은 정상적인 듯 하다.

btrfs 는 문제해결능력을 더 키운후에 다시 도전해야 겠다.

data 는 그냥 바꾸면 되는데, root 는 어떻게 할지 고민해봐야겠다.
btrfs => ext4 로 바로 바꿔주는 방법을 찾아야 겠다.


반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

nginx 로 사이트를 운영중이다. 그런데 다음과 같은 에러가 나온다.

400 Bad Request

Request Header Or Cookie Too Large

nginx/1.6.1

무슨 문제일까?

설정값으로 바꿀 수 있을 것 같은데.


찾았다.

관련글 : http://wiki.nginx.org/HttpCoreModule#large_client_header_buffers

/etc/nginx/nginx.conf 등에 추가한다. http 또는 server 쪽에 넣어준다.

기본값은 4 8k

    large_client_header_buffers 4 16k;

16k 로 늘려줬다. 너무 늘리는 것은 좋지 않겠지.



반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

CentOS 에서 audit backlog 관련 오류가 난다.

시스템이 이상해서 살펴보니.

dmesg 에 이런 메시지가 나온다.

audit: audit_backlog=321 > audit_backlog_limit=320
audit: audit_lost=2343 audit_rate_limit=0 audit_backlog_limit=320
audit: backlog limit exceeded
audit: audit_backlog=321 > audit_backlog_limit=320
audit: audit_lost=2344 audit_rate_limit=0 audit_backlog_limit=320
audit: backlog limit exceeded
audit: audit_backlog=321 > audit_backlog_limit=320
audit: audit_lost=2345 audit_rate_limit=0 audit_backlog_limit=320
audit: backlog limit exceeded
audit: audit_backlog=321 > audit_backlog_limit=320
__ratelimit: 53 callbacks suppressed
audit: audit_backlog=321 > audit_backlog_limit=320
audit: audit_lost=2364 audit_rate_limit=0 audit_backlog_limit=320
audit: backlog limit exceeded
audit: audit_backlog=321 > audit_backlog_limit=320
audit: audit_lost=2365 audit_rate_limit=0 audit_backlog_limit=320
audit: backlog limit exceeded
audit: audit_backlog=321 > audit_backlog_limit=320
audit: audit_lost=2366 audit_rate_limit=0 audit_backlog_limit=320
audit: backlog limit exceeded
audit: audit_backlog=321 > audit_backlog_limit=320

로그파일쪽 limit 가 걸린 듯 하다. 파일수 제한인가?
log 를 보니 cron 실행과 관련이 있어 보인다.

아무튼 이것때문에 시스템이 이상해졌다.


/etc/init.d/auditd stop

chkconfig auditd off

또는 /etc/audit/audit.rules 를 수정해서 audit_backlog_limit 값을 늘려준다.

-b 320

320이 기본값으로 되어 있다. 그냥 무식하게 0 하나를 더 늘렸다.


centos 에서 selinux 와 함께 audit 요놈도 좀 이상하다.
보안과 관련된 것들일 듯 싶은데, 그에 대한 가이드가 필요할 듯 하다.




반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

microSD 를 써보려고 하는데, exfat 으로 포맷되어 있다.

기본으로 설치된 ubuntu 에서 인식을 못한다.

우분투 14.04 에서는 공식패키지로 있다.(이전에는 PPA 를 사용했다)

# apt-get install exfat-utils
패키지 목록을 읽는 중입니다... 완료
의존성 트리를 만드는 중입니다      
상태 정보를 읽는 중입니다... 완료
다음 패키지를 더 설치할 것입니다:
  exfat-fuse
다음 새 패키지를 설치할 것입니다:
  exfat-fuse exfat-utils
0개 업그레이드, 2개 새로 설치, 0개 제거 및 3개 업그레이드 안 함.
112 k바이트 아카이브를 받아야 합니다.
이 작업 후 304 k바이트의 디스크 공간을 더 사용하게 됩니다.
계속 하시겠습니까? [Y/n]
받기:1 http://ftp.daum.net/ubuntu/ trusty/universe exfat-fuse amd64 1.0.1-1 [26.0 kB]
받기:2 http://ftp.daum.net/ubuntu/ trusty/universe exfat-utils amd64 1.0.1-1 [85.7 kB]
내려받기 112 k바이트, 소요시간 0초 (161 k바이트/초)
Selecting previously unselected package exfat-fuse.
(데이터베이스 읽는중 ...현재 353015개의 파일과 디렉터리가 설치되어 있습니다.)
Preparing to unpack .../exfat-fuse_1.0.1-1_amd64.deb ...
Unpacking exfat-fuse (1.0.1-1) ...
Selecting previously unselected package exfat-utils.
Preparing to unpack .../exfat-utils_1.0.1-1_amd64.deb ...
Unpacking exfat-utils (1.0.1-1) ...
Processing triggers for man-db (2.6.7.1-1) ...
exfat-fuse (1.0.1-1) 설정하는 중입니다 ...
exfat-utils (1.0.1-1) 설정하는 중입니다 ...

exfat-utils / exfat-fuse 를 설치하면 된다.

재부팅 안해도 바로 인식한다.



반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

vagrant 나만의 패키지 box 를 만들어 보자.

공개된 box 를 사용하다 보면 조금씩 내 입맛에 맞게 변경하게 된다.
그 상태를 패키지로 만들어 본다.

관련 링크 : https://docs.vagrantup.com/v2/virtualbox/boxes.html

# vagrant package --base {가상머신이름} --output {박스이름}

형태로 만들어 준다. 그렇지만 언제나 우리를 당황하게 만드는 에러메시지

# vagrant package --base nhost --output nhost.box
/opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:306:in `id=': undefined method `children' for nil:NilClass (NoMethodError)
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:438:in `state'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/providers/virtualbox/action/created.rb:11:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builder.rb:116:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `block in run'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/busy.rb:19:in `busy'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `run'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builtin/call.rb:43:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/builder.rb:116:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `block in run'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/util/busy.rb:19:in `busy'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/action/runner.rb:66:in `run'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:196:in `action_raw'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:173:in `block in action'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:434:in `lock'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:161:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/machine.rb:161:in `action'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/commands/package/command.rb:83:in `package_vm'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/commands/package/command.rb:66:in `package_base'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/plugins/commands/package/command.rb:42:in `execute'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/cli.rb:42:in `execute'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.6.3/lib/vagrant/environment.rb:252:in `cli'
        from /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.6.3/bin/vagrant:166:in `<main>'

어! 뭐가 문제지.

답은 --base {가상머신이름}

가상머신 이름을 정확하게 적어줘야 한다.

ls  ~/VirtualBox VMs  안에 가상머신들이 있다. 그 이름(폴더명)을 적어준다.

또는

# VBoxManage list vms

결과는 이런 식이다.
"nhost_default_1406732053960_27414" {196dbe3a-1c2f-4414-83f4-dbb612a67059}


이제 제대로 적어준다.

# vagrant package --base nhost_default_1406732053960_27414 --output nhost.box

다음처럼 박스가 생성된다. 가상머신이 실행중이면 먼저 중지된다.

==> nhost_default_1406732053960_27414: Attempting graceful shutdown of VM...
==> nhost_default_1406732053960_27414: Clearing any previously set forwarded ports...
==> nhost_default_1406732053960_27414: Exporting VM...
==> nhost_default_1406732053960_27414: Compressing package to: /opt/nhost.box

해당 위치에 보면 OOO.box 파일이 생겼을 것이다.


사용은 다음처럼 한다. 추후 vagrant init nhost 로 사용가능하다.

# vagrant box add nhost /opt/nhost.box


==> box: Adding box 'nhost' (v0) for provider:
    box: Downloading: file:///opt/nhost.box
==> box: Successfully added box 'nhost' (v0) for 'virtualbox'!

정상적으로 box 가 등록된다.



반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

vagrant 의 용량이 모자라요. 디스크를 추가해서 늘려보자.

상황 - vagrant 의 가상머신내 용량이 모자란다. 공유폴더로 하려니 권한, owner 설정등의 문제가 있다.

해결방법 : 200G 가상디스크를 생성하고, guest 의 / root 에 LVM logical 디스크를 추가한다.

조건 : 디스크 /dev/sda 로 설정되어 있고, LVM 으로 /dev/mapper/VolGroup-lv_root 가 root 에 마운트되어 있다. LVM 을 이용해 디스크용량을 확장하려는 것이다.


1. Vagrantfile 에 디스크를 생성하는 명령을 넣는다.

  config.vm.provider "virtualbox" do |vb|
    file_to_disk = File.realpath( "." ).to_s + "/disk.vdi"

    if ARGV[0] == "up" && ! File.exist?(file_to_disk)
       puts "Creating 200GB disk #{file_to_disk}."
       vb.customize [
            'createhd',
            '--filename', file_to_disk,
            '--format', 'VDI',
            '--size', 200 * 1024   # 200 GB
            ]
       vb.customize [
            'storageattach', :id,
            '--storagectl', 'SATA',
            '--port', 1, '--device', 0,
            '--type', 'hdd', '--medium',
            file_to_disk
            ]
    end

  end

  config.vm.provision "shell", path: "scripts/add_new_disk.sh"


2. provision 실행명령을 작성한다.

 스크립트 내용 : 추가된 디스크를 fdisk 로 등록하고, LVM logical 디스크로 추가한후 용량을 확장한다.

# cat scripts/add_new_disk.sh
set -e
set -x

if [ -f /etc/disk_added_date ]
then
   echo "disk already added so exiting."
   exit 0
fi


sudo fdisk -u /dev/sdb <<EOF
n
p
1


t
8e
w
EOF

pvcreate /dev/sdb1
vgextend VolGroup /dev/sdb1
lvextend -L +200G /dev/VolGroup/lv_root
resize2fs /dev/VolGroup/lv_root

date > /etc/disk_added_date



3. provision 명령으로 스크립트를 실행한다.

# vagrant provision
==> default: Running provisioner: shell...
    default: Running: /tmp/vagrant-shell20140730-16554-1duycg4.sh
==> default: ++ '[' -f /etc/disk_added_date ']'
==> default: ++ sudo fdisk -u /dev/sdb
==> default: Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
==> default: Building a new DOS disklabel with disk identifier 0x95391d02.
==> default: Changes will remain in memory only, until you decide to write them.
==> default: After that, of course, the previous content won't be recoverable.
==> default: Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
==> default:
==> default: WARNING: The size of this disk is 219.9 TB (219902325555200 bytes).
==> default: DOS partition table format can not be used on drives for volumes
==> default: larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
==> default: partition table format (GPT).
==> default:
==> default: WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
==> default:          switch off the mode (command 'c')
==> default: .
==> default:
==> default: Command (m for help):
==> default: Command action
==> default:    e   extended
==> default:    p   primary partition (1-4)
==> default: Partition number (1-4):
==> default: First sector (63-4294967295, default 63):
==> default: Using default value 63
==> default: Last sector, +sectors or +size{K,M,G} (63-4294967294, default 4294967294):
==> default: Using default value 4294967294
==> default:
==> default: Command (m for help):
==> default: Selected partition 1
==> default: Hex code (type L to list codes):
==> default: Changed system type of partition 1 to 8e (Linux LVM)
==> default:
==> default: Command (m for help):
==> default: The partition table has been altered!
==> default:
==> default: Calling ioctl() to re-read partition table.
==> default: Syncing disks.
==> default: ++ pvcreate /dev/sdb1
==> default:  
==> default: dev_is_mpath: failed to get device for 8:17
==> default:   Physical volume "/dev/sdb1" successfully created
==> default: ++ vgextend VolGroup /dev/sdb1
==> default:   Volume group "VolGroup" successfully extended
==> default: ++ lvextend -L +200G /dev/VolGroup/lv_root
==> default:   Extending logical volume lv_root to 218.51 GiB
==> default:   Logical volume lv_root successfully resized
==> default: ++ resize2fs /dev/VolGroup/lv_root
==> default: resize2fs 1.41.12 (17-May-2010)
==> default: Filesystem at /dev/VolGroup/lv_root is mounted on /; on-line resizing required
==> default: old desc_blocks = 2, new_desc_blocks = 14
==> default: Performing an on-line resize of /dev/VolGroup/lv_root to 57280512 (4k) blocks.
==> default: The filesystem on /dev/VolGroup/lv_root is now 57280512 blocks long.
==> default: ++ date

vagrant ssh 를 해보면 정상적으로 용량이 늘어난 것을 볼 수 있다.

% 로그를 보니 200G 가 아닌 200T 로 세팅된 듯 하다. Vagrantfile 쪽의 용량 계산을 잘 못 한듯 하다.
다시 설정을 체크해봐야 겠다.%



반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

모바일에서 ssh 터널링을 해보자.

지난번에 icinga 모니터링(http://blog.1day1.org/547)을 세팅한후에 웹화면을 모바일에서도 보려고 한다.

그냥 공유기/서버에 포트포워딩을 할까 하다가 ssh 터널링으로 해보기로 한다.
PC 에서는 putty 등으로 터널링을 하면 된다.

모바일에서는 ConnectBot 이라는 앱을 이용한다.


# 서버 접속 설정(포트포워딩)

1) 하단 부분에 접속할 서버를 세팅한다 (계정@서버주소:포트 형식)


2) 생성된 리스트의 항목을 누르고 있으면 아래처럼 포트 포워딩을 할 수 있다.


3) 처음에는 비어있을 것인데 폰의 메뉴탭(또는 윈도우탭을 오래누르면 된다)을 누르면 포트를 추가할 수 있다.


4) Source Port 는 폰에서 접속할 포트. Destination 은 서버측의 IP:포트 가 된다.(ssh 터널링을 해봤으면 익숙 할 것이다)

위와 같이 설정후에 접속해보면 ssh 터널링이 연결되어 있을 것이다.

폰에서 모니터링 서버에 접속해서 볼 수 있게 된다. 그런데, 패스워드를 입력해야 한다.
공개키를 사용해서 바로 접속하도록 해본다.

# 공개키 사용하기

1) 공개키 관리 접속 및 설정.(폰의 메뉴키를 누르면 나온다.)


2) 서버키를 생성한다.(역시 메뉴키를 누른다) - Generate 는 새로생성.
  이미 키가 있다면 import 로 한다.


3) 아래 처럼 입력할 부분을 넣어준다.(난 암호를 비워놨다.)
   Generate 를 누르면 공개키를 생성하게 된다.


4) 아래처럼 나오면 파란 부분을 문질러주면 된다.


5) 생성이 된후에 공개키를 복사해서 메일같은 것으로 보낸후 서버에 추가해주면 된다.
  서버의 .ssh/authorized_keys 에 넣어주면 된다.


6) 설정후에 이 공개키를 서버접속시 사용하도록 한다.(서버 설정에서 Edit host 로 들어간다)
   Use pubkey authentication 를 누르면 설정했던 키가 나온다. 해당 키를 선택한다.

서버에 접속을 하면 바로 접속이 될 것이다.

접속한 후에 모니터링화면을 접속해본다.
localhost:8833 포트가 ssh 터널링을 통해 원격지 서버의 모니터링 포트로 접속해서 보여주게 된다.

공개적인 것이 아닌 경우 이런식으로 ssh 터널링을 하면 좋은 것 같다.
성능도 그렇게 나쁘지는 않은 것 같다.


반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

ssh 접속시 느린 현상이 간혹 발생한다.


접속이 느린 지점 확인

# ssh -v server

-v 옵션을 줘서 어느 부분에서 접속이 느린지 확인한다


방법1) DNS resolving 문제

서버측의 /etc/ssh/sshd_config 에서

UseDNS no

로 해준다.


방법2) GSSAPIAuthentication  인증 문제

ssh -v 로 확인해본다.

debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available

debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available

debug1: Unspecified GSS failure.  Minor code may provide more information


debug1: Unspecified GSS failure.  Minor code may provide more information
No Kerberos credentials available

debug1: Next authentication method: publickey

위 진한 부분에서 느리다면.  서버측에서 GSSAPI 를 지원하면 해당 인증을 먼저 시도하는데, 클라이언트측에서 설정이 안되어 있어서 지연현상이 발생하는 듯 하다.

/etc/ssh/ssh_config ( sshd_config 가 아님 )

    GSSAPIAuthentication no

위 옵션을 no 로 바꿔준다.

서버 관리자가 아닌경우  ~/.ssh/config 에 넣어줘도 된다.



반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

vagrant 를 사용하다 보면 GuestAdditions 의 버전이 다른 경우가 있다.

vagrant up 시에 다음과 같은 메시지가 뜬다.

Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   4.3.10
VBoxService inside the vm claims: 4.3.14
Going on, assuming VBoxService is correct...
GuestAdditions 4.3.14 running --- OK.

host 와 가상머신내의 버전이 다르다.


~/VirtualBox VMs/chef-solo_default_1406182370453_27414 => 다음 위치에서

 vi OOO.vbox 를 열어본다. (진한부분은 box 별로 다를 것이다.)

          <GuestProperty name="/VirtualBox/GuestAdd/Version" value="4.3.14" timestamp="1397926654949278000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/VersionExt" value="4.3.14" timestamp="1397926654951054000" flags=""/>

위와 같은 항목이 나오는데, 버전부분을 새버전으로 바꿔준다.

vagrant reload 를 해서 다시 실행시켜 본다.


# 몇가지 guest 체크 명령

# vagrant vbguest --status
GuestAdditions 4.3.14 running --- OK.


- 현재 버전 보기.

# VBoxManage guestproperty get aadfe9f8-a351-42b0-832a-af8d7dcbe6be /VirtualBox/GuestAdd/Version
Value: 4.3.14

진한 부분은 /VirtualBox VMs/ 의 해당가상머신의 UUID (OOO.vbox 파일 위쪽에 있음)


- 현재 머신 설정으로 저장하기

# VBoxManage guestproperty set aadfe9f8-a351-42b0-832a-af8d7dcbe6be /VirtualBox/GuestAdd/Version

# VBoxManage guestproperty set aadfe9f8-a351-42b0-832a-af8d7dcbe6be /VirtualBox/GuestAdd/Revisioin

get 을 set 으로 바꿔주면  OOO.vbox 의 내용을 현재 설정으로 바꿔준다.



참고1) 아래 위치는  기본 box 이미지에서 수정할때 사용한다.

~/.vagrant.d/boxes/chef-VAGRANTSLASH-ubuntu-14.04-i386/1.0.0/virtualbox => 다음과 같은 위치에

 vi box.ovf 를 열어보면 위 와 비슷하다. 버전 부분 변경.


참고2) 버전이 다르면 vagrant 가 자동으로 업데이트 해준다. => 크게 의미 없는 듯 함(사용하는게 좋을 듯)

이때 버전업을 하기 싫다면 다음 옵션을 Vagrantfile 에 추가한다.

  config.vbguest.auto_update = false




반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

vagrant up 시에 다음과 같은 vboxsf 관련 에러를 보게되면,

Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant


다음처럼 guest plugin 을 설치한다.

$ vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Installed the plugin 'vagrant-vbguest (0.10.0)'!


그리고, vagrant reload 를 한번 해준다.



반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

vagrant 의 기본 메모리가 부족해서 늘려보고자 한다.

설정은 다음과 같다. Vagrantfile 에 추가해준다.

  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--memory", "1024"]
  end

적당한 메모리 값을 넣어준다.

위와 같이 하면 정상정으로 진행될 것이다.



=> 아래 에러는 아마도 cpu 를 2 로 늘렸을때 났던 에러인 듯 하다. 빼고 해도 동일 에러가 나는 이유는 무엇일까?
설정값이 남아있었던 것일까? vagrant destroy 후에 다시 해보니 정상이다.

관련 설정을 한후 vagrant up 을 해보면 다음과 같은 에러가 난다.

# vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'chef/ubuntu-14.04-i386' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 2201.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 => 2201 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
The guest machine entered an invalid state while waiting for it
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.

If the provider you're using has a GUI that comes with it,
it is often helpful to open that and watch the machine, since the
GUI often has more helpful error messages than Vagrant can retrieve.
For example, if you're using VirtualBox, run `vagrant up` while the
VirtualBox GUI is open.


/VirtualBox VMs/chef-solo_default_1406169045971_64274/Logs 에서 VBox.log 를 열어서 보면

00:00:00.070719
00:00:00.070719 ********************* End of CFGM dump **********************
00:00:00.070730 VM: fHMEnabled=true  (configured) fRecompileUser=false fRecompileSupervisor=false
00:00:00.070732 VM: fRawRing1Enabled=false CSAM=true  PATM=true
00:00:00.070842 VMSetError: /home/vbox/vbox-4.3.14/src/VBox/VMM/VMMR3/HM.cpp(532) int HMR3Init(PVM); rc=VERR_VMX_MSR_VMXON_DISABLED
00:00:00.070854 VMSetError: VT-x is disabled in the BIOS.
00:00:00.196099 ERROR [COM]: aRC=NS_ERROR_FAILURE (0x80004005) aIID={8ab7c520-2442-4b66-8d74-4ff1e195d2b6} aComponent={Console} aText={VT-x is disabled in the BIOS. (VERR_VMX_MSR_VMXON_DISABLED)}, preserve=false
00:00:00.248130 Power up failed (vrc=VERR_VMX_MSR_VMXON_DISABLED, rc=NS_ERROR_FAILURE (0X80004005))

결론은 해당 호스트머신이 CPU 가상화 VT-x 를 지원하지 않는 것이다.

테스트한 머신이 i3 라 가상화 지원을 하지 않아서 그런듯 하다. 메모리만 늘리려 하는데도 안되는 듯 하다.

i5 이상급으로 업그레이드 하거나 다른 머신에서 테스트해야 겠다.


반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

관리하는 서버 대수가 많아지다 보니 모니터링이 쉽지 않다.

서버 호스팅 업체를 통한 기본관리도 가능하지만, 부족한 부분이 있고, 여러 호스팅 업체를 사용하다보면 그것도 불편하다


icinga 로 모니터링 서버를 구축해본다.

웹 모니터링 화면을 접속하면 이런식으로 나온다.

관련글 : https://www.digitalocean.com/community/tutorials/how-to-use-icinga-to-monitor-your-servers-and-services-on-ubuntu-14-04

설정은 위 링크를 참조하기로 하고 특이사항 들을 추가한다.


관련 패키지를 설치하면 몇가지 설정단계를 거친다.

1) 처음에는 mysql root 계정 암호를 넣을 것이다. 적당한 암호를 넣는다.


2) 메일 설정 부분

메일 설정을 해준다. 메일로 알람을 받을 때 쓰는 듯 하다.


3) 관리자 화면에 쓸 icingaadmin 계정 설정

관리용 웹화면의 암호를 입력한다.

다음처럼 추가 패키지들이 설치된다.


다음은 그냥 No 로 넘어가고,


4) icinga-idoutils 관련 설정

icinga-idoutils 의 설정 : 모니터링 데이터에 쓰이는 듯 하다.

여기에서는 mysql 을 쓸 것이다.


초기데이터 설정을 위해 관리자 암호를 물어본다(처음에 설정한 값)


icinga-idoutils 가 쓸 mysql 계정암호를 넣는다.

여기까지 기본설정 완료. 추가로 패키지들이 마저 설치된다.



5) 모니터링 관리자 화면 접속.

난 설정을 포트포워딩 해서 http://localhost:8800/icinga/ 으로 접속했다.

아이디는 icingaadmin 이고, 암호는 설정시 입력한 값을 넣는다.




참고로 난 vagrant 로 가상머신을 만들고, icinga 를 세팅했다.
vagrant 로 세팅후 box 의 80포트를 포트포워딩 하고, 부팅시 자동실행하도록 설정했다.

1) 포트포워딩(Vagrantfile)

config.vm.network :forwarded_port, host: 8080, guest: 80

2) 부팅시 자동실행(vagrant box) : http://blog.1day1.org/543




반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

vagrant up 을 하게 되면 virtualbox 가 시작되면서 가상머신이 부팅하게 된다.

기본 설정은 private network 로 되는 듯 하다.


브리지 모드로 하려면

Vagrantfile 에 다음 항목을 넣어준다.

방법1)
config.vm.network "public_network"

방법2)
config.vm.network "public_network", bridge: "eth0"

설정값이 vagrant 버전에 따라 차이가 있는 듯 하다.

config.vm.network :public_network, bridge: "eth0"

위와 같이 옵션을 넣어줘도 되는 듯 하다. ( 구분은 " => 로 하는게 더 쉬워보인다)


비슷하게 포트 포워딩을 하려면 이런식.

config.vm.network :forwarded_port, host: 8080, guest: 80



# vagrant -v
Vagrant 1.6.3

그냥 config.vm.network "public_network" 부분까지만 넣어주면, 네트웍인터페이스(랜카드) 가 여러개이면 선택하는 화면이 나온다.

# vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Available bridged network interfaces:
1) eth0
2) wlan0
3) docker0
    default: What interface should the network bridge to?

=> 매번 선택 해줘야 한다. bridge 옵션으로 network interface 를 정해주면 선택하지 않고 바로 가동할 수 있다.




하위 버전은 아래 명령중 하나로 작동할 듯 함.(아래 설정중 알아서 설정)

config.vm.network :bridged, :bridge => "eth0"

config.vm.network :public_network, :public_network => "wlan0"




반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

그동안 다음에서 티스토리가 방치된 느낌이었는데 요즘에 좀 신경을 쓰는것 같다.

이번에는 티스토리앱이 나왔다.

글쓰기 테스트 해본다.

그림도 넣어본다.


괜찮다.

복잡하지 않다.

요즘 워드프레스 텀블러 등도 테스트 하고 있는데 또 다른 재미거리가 되겠다.

반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,

갤럭시 S5 - wifi hotspot 의 성능이 꽝이었는데, 이번에는 저장소?

처음에는 microSD 를 장착해서 microSD 쪽이 느린 것 같았다. 그런데 SD 카드를 빼도 그렇다.

갤럭시 S5 자체의 문제인 것 같다.


갤러리 를 클릭하면


이런 화면이 10초이상 나왔다가 앨범이 나온다.(SD 카드를 장착한 경우는 더 느렸던 것 같다.)


갤럭시S5 의 버그인지, 내가 가지고 있는 기기의 특성인지는 모르겠다.

그동안 스마트폰을 여러대 사용해봤지만, 이런 경우는 처음이다. 예전 초기 스마트폰보다 더 심한 것 같다.




반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,