Posted
Filed under 프로그래밍
MongoDB를 2.x에서 3.0.4로 업그레이드 했다.
(업그레이드 참조 : http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/?_ga=1.222986259.926585648.1423043948)


3.x대의 새로운 스토리지 엔진 WiredTiger를 사용해보려고 한것이 이유라서...

일단 기존데이터 파일은 사용하지 못한다.
꼭 옮겨야 한다면 dump뜨고 데이터파일 지우고 다시 넣어야 한다.

난 과감하게 기존데이터 파일을 삭제했다.

1. service mongod stop
2. vi /etc/mongod.conf
3. engine: wiredTiger 를 추가해준다.
4. service mongod start

start를 했는데 안올라온다면 거의 기존 데이터가 남아있어서일꺼다.

8배가 빨라지고 80% 압축이 어쩌고...
얼마나 좋아졌는지 써보자.



storageEngine {
   "name": "wiredTiger" 
}

wiredTiger {
   "uri": "statistics:",
   "LSM": {
     "sleep for LSM checkpoint throttle": NumberInt(0),
     "sleep for LSM merge throttle": NumberInt(0),
     "rows merged in an LSM tree": NumberInt(0),
     "application work units currently queued": NumberInt(0),
     "merge work units currently queued": NumberInt(0),
     "tree queue hit maximum": NumberInt(0),
     "switch work units currently queued": NumberInt(0),
     "tree maintenance operations scheduled": NumberInt(0),
     "tree maintenance operations discarded": NumberInt(0),
     "tree maintenance operations executed": NumberInt(0) 
  },
   "async": {
     "number of allocation state races": NumberInt(0),
     "number of operation slots viewed for allocation":NumberInt(0),
     "current work queue length": NumberInt(0),
     "number of flush calls": NumberInt(0),
     "number of times operation allocation failed": NumberInt(0),
     "maximum work queue length": NumberInt(0),
     "number of times worker found no work": NumberInt(0),
     "total allocations": NumberInt(0),
     "total compact calls": NumberInt(0),
     "total insert calls": NumberInt(0),
     "total remove calls": NumberInt(0),
     "total search calls": NumberInt(0),
     "total update calls": NumberInt(0) 
  },
   "block-manager": {
     "mapped bytes read": NumberInt(0),
     "bytes read": NumberInt(49152),
     "bytes written": NumberInt(368640),
     "mapped blocks read": NumberInt(0),
     "blocks pre-loaded": NumberInt(0),
     "blocks read": NumberInt(12),
     "blocks written": NumberInt(81) 
  },
   "cache": {
     "tracked dirty bytes in the cache": NumberInt(0),
     "tracked bytes belonging to internal pages in the cache":NumberInt(2827),
     "bytes currently in the cache": NumberInt(38408),
     "tracked bytes belonging to leaf pages in the cache":3221222645,
     "maximum bytes configured": 3221225472,
     "tracked bytes belonging to overflow pages in the cache":NumberInt(0),
     "bytes read into cache": NumberInt(0),
     "bytes written from cache": NumberInt(57112),
     "pages evicted by application threads": NumberInt(0),
     "checkpoint blocked page eviction": NumberInt(0),
     "unmodified pages evicted": NumberInt(0),
     "page split during eviction deepened the tree": NumberInt(0),
     "modified pages evicted": NumberInt(0),
     "pages selected for eviction unable to be evicted":NumberInt(0),
     "pages evicted because they exceeded the in-memory maximum":NumberInt(0),
     "pages evicted because they had chains of deleted items":NumberInt(0),
     "failed eviction of pages that exceeded the in-memory maximum": NumberInt(0),
     "hazard pointer blocked page eviction": NumberInt(0),
     "internal pages evicted": NumberInt(0),
     "maximum page size at eviction": NumberInt(0),
     "eviction server candidate queue empty when topping up":NumberInt(0),
     "eviction server candidate queue not empty when topping up":NumberInt(0),
     "eviction server evicting pages": NumberInt(0),
     "eviction server populating queue, but not evicting pages":NumberInt(0),
     "eviction server unable to reach eviction goal": NumberInt(0),
     "pages split during eviction": NumberInt(0),
     "pages walked for eviction": NumberInt(0),
     "eviction worker thread evicting pages": NumberInt(0),
     "in-memory page splits": NumberInt(0),
     "percentage overhead": NumberInt(8),
     "tracked dirty pages in the cache": NumberInt(0),
     "pages currently held in the cache": NumberInt(22),
     "pages read into cache": NumberInt(0),
     "pages written from cache": NumberInt(46) 
  },
   "connection": {
     "pthread mutex condition wait calls": NumberInt(7483),
     "files currently open": NumberInt(14),
     "memory allocations": NumberInt(9273),
     "memory frees": NumberInt(5106),
     "memory re-allocations": NumberInt(283),
     "total read I/Os": NumberInt(24),
     "pthread mutex shared lock read-lock calls": NumberInt(1013),
     "pthread mutex shared lock write-lock calls": NumberInt(362),
     "total write I/Os": NumberInt(137) 
  },
   "cursor": {
     "cursor create calls": NumberInt(747),
     "cursor insert calls": NumberInt(82),
     "cursor next calls": NumberInt(36),
     "cursor prev calls": NumberInt(28),
     "cursor remove calls": NumberInt(0),
     "cursor reset calls": NumberInt(336),
     "cursor search calls": NumberInt(766),
     "cursor search near calls": NumberInt(109),
     "cursor update calls": NumberInt(0) 
  },
   "data-handle": {
     "connection dhandles swept": NumberInt(0),
     "connection candidate referenced": NumberInt(0),
     "connection sweeps": NumberInt(33),
     "connection time-of-death sets": NumberInt(9),
     "session dhandles swept": NumberInt(0),
     "session sweep attempts": NumberInt(86) 
  },
   "log": {
     "log buffer size increases": NumberInt(0),
     "total log buffer size": NumberInt(1048576),
     "log bytes of payload data": NumberInt(15699),
     "log bytes written": NumberInt(18432),
     "yields waiting for previous log file close": NumberInt(0),
     "total size of compressed records": NumberInt(12585),
     "total in-memory size of compressed records":NumberInt(29812),
     "log records too small to compress": NumberInt(7),
     "log records not compressed": NumberInt(15),
     "log records compressed": NumberInt(15),
     "maximum log file size": NumberInt(104857600),
     "pre-allocated log files prepared": NumberInt(1),
     "number of pre-allocated log files to create": NumberInt(1),
     "pre-allocated log files used": NumberInt(0),
     "log read operations": NumberInt(0),
     "log release advances write LSN": NumberInt(37),
     "records processed by log scan": NumberInt(0),
     "log scan records requiring two reads": NumberInt(0),
     "log scan operations": NumberInt(0),
     "consolidated slot closures": NumberInt(0),
     "logging bytes consolidated": NumberInt(0),
     "consolidated slot joins": NumberInt(0),
     "consolidated slot join races": NumberInt(0),
     "slots selected for switching that were unavailable":NumberInt(0),
     "record size exceeded maximum": NumberInt(0),
     "failed to find a slot large enough for record": NumberInt(0),
     "consolidated slot join transitions": NumberInt(0),
     "log sync operations": NumberInt(14),
     "log sync_dir operations": NumberInt(1),
     "log server thread advances write LSN": NumberInt(0),
     "log write operations": NumberInt(37) 
  },
   "reconciliation": {
     "page reconciliation calls": NumberInt(46),
     "page reconciliation calls for eviction": NumberInt(0),
     "split bytes currently awaiting free": NumberInt(0),
     "split objects currently awaiting free": NumberInt(0) 
  },
   "session": {
     "open cursor count": NumberInt(132),
     "open session count": NumberInt(75) 
  },
   "thread-yield": {
     "page acquire busy blocked": NumberInt(0),
     "page acquire eviction blocked": NumberInt(0),
     "page acquire locked blocked": NumberInt(0),
     "page acquire read blocked": NumberInt(0),
     "page acquire time sleeping (usecs)": NumberInt(0) 
  },
   "transaction": {
     "transaction begins": NumberInt(94),
     "transaction checkpoints": NumberInt(5),
     "transaction checkpoint generation": NumberInt(5),
     "transaction checkpoint currently running": NumberInt(0),
     "transaction checkpoint max time (msecs)": NumberInt(20),
     "transaction checkpoint min time (msecs)": NumberInt(7),
     "transaction checkpoint most recent time (msecs)":NumberInt(7),
     "transaction checkpoint total time (msecs)": NumberInt(70),
     "transactions committed": NumberInt(11),
     "transaction failures due to cache overflow": NumberInt(0),
     "transaction range of IDs currently pinned by a checkpoint":NumberInt(0),
     "transaction range of IDs currently pinned": NumberInt(1),
     "transactions rolled back": NumberInt(82) 
  },
   "concurrentTransactions": {
     "write": {
       "out": NumberInt(0),
       "available": NumberInt(128),
       "totalTickets": NumberInt(128) 
    },
     "read": {
       "out": NumberInt(1),
       "available": NumberInt(127),
       "totalTickets": NumberInt(128) 
    } 
  } 
}
2015/07/01 14:44 2015/07/01 14:44
Posted
Filed under 프로그래밍/PHP
slim framework 이 워낙 간단하기때문에 조금만 생각해보면 다국어 지원도 뭐 아주 간단히 해결가능하다.


http://nesbot.com/2012/6/26/multilingual-site-using-slim

https://fiberonofiber.wordpress.com/2014/02/13/slim-php-multi-language-urls/

2015/06/23 14:26 2015/06/23 14:26
Posted
Filed under 프로그래밍
/home/cdn 에 있는 하위디렉토리까지 모든 파일의 시간을 변경한다.

find /home/cdn -print -exec touch -m -t 201506171300 {} \; 
2015/06/17 15:24 2015/06/17 15:24
Posted
Filed under 프로그래밍
http://www.mysqlkorea.com/sub.html?mcode=manual&scode=01&m_no=21703&cat1=12&cat2=353&cat3=0&lang=k

응용이 가능하다.


SELECT * FROM `test` order by case 
    when fileName LIKE "video%" then 1 
    when fileName LIKE "scene%"  then 2 
    else 3 
END


SELECT * FROM ORDER BY FIELD(a,3,4,5)

SELECT * FROM ORDER BY RAND()








2015/06/10 11:59 2015/06/10 11:59
Posted
Filed under 프로그래밍
5.6으로 설치했더니 insert에서 오류가 난다.
이전버전에서는 값을 넘겨주지 않아도 됐는데 default 값이 정해져있지 않으면 invalid value error 오류를 떨군다.
이걸 처리하려면 코드에서
SET SESSION sql_mode=''; 를 해주던가
my.cnf 파일 mysqld 부분에 sql_mode='' 를 추가해준다.
아니면 default값 다 넣어주시던가...


2015/04/22 19:05 2015/04/22 19:05
Posted
Filed under 프로그래밍

더이상 apt-get 지원을 안하는 구버전의 경우는 apt-get을 사용할수가 없다.
아래와같이 해결하자

cd /etc/apt
cp sources.list sources.list.old
sed -i 's,http://.*ubuntu.com,http://old-releases.ubuntu.com,g' sources.list
sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
sed -i 's,http://.*ftp.daum.net,http://old-releases.ubuntu.com,g' sources.list

apt-get update
apt-get install update-manager-core
do-release-upgrade


2015/04/22 12:51 2015/04/22 12:51
Posted
Filed under 프로그래밍
Get Users:
curl –i –X GET http://localhost/rest/api/users

Post (create new) User:
curl –i –X POST –d '{"name":"John Doe","email":"anemail@gmail.com","age":28}' http://localhost/rest/api/user

Put (update) User:
curl –i –X PUT –d '{"email":"jdoe@yahoo.com","age":38}' http://localhost/rest/api/user/8

Delete User:
curl –i –X DELETE http://localhost/rest/api/user/8
2015/03/24 12:32 2015/03/24 12:32
Posted
Filed under 프로그래밍/PHP
오호~ slimframework 이 좋아지고 있다.
언제부턴인가 싱글톤도 지원을 하네..ㅋㅋ

class TestTest {
 public function test() {
  echo "a";
 }
}
$app->container->singleton('test', function () {
 return new TestTest();
});
print_r($app->test->test());
exit;


편리하도다~

2015/03/24 11:29 2015/03/24 11:29
Posted
Filed under 프로그래밍
파일을 올리면 기본으로 700퍼미션이 들어간다.
외부에서 불러오지도 못하게 되는데 아래 내용을 수정또는 추가하도록 하자.

vsftpd.conf
local_umask = 022
file_open_mode = 0644 


2015/03/12 12:33 2015/03/12 12:33
Posted
Filed under 프로그래밍/PHP
php5 .5대를 사용하고 있는데도 json_decode에서 JSON_BIGINT_AS_STRING을 사용했는데 아래와 같은 오류가 나온다면?

option JSON_BIGINT_AS_STRING not implemented


설치해주자.

pecl install jsonc 

그럼 해결~

2015/03/05 12:09 2015/03/05 12:09
Posted
Filed under 프로그래밍
이번에는 레오폴드 FC660C다.
이 제품은 기계식 키보드가 아니다.
정전용량무접점이라는 방식이고 해피해킹이나 리얼포스 등과 같은 방식이다.
660c는 리얼포스보다 키압이 높은것 같다.
기계식으로 표현하자면 흑축+적축 이랄까?
그리고 키캡이 유격이 있는지 덜렁거리는 키캡들이 좀 있다.
완성도는 떨어지지만 리얼포스 대비 저렴한 가격으로 정전식을 사용해볼수 있는 키보드다

정전식은 뭔가 쫀든쫀득 느낌이 나름 매력있다.

사용자 삽입 이미지
2015/01/16 14:43 2015/01/16 14:43
Posted
Filed under 프로그래밍
승호씨 블로그 보고 나도 신청했다 ㅋㅋㅋㅋ

쓰윽~ 보고 없는거 바로 캐치~

언어별로 hello world를 찍는걸 소개하는 페이지이다.

The Hello World Collection


MySQL FUNCTION 항목 등록~!

2014/12/08 19:28 2014/12/08 19:28
Posted
Filed under 프로그래밍
간단하게 웹에서 폰트만으로 바코드를 생성하는 방법이다.

폰트는 여기서 받을수 있다.

무료 바코드 폰트 받기 CODE39

아래는 테스트로 만들어본 예제 인데 원하는 바코드 내용 앞뒤로 * 를 붙여줘야 바코드 인식기에서 인식이 가능해진다.

<style>
@font-face {
 font-family: 'BarcodeFont';
 src: url(free3of9.ttf);
}
</style>
<div style="font-family:BarcodeFont;font-size:50pt">*112123*</div>
2014/11/24 16:09 2014/11/24 16:09