'분류 전체보기'에 해당되는 글 63건

  1. 2012.05.11 REDHAT yum repository 설정 2
  2. 2012.05.04 excel 파일을 위한 api
  3. 2012.03.09 css table
  4. 2011.12.30 zookeeper 정리중
  5. 2011.11.03 couchbase 의 license
  6. 2011.11.01 movechunk 시에 can't find index in storeCurrentLocs 에러처리
  7. 2011.10.26 mongodb inline mapreduce에서 finalize에서 최종 결과 control하기
  8. 2011.10.19 auto balancing chunk number 변경
  9. 2011.10.11 mysql 초기 실행
  10. 2011.10.11 pyquery 설치 (python jquery library)

REDHAT yum repository 설정

|

레드햇 Enterprise 6 의 yum repository를 셋팅한다

/etc/yum.conf 에 추가한다

[base]

name=CentOS-$releasever - Base

baseurl=http://ftp.daum.net/centos/6/os/$basearch/

gpgcheck=1

gpgkey=http://ftp.daum.net/centos/RPM-GPG-KEY-CentOS-6


[updates]

name=CentOS-$releasever - Updates

baseurl=http://ftp.daum.net/centos/6/updates/$basearch

gpgcheck=1

gpgkey=http://ftp.daum.net/centos/RPM-GPG-KEY-CentOS-6


[extras]

name=CentOS-@releasever - Extras

baseurl=http://ftp.daum.net/centos/6/extras/@basearch

gpgcheck=1

gpgkey=http://ftp.daum.net/centos/RPM-GPG-KEY-CentOS-6


[centosplus]

name=CentOS-@releasever - Plus

baseurl=http://ftp.daum.net/centos/6/centosplus/@basearch

gpgcheck=1

gpgkey=http://ftp.daum.net/centos/RPM-GPG-KEY-CentOS-6


And

excel 파일을 위한 api

|

java 에서 excel을 read, write하기 위한 library

Apache POI : support 2007, 2003 (http://poi.apache.org/)

JExelAPI : only support 2003

OpenXls :


And

css table

|
일반적으로 table css시에 colgroup을 통해서 width의 %를 주게되면 cell의 contents에 따라서 원하는 너비로 정리가 안되는데
이부분을 해결하는 방법은 2가지가 있다
1. table-layout:fixed와 overflow:hidden을 사용하는방법
2. table-lyaout:fixedt와 word-wrap:break-word을 통해서 cell의 높이가 커지지만 모든 contents를 다 보여주는방법

table-layout
fixed: 지정된 비율로 table자체가 fix된다
auto: table cell에 있는 contents의 width에 맞춰서 테이블이 구성된다

break-all : cell내용에서 어떤단위라도 width에 안맞으면 new line으로 만들어버린다
hypenate : hypenation point에 대해서 new line을 추가
firefox, opera에서는 동작안한다
 
break-word : 쪼개질수 없는 word를 쪼갠다
width가 적용된 상태에서만 동작한다
 
text-wrap : 
아직 browser에서 지원하지 않음 
And

zookeeper 정리중

|
zookeeper
# zookeeper start/stop
bin/zkServer.sh start
bin/zkServer.sh stop

# zookeeper 연결
bin/zkCli.sh -server localhost:2181

# znode 생성및 조작
create /zk_test my_data
get /zk_test
set /zk_test junk
delete /zk_test

# zookeeper 를 replicated환경으로 운영하기
replicated group of server를 quorum 이라고 부른다
모든 quorum안의 server는 같은 configuration file을 갖는다

zoo.cfg 설정
tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181
initLimit=5
syncLimit=2
server.1=zoo1:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888

ticktime : timeout 시간
initLimit : connection timeout (실제 시간은 initLimit * tickTime)
syncLimit : leader와의 시간차의 max (실제 시간은 syncLimit * tickTime)
server.1=host:2888:3888 : 첫번째 port은 peer 끼리 통신하는데 사용
 두번째 port는 leader를 선출할때 사용하는 port

And

couchbase 의 license

|
licensing policy로 enterprise와 community 버전을 따로 만들어놨네
자세한 license policy는 요 페이지를 확인해보면될듯
 http://www.couchbase.com/products-and-services/Couchbase-support 
요약하자면 enterprise 버젼은  개발환경에서는 무료지만 production환경에서는 2개의 node까지만 free로 사용해야한다는것
community 버젼은 맘대로 사용해도 되는듯.
이래서 couchbase는 인기가 떨어지는거였구나 (몬가 반쪽짜리 free software네. mongodb의 경우는 10gen에서 직접 support해주는데에
대해서만 fee를 받는거랑 틀리네)
community 버젼은 latest, greatest, bleeding edge 라고 되어있으니 trunk버전정도인듯하다.
음 membase server 에서 이름도 couchbase server로 이름이 2.0에서 바뀌는듯한데
이녀석들은 몬가 네이밍 정책도 헛갈리고..영 그렇네.

나의 짧은 지식으로는  membase server는 memchaced(key-value : NoSQL) + disk persistency + cluster management 인 버젼이라고 생각하면될거 같고
couchbase server 2.0으로 가면서 couchdb + GeoCouch + memchaced(key-value : NoSQL) + cluster management 인 버젼이 아닐까 생각된다.

그냥 1.7.2 버젼에서 올라가면서 membaser server에서 couchbaser server로 이름을 바꾼거 같다. 여기서 말하는 key-value NoSQL 이라는것도
document base가 되는거 같기도하고... value가 json을 지원해서인건지...영 헛갈리네. 모 혀재로는 couchdb + memcached + cluster management 라고 생각해야할 듯
5분 동영상을 보니 mongodb에 비해서 탁월한 UI와 사용성의 관리 툴을 제공하는거 같다.
mongodb의 관리툴은..모.....third party것을 쓰거나 그쪽에서 제공하는 saas 를 이용해서 상태를 모니터링하는정도인거 같은데
서비스 환경의 db를 saas형태로 상태 모니터링하는건 좀 아닌거 같다....

mongodb는 주는 document oriented + auto sharding + easy scale out 이고 부로 map reduce인거 같았는데 (데이터가 적으면
map reduce가 괜찮은 성능을 보이지만 데이터가 많아지면.. 약간...좀...또한 sharded 환경에서의 reduce 옵션의 M/R에는 버그가
좀 있는 거같다)
couchbase server는 어떨지 궁금하다. 
일단 사용해봐야겠다 ㅋㅋㅋ 
And

movechunk 시에 can't find index in storeCurrentLocs 에러처리

|
일반적으로 moveChunk 명령어에서 사용되는 find에 들어간 key에 대한 index가 없어서 생기는 문제이다
해당 key에 대해서 오름차순으로 index를 만들어줘야함

예 :  db.runCommand( { moveChunk : "test.blog.posts" , find : { author : "eliot" } , to : "shard1" } )
이경우에는 index에 ensureIndex ({'author': 1}) 있어야함
And

mongodb inline mapreduce에서 finalize에서 최종 결과 control하기

|
inline map/reduce의 경우 mongodb에서 하나의 object 16MB를 넘으면 안되기 때문에
최종 finalize한 결과값이 16MB안에 들어가야한다
요것을 수정해주려면 소스 코드에 박혀있는 메모리값을 수정해주던지
finalize에서 필요 없는 결과의 key값을 최종 inline map/reduce결과에서 제거해주면 해결될수도있다 (이부분은 mongodb의 용도에 따라 다르겠지만
내 용도에 한해서는 finalize에서 필요없는 key값 자체를 제거하므로 해결이 가능하다)

기본환경은 shard환경에서의 mongodb이다
finalize script에서 return null; 이거나 return을 안한 결과에 대해서는 해당 key값을 inline map/reduce 최종 값에서 제거해버리도록 코드를 수정해보자
(현재 mongodb jira에 등록은 되어있지만 2.1 버전정도에서  해결해준다고 하는데 크게 의지는 없는듯)
 
single server 환경에서의 inline map/reduce 수정
/db/commands/mr.cpp
 
      /**
         * Applies last reduce and finalize.
         * After calling this method, the temp collection will be completed.
         * If inline, the results will be in the in memory map
         */
        void State::finalReduce( CurOp * op , ProgressMeterHolder& pm ) {


            // 변경전
            if ( ! _onDisk ) {
                // all data has already been reduced, just finalize
                if ( _config.finalizer ) {
                    long size = 0;
                    for ( InMemory::iterator i=_temp->begin(); i!=_temp->end();i++) {
                        BSONObj key = i->first;
                        BSONList& all = i->second;

                        assert( all.size() == 1 );

                        BSONObj res = _config.finalizer->finalize( all[0] );
                       all.clear();
                       all.push_back( res );
                       size += res.objsize();
                    }
                    _size = size;
                }
                return;
            }

           // 변경후
            if ( ! _onDisk ) {
                // all data has already been reduced, just finalize
                if ( _config.finalizer ) {
                    long size = 0;
                    for ( InMemory::iterator i=_temp->begin(); i!=_temp->end();) {
                        BSONObj key = i->first;
                        BSONList& all = i->second;

                        assert( all.size() == 1 );

                        BSONObj res = _config.finalizer->finalize( all[0] );
                        // finalize가 null을 반환하면 해당 key값은 삭제한다
                        if (res["value"].isNull()) {
                            _temp->erase(i++);
                        }
                        else {
                            all.clear();
                            all.push_back( res );
                            size += res.objsize();
                            i++;
                        }
                    }
                    _size = size;
                }
                return;
            }


sharded 환경에서 inline map/reduce 수정
/db/commands/mr.cpp
 
class MapReduceFinishCommand : public Command {

                        while ( cursor.more() || !values.empty() ) {
                            BSONObj t;
                            if (cursor.more()) {
                                t = cursor.next().getOwned();

                                if ( values.size() == 0 ) {
                                    values.push_back( t );
                                    continue;
                                }

                                if ( t.woSortOrder( *(values.begin()) , sortKey ) == 0 ) {
                                    values.push_back( t );
                                    continue;
                                }
                            }

                            BSONObj res = config.reducer->finalReduce( values , config.finalizer.get());
                            // finalize가 null을 반환하면 해당 key값은 삭제한다 (변경후)
                            if (!res["value"].isNull()) {
                                if (state.isOnDisk())
                                    state.insertToInc(res);
                                else
                                    state.emit(res);
                            }
                            values.clear();
                            if (!t.isEmpty())
                                values.push_back( t );

                            /*  변경전
                            if (state.isOnDisk())
                                state.insertToInc(res);
                            else
                                state.emit(res);
                            values.clear();
                            if (!t.isEmpty())
                                values.push_back( t );
                            */
                        }

And

auto balancing chunk number 변경

|
mongodb 사이트에서 src파일을 받은후에
s/balancer_policy.cpp 에서 balance function의 const int threshold = balancedLastTime ? 2 : 8; 부분을 수정해준다
앞부분이 (2) 각 shard간의 허용 imbalance 정도이고 (이 수치까지 balance를 맞춘후에 stop)
뒷부분이 (8) 각 shard간의 min, max chunk number 가 8이상 차이날 경우 auto balancing을 실시한다는것

파일을 수정후에
scons all 로 컴파일해주자 
컴파일시 boost등의 문제가 생기면 v8 engine으로 컴파일하기쪽에서 필요한 라이브러리들을 설치하자~ 
And

mysql 초기 실행

|
/etc/mysql/my.conf 셋팅 기본은 root영역에 하니까까 바꾼다 , encoding부분도 바꿔주자

# 기본 db셋팅
mysql_install_db

# mysql 재실행
/etc/init.d/mysql restart

# root 비번 셋팅
update user set password=PASSWORD('비밀번호') where user='root';

# 사용자 추가
insert into user (Host, User, Password) values ('%', 'user명', password('비밀번호'));
# 모든 db에대한 권한 줌
grant all on *.* to user명;
flush privileges; 
And

pyquery 설치 (python jquery library)

|
pyquery url : http://pypi.python.org/pypi/pyquery
필요한 ubuntu library : apt-get install libxml2-dev libxlt1-dev
설치후에 pyquery 디렉토리 들어가서 python build install 하면 끝 
And
prev | 1 | 2 | 3 | 4 | ··· | 7 | next