'Etc'에 해당되는 글 115건

  1. mongodb assert log debugging 방법
  2. MongoDB Manual 2
  3. truncate table시 SCH-M lock 이 걸린다.
  4. mongodb 다중 배열의 값을 변경하기~ 2
  5. MongoDB Use Cases
  6. Sizing Up the TempDB Database
  7. Mongodb configuration option
  8. MongoDB performance SSDs vs Spindle SAS Drives
  9. MongoDB visual studio 2010에서 빌드하기
  10. mongodb c++ lib WriteConcen

안녕하세요. 주디아줌마입니다.

mongod에 아래와 같이 dumplog가 남았다면? 어느 위치에서 오류가 나는지 학인 할 필요가 있다. (참고, mongodb visual studio 2010 ).  스택 정보가 보인다.  정확한 소스 위치를 알고 싶어할 것이다.


아래와 같이 남기는 방식이 objdump un-mangle names of C++ template 이거던데, 정확히는 모름 ㅠㅠ

 /usr/bin/mongod(_ZN5mongo12sayDbContextEPKc+0x96) [0x57a8a6]

 /usr/bin/mongod(_ZN5mongo8assertedEPKcS1_j+0xfb) [0x5853eb]

 /usr/bin/mongod(_ZNK5mongo5KeyV18dataSizeEv+0x12c) [0x75150c]

 /usr/bin/mongod(_ZN5mongo12BucketBasicsINS_12BtreeData_V1EE16_packReadyForModERKNS_8OrderingERi+0xdd) [0x78fdad]

 /usr/bin/mongod(_ZNK5mongo12BucketBasicsINS_12BtreeData_V1EE11basicInsertENS_7DiskLocERiS3_RKNS_5KeyV1ERKNS_8OrderingE+0x1f6) [0x790286]

 /usr/bin/mongod(_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE10insertHereENS_7DiskLocEiS3_RKNS_5KeyV1ERKNS_8OrderingES3_S3_RNS_12IndexDetailsE+0x68) [0x792968]

 /usr/bin/mongod(_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE7_insertENS_7DiskLocES3_RKNS_5KeyV1ERKNS_8OrderingEbS3_S3_RNS_12IndexDetailsE+0x2e5) [0x793f35]

 /usr/bin/mongod(_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE9bt_insertENS_7DiskLocES3_RKNS_7BSONObjERKNS_8OrderingEbRNS_12IndexDetailsEb+0x10b) [0x79425b]

 /usr/bin/mongod(_ZNK5mongo18IndexInterfaceImplINS_12BtreeData_V1EE9bt_insertENS_7DiskLocES3_RKNS_7BSONObjERKNS_8OrderingEbRNS_12IndexDetailsEb+0xcd) [0x90d03d]

 /usr/bin/mongod() [0x8aedc6]

 /usr/bin/mongod(_ZN5mongo11DataFileMgr6insertEPKcPKvibbPb+0x7f1) [0x8b4781]

 /usr/bin/mongod(_ZN5mongo11DataFileMgr16insertWithObjModEPKcRNS_7BSONObjEb+0x4b) [0x8b5b3b]

 /usr/bin/mongod(_ZN5mongo14checkAndInsertEPKcRNS_7BSONObjE+0xa8) [0x887f88]

 /usr/bin/mongod(_ZN5mongo14receivedInsertERNS_7MessageERNS_5CurOpE+0x439) [0x88c649]

 /usr/bin/mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x11c5) [0x88e945]

 /usr/bin/mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x78) [0xaa0bc8]

 /usr/bin/mongod(_ZN5mongo3pms9threadRunEPNS_13MessagingPortE+0x287) [0x6389f7]


CentOS의 c++filt를 설치하고 위의 덤프쪽 괄호 안의 문자열들을 copy하여 c++filt를 통하여 위치 정보를 확인해 보자. 괄호안의 문자열들로 텍스트 정보를 정리하고 붙여 넣어서 실행한다.

c++filt 참고
  http://devanix.tistory.com/192 
  http://jh4hj.tistory.com/337 
c++ 컴파일러는 단 하나의 이름을 갖는 심볼이 되도록 name mangling이라는 과정을 수행한다.


[~~]$ c++filt
_ZN5mongo12sayDbContextEPKc+0x96
mongo::sayDbContext(char const*)+0x96
_ZN5mongo8assertedEPKcS1_j+0xfb
mongo::asserted(char const*, char const*, unsigned int)+0xfb
_ZNK5mongo5KeyV18dataSizeEv+0x12c
mongo::KeyV1::dataSize() const+0x12c
_ZN5mongo12BucketBasicsINS_12BtreeData_V1EE16_packReadyForModERKNS_8OrderingERi+0xdd
mongo::BucketBasics::_packReadyForMod(mongo::Ordering const&, int&)+0xdd
_ZNK5mongo12BucketBasicsINS_12BtreeData_V1EE11basicInsertENS_7DiskLocERiS3_RKNS_5KeyV1ERKNS_8OrderingE+0x1f6
mongo::BucketBasics::basicInsert(mongo::DiskLoc, int&, mongo::DiskLoc, mongo::KeyV1 const&, mongo::Ordering const&) const+0x1f6
_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE10insertHereENS_7DiskLocEiS3_RKNS_5KeyV1ERKNS_8OrderingES3_S3_RNS_12IndexDetailsE+0x68
mongo::BtreeBucket::insertHere(mongo::DiskLoc, int, mongo::DiskLoc, mongo::KeyV1 const&, mongo::Ordering const&, mongo::DiskLoc, mongo::DiskLoc, mongo::IndexDetails&) const+0x68
_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE7_insertENS_7DiskLocES3_RKNS_5KeyV1ERKNS_8OrderingEbS3_S3_RNS_12IndexDetailsE+0x2e5
mongo::BtreeBucket::_insert(mongo::DiskLoc, mongo::DiskLoc, mongo::KeyV1 const&, mongo::Ordering const&, bool, mongo::DiskLoc, mongo::DiskLoc, mongo::IndexDetails&) const+0x2e5
_ZNK5mongo11BtreeBucketINS_12BtreeData_V1EE9bt_insertENS_7DiskLocES3_RKNS_7BSONObjERKNS_8OrderingEbRNS_12IndexDetailsEb+0x10b
mongo::BtreeBucket::bt_insert(mongo::DiskLoc, mongo::DiskLoc, mongo::BSONObj const&, mongo::Ordering const&, bool, mongo::IndexDetails&, bool) const+0x10b
_ZNK5mongo18IndexInterfaceImplINS_12BtreeData_V1EE9bt_insertENS_7DiskLocES3_RKNS_7BSONObjERKNS_8OrderingEbRNS_12IndexDetailsEb+0xcd
mongo::IndexInterfaceImpl::bt_insert(mongo::DiskLoc, mongo::DiskLoc, mongo::BSONObj const&, mongo::Ordering const&, bool, mongo::IndexDetails&, bool) const+0xcd
_ZN5mongo11DataFileMgr6insertEPKcPKvibbPb+0x7f1
mongo::DataFileMgr::insert(char const*, void const*, int, bool, bool, bool*)+0x7f1
_ZN5mongo11DataFileMgr16insertWithObjModEPKcRNS_7BSONObjEb+0x4b
mongo::DataFileMgr::insertWithObjMod(char const*, mongo::BSONObj&, bool)+0x4b
_ZN5mongo14checkAndInsertEPKcRNS_7BSONObjE+0xa8
mongo::checkAndInsert(char const*, mongo::BSONObj&)+0xa8
_ZN5mongo14receivedInsertERNS_7MessageERNS_5CurOpE+0x439
mongo::receivedInsert(mongo::Message&, mongo::CurOp&)+0x439
_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x11c5
_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x78
mongo::assembleResponse(mongo::Message&, mongo::DbResponse&, mongo::HostAndPort const&)+0x11c5
mongo::MyMessageHandler::process(mongo::Message&, mongo::AbstractMessagingPort*, mongo::LastError*)+0x78
_ZN5mongo3pms9threadRunEPNS_13MessagingPortE+0x287
mongo::pms::threadRun(mongo::MessagingPort*)+0x287


25line Key1 datasize를 가져오면서 문제가 있어보이네요.  key 문제이니~ 해결방법은 Reindex하는게 최선책일 듯합니다.


   /** version when write intent already declared */
    template< class V >
    void BucketBasics::_packReadyForMod( const Ordering &order, int &refPos ) {
        assertWritable();

        if ( this->flags & Packed )
            return;

        int tdz = totalDataSize();
        char temp[V::BucketSize];
        int ofs = tdz;
        this->topSize = 0;
        int i = 0;
        for ( int j = 0; j < this->n; j++ ) {
            if( mayDropKey( j, refPos ) ) {
                continue; // key is unused and has no children - drop it
            }
            if( i != j ) {
                if ( refPos == j ) {
                    refPos = i; // i < j so j will never be refPos again
                }
                k( i ) = k( j );
            }
            short ofsold = k(i).keyDataOfs();
            int sz = keyNode(i).key.dataSize();
            ofs -= sz;
            this->topSize += sz;
            memcpy(temp+ofs, dataAt(ofsold), sz);
            k(i).setKeyDataOfsSavingUse( ofs );
            ++i;
        }
        if ( refPos == this->n ) {
            refPos = i;
        }
        this->n = i;
        int dataUsed = tdz - ofs;
        memcpy(this->data + ofs, temp + ofs, dataUsed);

        // assertWritable();
        // TEMP TEST getDur().declareWriteIntent(this, sizeof(*this));

        this->emptySize = tdz - dataUsed - this->n * sizeof(_KeyNode);
        {
            int foo = this->emptySize;
            verify( foo >= 0 );
        }

        setPacked();

        assertValid( order );
    }


'Etc' 카테고리의 다른 글

MongoDB + Hadoop  (0) 2012.09.11
sql agent에 할당된 max worker thread 수는 얼마일까?  (0) 2012.09.10
MongoDB Manual  (2) 2012.09.06
truncate table시 SCH-M lock 이 걸린다.  (0) 2012.09.06
mongodb 다중 배열의 값을 변경하기~  (2) 2012.08.29

MongoDB Manual

'Etc' 카테고리의 다른 글

mongodb assert log debugging 방법  (0) 2012.09.07
MongoDB Manual  (2) 2012.09.06
mongodb 다중 배열의 값을 변경하기~  (2) 2012.08.29
MongoDB Use Cases  (0) 2012.08.27
Sizing Up the TempDB Database  (0) 2012.08.23

안녕하세요. 주디아줌마입니다.

질문사항

주제 : 배열 속성의 정보를 변경하라. 
http://cafe.naver.com/mongodatabase/471


방법

이글을 보시면 아직 지원이 안되는 것 같습니다. Update values in array in MongoDB https://jira.mongodb.org/browse/SERVER-1243

크리스티나가 적용할 수 있는 방법을 알려줬는데요~. 아주 잘 되네요~
참고링크 : http://stackoverflow.com/questions/3017900/update-values-in-array-in-mongodb 
역쉬 크리스티나~ 싸랑해요.ㅋㅋ


-- 테스트용 데이타를 등록 합니다.
db.users.insert(
{
	"id" : '1234',
       	"items" : [ 

		{ "code" : '1' , "typeid" : "1", "positionX" : 3, "positionY" : 4 },
		{ "code" : '2' , "typeid" : "1", "positionX" : 3, "positionY" : 4 },
		{ "code" : '3' , "typeid" : "2", "positionX" : 3, "positionY" : 4 }

	]	
})
db.users.insert(
{
	"id" : '1235',
       	"items" : [ 

		{ "code" : '1' , "typeid" : "1", "positionX" : 3, "positionY" : 4 },
		{ "code" : '2' , "typeid" : "1", "positionX" : 3, "positionY" : 4 },
		{ "code" : '3' , "typeid" : "2", "positionX" : 3, "positionY" : 4 }

	]	
})

db.users.find( { "id":"1234"}).forEach( function( user) 
{
	user.items.forEach( function (item) 
	{
		if( item.code == "1" || item.code == "3" )
		{
			item.positionX = 5000;
		}
	});
	db.users.save(user);

});

db.findOne();
> db.users.findOne();
{
        "_id" : ObjectId("503dd4f54d25432cc83f97b7"),
        "id" : "1234",
        "items" : [
                {
                        "code" : "1",
                        "typeid" : "1",
                        "positionX" : 5000,
                        "positionY" : 4
                },
                {
                        "code" : "2",
                        "typeid" : "1",
                        "positionX" : 2000,
                        "positionY" : 4
                },
                {
                        "code" : "3",
                        "typeid" : "2",
                        "positionX" : 5000,
                        "positionY" : 4
                }
        ]
}


'Etc' 카테고리의 다른 글

MongoDB Manual  (2) 2012.09.06
truncate table시 SCH-M lock 이 걸린다.  (0) 2012.09.06
MongoDB Use Cases  (0) 2012.08.27
Sizing Up the TempDB Database  (0) 2012.08.23
Mongodb configuration option  (0) 2012.08.14

MongoDB Use Cases

Sizing Up the TempDB Database

Sizing Up the TempDB Database


http://www.brentozar.com/archive/2012/08/webcast-video-sizing-up-tempdb-database-best-practices/




tempdb에 대한 설정 방향을 잘 정리해서 공유해주셨네요^^

Helpful Links on TempDB

'Etc' 카테고리의 다른 글

mongodb 다중 배열의 값을 변경하기~  (2) 2012.08.29
MongoDB Use Cases  (0) 2012.08.27
Mongodb configuration option  (0) 2012.08.14
MongoDB performance SSDs vs Spindle SAS Drives  (0) 2012.08.07
MongoDB visual studio 2010에서 빌드하기  (0) 2012.08.03

Mongodb configuration option

몽고DB에 옵션들이 어떤게 있을까? 아래의 경로의 소스를 보면 대략 보인다. 슬슬 mongo.conf 파일에 아래의 옵션들을 넣고 테스트나 해봐야겠다. ㅋㅋㅋ

\mongodb-src-r2.2.0-rc0\src\mongo\db\db.cpp

http://docs.mongodb.org/manual/reference/configuration-options/
http://docs.mongodb.org/manual/administration/configuration/


    StringBuilder dbpathBuilder;
    dbpathBuilder << "directory for datafiles - defaults to " << dbpath;

    general_options.add_options()
    ("auth", "run with security")
    ("cpu", "periodically show cpu and iowait utilization")
    ("dbpath", po::value() , dbpathBuilder.str().c_str())
    ("diaglog", po::value(), "0=off 1=W 2=R 3=both 7=W+some reads")
    ("directoryperdb", "each database will be stored in a separate directory")
    ("ipv6", "enable IPv6 support (disabled by default)")
    ("journal", "enable journaling")
    ("journalCommitInterval", po::value(), "how often to group/batch commit (ms)")
    ("journalOptions", po::value(), "journal diagnostic options")
    ("jsonp","allow JSONP access via http (has security implications)")
    ("noauth", "run without security")
    ("nohttpinterface", "disable http interface")
    ("nojournal", "disable journaling (journaling is on by default for 64 bit)")
    ("noprealloc", "disable data file preallocation - will often hurt performance")
    ("noscripting", "disable scripting engine")
    ("notablescan", "do not allow table scans")
    ("nssize", po::value()->default_value(16), ".ns file size (in MB) for new databases")
    ("profile",po::value(), "0=off 1=slow, 2=all")
    ("quota", "limits each database to a certain number of files (8 default)")
    ("quotaFiles", po::value(), "number of files allowed per db, requires --quota")
    ("repair", "run repair on all dbs")
    ("repairpath", po::value() , "root directory for repair files - defaults to dbpath" )
    ("rest","turn on simple rest api")
#if defined(__linux__)
    ("shutdown", "kill a running server (for init scripts)")
#endif
    ("slowms",po::value(&cmdLine.slowMS)->default_value(100), "value of slow for profile and console log" )
    ("smallfiles", "use a smaller default file size")
    ("syncdelay",po::value(&cmdLine.syncdelay)->default_value(60), "seconds between disk syncs (0=never, but not recommended)")
    ("sysinfo", "print some diagnostic system information")
    ("upgrade", "upgrade db if needed")
    ;

#if defined(_WIN32)
    CmdLine::addWindowsOptions( windows_scm_options, hidden_options );
#endif

    replication_options.add_options()
    ("oplogSize", po::value(), "size to use (in MB) for replication op log. default is 5% of disk space (i.e. large is good)")
    ;

    ms_options.add_options()
    ("master", "master mode")
    ("slave", "slave mode")
    ("source", po::value(), "when slave: specify master as ")
    ("only", po::value(), "when slave: specify a single database to replicate")
    ("slavedelay", po::value(), "specify delay (in seconds) to be used when applying master ops to slave")
    ("autoresync", "automatically resync if slave data is stale")
    ;

    rs_options.add_options()
    ("replSet", po::value(), "arg is [/]")
    ;

    sharding_options.add_options()
    ("configsvr", "declare this is a config db of a cluster; default port 27019; default dir /data/configdb")
    ("shardsvr", "declare this is a shard db of a cluster; default port 27018")
    ("noMoveParanoia" , "turn off paranoid saving of data for moveChunk.  this is on by default for now, but default will switch" )
    ;

    hidden_options.add_options()
    ("fastsync", "indicate that this instance is starting from a dbpath snapshot of the repl peer")
    ("pretouch", po::value(), "n pretouch threads for applying replicationed operations") // experimental
    ("command", po::value< vector >(), "command")
    ("cacheSize", po::value(), "cache size (in MB) for rec store")
    ("nodur", "disable journaling")
    // things we don't want people to use
    ("nohints", "ignore query hints")
    ("nopreallocj", "don't preallocate journal files")
    ("dur", "enable journaling") // old name for --journal
    ("durOptions", po::value(), "durability diagnostic options") // deprecated name
    // deprecated pairing command line options
    ("pairwith", "DEPRECATED")
    ("arbiter", "DEPRECATED")
    ("opIdMem", "DEPRECATED")
   


'Etc' 카테고리의 다른 글

MongoDB Use Cases  (0) 2012.08.27
Sizing Up the TempDB Database  (0) 2012.08.23
MongoDB performance SSDs vs Spindle SAS Drives  (0) 2012.08.07
MongoDB visual studio 2010에서 빌드하기  (0) 2012.08.03
mongodb c++ lib WriteConcen  (0) 2012.07.30

몽고DB 성능에 많이 미치는 저장 하드웨어에 따른 몽고DB 성능 정보가 올라왔네요. 요즘 대부분 SSD를 많이 사용들 하더군요.


MSSQL에서는 SSD를 tempdb용으로 많이 쓰는듯해요. 근데, 몽고DB는? 흠흠.


원본 링크 

http://blog.serverdensity.com/mongodb-performance-ssds-vs-spindle-sas-drives/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+serverdensity+%28Server+Density+Blog%29


 

몽고디비 빌드하기 위해서 아래의 사이트에서 빌드를 위한 소스 및 기타 빌드관련 프로그램들을 다운로드 받아야 한다. 나는 DBA이고, C++ 개발 경험도 조금 가지고 있어 소스를 파악해 가면서 몽고디비를 깊게 파봐야 같다.

 

몽고디비 빌드를 위해서 아래의 사이트에서 알려주는 대로 설치만 하면 된다.

http://www.mongodb.org/display/DOCS/Building+with+Visual+Studio+2010
https://github.com/TellagoDevLabs/Hermes/wiki/Downloading-the-source-code-and-compiling-it-using-visual-studio-2010

 

빌드 버전 : 2.2.0-rc0 (7/19/2012)
Win7-64






1. mongoDB 소스 다운로드

   http://www.mongodb.org/downloads


Source tab의 zip파일의 링크를 클릭하면  12M 정도의 소스가 다운로드 된다. 다운로드 후 압축을 풀어준다. 난 C:\mongo_src\라는 곳에 압축을 해제하였다.

 


2. 그 외 빌드를 위한 유틸리티 및 모듈 다운로드


가) 파이썬 설치

http://sourceforge.net/projects/pywin32/files/pywin32/Build216/pywin32-216.win32-py2.7.exe/download 


다운로드 된 파일 python-2.7.2.exe 을 설치 한다. C:\Python27\ 경로에 설치되었는지 확인하자. 경로가 틀리면 원활하게 되지 않는다.

 

나) Scons

http://sourceforge.net/projects/scons/files/scons/2.1.0/scons-2.1.0.win32.exe/download.


scons-2.1.0.win32.exe 설치

 

다) Boost

http://sourceforge.net/projects/sevenzip/files/7-Zip/9.20/7z920-x64.msi/download


c:\boost\ 디렉토리에

 

3. 솔루션 파일을 생성(Visual Studio 2010)


가) 1번에서 소스 파일을 압축 해제했던 경로로 이동하여 빌드 명령을 실행하자.

64bit version으로  솔루션 파일을 생성시키는 명령


C:\mongo_src\scons --64 


빌드 실행 명령 옵션

scons                   // build mongod

scons mongoclient.lib   // build C++ client driver library

scons all               // build all end user components

scons .                 // build all including unit tests and C++ driver zip file

scons --64              // build the 64 bit version

scons --dd              // build with debug symbols

scons -jX               // perform X steps in parallel (e.g. -j16 will compile 16 files at once)

 

나) 솔루션 파일을 찾자.

C:\mongo_src\src\mongo\db\db_10.sln

 

솔루션 파일을 더블클릭하여 실행.

 

 

mongodb c++ lib WriteConcen

몽고DB 경우 WriteConcen 상태가 기본적으로 Normal 상태라 한다클라이언트는 데이터 전송이 완료되었음을 인지하고 서버가 데이터를 저장소에 저장하였는지를 통보해 주지 않는다.

 

게임로그 특성상 쓰기 연산과 관련된 일관성 모드를 보여줘야 하는데 현재, 테스트된 c++ lib 2.1.2 부터 지원이 된다.


쓰기 성공하였는지 확인하기 위해서는 getLastError 호출하여 확인해야 한다.


함수 

string getLastError(bool fsync = false, bool j = false, int w = 0, int wtimeout = 0);

 

 

connection.insert( "test.foo" , BSON( "x" << 1 ) );

connection.getLastError( false , true , 2 , 0 );

 

 

다운로드 링크

http://webscripts.softpedia.com/scriptDownload/MongoDB-C---Driver-Download-70180.html


참고 링크

http://www.mongodb.org/display/DOCS/Building+with+Visual+Studio+2010