'Etc'에 해당되는 글 115건

  1. 몽고DB 책 소개
  2. DB 개체 스크립트 하기
  3. 몽고DB Replicated Shard Cluster + Arbitor
  4. 몽고DB 활용 사례
  5. 몽고DB Sharding 설정 및 테스트 16
  6. SQL 설치 유용한 스크립트
  7. journal 폴더가 왜 생기는 걸까?
  8. 몽고DB Config 설정하기(Win7)
  9. 몽고DB 책 소개
  10. 몽고DB 어드민 관리툴 1

몽고DB 책 소개

얼마전에 출간된 몽고DB 번역서입니다. 책을 사서 읽고있지만 정말 깊이 있는 내용을 가지고 있네요.  특히, 인덱스 부분 최적화 부분에 잘 설명되어 있습니다.


http://kangcom.com/sub/view.asp?topid=1&sku=201204060003



이 책으로 몽고DB 사용자 그룹에서 스터디 진행중입니다. http://cafe.naver.com/mongodatabase


이 책으로 심도있게 서버 구축, 테스트, 모니터링 관련해서 공부하려고 합니다.

아자.ㅋㅋ


'Etc' 카테고리의 다른 글

ipv6에 대해 고려중이신가요?  (0) 2012.05.17
SQL 책 추천(강력 추천)  (0) 2012.05.16
DB 개체 스크립트 하기  (0) 2012.04.25
몽고DB Replicated Shard Cluster + Arbitor  (0) 2012.03.19
몽고DB 활용 사례  (0) 2012.03.19

DB 개체 스크립트 하기

DB를 개발하게 되면 일별 폴백업이 아닌 DB Script들만 따로 백업 받고 싶을 때가 있다. 이때 사용할 수 있는게 C#을 이용하면 아주 편하다.

꿈꾸는 거북이님의 스크립트를 이용해서 약간만 수정해서 만들어 보니 아주 편하다^^

 꿈꾸는 거북이님의 원본 글 

http://blog.naver.com/hrk007/60156735472


1. 소스


using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics.Eventing;

using Microsoft.SqlServer.Management.Sdk;
using Microsoft.SqlServer.Management.Sdk.Sfc;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Server;
using Microsoft.SqlServer.Management.Common;

// ++ 참고 사이트
// http://blog.naver.com/PostView.nhn?blogId=hrk007&logNo=60156735472&categoryNo=0&parentCategoryNo=0&viewDate=¤tPage=1&postListTopCurrentPage=&userTopListOpen=true&userTopListCount=30&userTopListManageOpen=false&userTopListCurrentPage=1
// http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/MSSQLServerAdmin/smo-script-index-and-fk-s-on-a-database
// http://www.mssqltips.com/sqlservertip/1833/generate-scripts-for-database-objects-with-smo-for-sql-server/

namespace DBManagement
{
    class DBScripting
    {
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                throw new Exception("입력파라메터 필요 ex) 저장폴더 서버 db1,sp,table:db2,table");
            }
            
            string folder = args[0];
            Server myServer = new Server(args[1]);
            string[] databaseList = args[2].Split(new char[] { ':' });
            
            
            try
            {
                // 1. Using windows authentication
                myServer.ConnectionContext.LoginSecure = true;
                // 2. Using SQL Server authentication
                //myServer.ConnectionContext.LoginSecure = false;
                //myServer.ConnectionContext.Login = "";
                //myServer.ConnectionContext.Password = "";
                myServer.ConnectionContext.Connect();
                // GetSmoTest(myServer, databaseList, folder);
                getSMOObject(myServer, databaseList, folder);
            }
            catch (Exception ex)
            {
                insertWindowEventLog(ex.Message);
            }
            finally
            {
                if (myServer.ConnectionContext.IsOpen)
                    myServer.ConnectionContext.Disconnect();
            }
        } // end main


        // DB 내의 모든 SMO Object 정보 수집
        private static void getSMOObject(Server myServer, string[] databaseList, string folder)
        {
            //foreach (Database myDatabase in myServer.Databases)
            //{
            //    Console.WriteLine(myDatabase.Name);
            //}

            Urn[] urns = null;
            for (int i = 0; i < databaseList.Length; i++)
            {
                // init
                urns = null;
                // ibdb,table,sp
                string[] objList = databaseList[i].Split(new char[] {','});
                // 요청 DB name
                Database db = myServer.Databases[objList[0]];

                List list = new List();

                // 테이블
                for (int j = 1; j < objList.Length; j++)
                {
                    list = new List();
                    urns = null;

                    // 테이블
                    if (objList[j].ToUpper().Equals("TABLE"))
                    {
                        Scripter scripter = new Scripter(myServer);
                        scripter.Options.FileName = setFileName(folder, objList[0], objList[j]);                        
                        scripter.Options.AppendToFile = true;
                        scripter.Options.Indexes = true;
                        scripter.Options.ClusteredIndexes = true;
                        scripter.Options.ScriptSchema = true;
                        scripter.Options.NoCollation = true;
                        scripter.Options.DriDefaults = true;
                        scripter.Options.DriAllConstraints = true;                        
                        scripter.Options.ScriptDrops = false;

                        foreach (Table table in db.Tables)
                        {
                            if (!table.IsSystemObject)
                            {
                                //list.Add(table.Urn);
                                scripter.Script(new Urn[] { table.Urn });
                            }                            
                        }

                        //urns = list.ToArray();
                        //scripter.Script(urns);


                    }// if table


                    // SP
                    if (objList[j].ToUpper().Equals("SP"))
                    {
                        foreach (StoredProcedure sp in db.StoredProcedures)
                        {
                            if (!sp.IsSystemObject && !sp.IsEncrypted)
                            {
                                list.Add(sp.Urn);
                            }                            
                        }
                        urns = list.ToArray();
                        Scripter scripter = new Scripter(myServer);
                        scripter.Options.FileName = setFileName(folder, objList[0], objList[j]);
                        scripter.Options.AppendToFile = true;                        
                        scripter.Script(urns);
                    } // if sp

                    // View
                    if (objList[j].ToUpper().Equals("VIEW"))
                    {
                        foreach (View vw in db.Views)
                        {                            
                            if (!vw.IsSystemObject && !vw.IsEncrypted)
                            {
                                list.Add(vw.Urn);
                            }
                        }

                        urns = list.ToArray();
                        Scripter scripter = new Scripter(myServer);
                        scripter.Options.FileName = setFileName(folder, objList[0], objList[j]);
                        scripter.Options.AppendToFile = true;
                        scripter.Script(urns);
                    } // if sp                    

                    // function
                    if (objList[j].ToUpper().Equals("FUNC"))
                    {
                        foreach (UserDefinedFunction uf in db.UserDefinedFunctions)
                        {
                            if (!uf.IsSystemObject && !uf.IsEncrypted)
                            {
                                list.Add(uf.Urn);
                            }
                        }

                        urns = list.ToArray();
                        Scripter scripter = new Scripter(myServer);
                        scripter.Options.FileName = setFileName(folder, objList[0], objList[j]);
                        scripter.Options.AppendToFile = true;
                        scripter.Script(urns);
                    } // if sp    


                } // end object
                        
            } // for (database)
        }
 

        // 윈도우 Event Log 입력
        private static void insertWindowEventLog(string message)
        {
            try
            {
                System.Diagnostics.EventLog eventLog = new System.Diagnostics.EventLog();
                if (!System.Diagnostics.EventLog.SourceExists("DBObjectScript"))
                {
                    System.Diagnostics.EventLog.CreateEventSource("DBObjectScript", "Application");
                }
                eventLog.Source = "DBObjectScript";
                int eventID = 8;
                eventLog.WriteEntry(message,
                                    System.Diagnostics.EventLogEntryType.Error,
                                    eventID);
                eventLog.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
 

        // 파일명 생성 folderName = "D:\objectscript"
        private static string setFileName(string folderName, string dbname, string objectname)
        {
            string filename = "";
            // 디렉토리
            try
            {
                // 생성
                DirectoryInfo Dir = new DirectoryInfo(folderName);
                if (!Dir.Exists)
                {
                    Dir = Directory.CreateDirectory(folderName);
                }

                filename = folderName + "\\" + dbname + "_" + objectname + "_"
                            + DateTime.Now.ToString("yyyymmdd_hhmm") + ".sql";
                

                // 일자_시분초.sql
                //filename = folderName + "\\" + dbname + "_" + objectname + "_"
                //    + DateTime.Now.ToShortDateString().Replace(":","")
                //    + "_" + DateTime.Now.ToShortTimeString().Replace(":", "") + ".sql";
            }
            catch (Exception ex)
            {
                insertWindowEventLog(ex.Message);
            }
            finally
            {
                if (filename == "")
                  filename = folderName + "\\" + dbname + "_objectscript.sql";  
            }
            return filename;
            
        }
 

    }
}


2. 실행파일

아래의 실행 파일을 다운로드 받거나 위의 소스를 컴파일해서 사용한다.

DBScripting.zip



3. 사용방법

저장경로 DB서버주소 DB명 저장하려고 하는 개체

실행 예) 저장폴더  서버 DB,table,sp,view,func:DB,table 

D:\TEST\DBScripting\DBScripting\bin\Release\DBScripting.exe G:\TEST JUDY\SQL2012 TSQL2012,table,sp,view,func

4. SQL Agent JOB 등록


5. 스크립트 관리??

스크립트 비교 검증 어떻게 할까?? 나는 주로 WinMerge를 애용한다..

위와 같이 비교가 가능하다.



'Etc' 카테고리의 다른 글

SQL 책 추천(강력 추천)  (0) 2012.05.16
몽고DB 책 소개  (0) 2012.05.16
몽고DB Replicated Shard Cluster + Arbitor  (0) 2012.03.19
몽고DB 활용 사례  (0) 2012.03.19
몽고DB Sharding 설정 및 테스트  (16) 2012.02.29

MongoDB on EC2


위와 같이 EC2에서  몽고DB 환경 구성을 ReplicaSet + Sharding 테스트 환경구성하려고 합니다. 


참고링크
CookBook의 Marc Bastien님이 정리해주신 자료를 바탕으로 테스트 환경 구성합니다.


테스트 환경
Win7 64bit

테스트 구성 정보

- 각각의 Replica Sets은 3개 노드로 구성되며, 그중 3번째 노드는 arbiter로 구성.
- Mongos N개까지 여유가 되면 추가 구성 합니다. 
- Replica-Set은 스스로 감지할 수 있는 장점이 있지만, 간혹가다 감지를 못하는 경우도 있다고 합니다. 그럴경우를 대비해서 aribter node(결정권자 노드) 구성을 하여 복제 노드들 간의 투표 참가만 합니다. arbiter node는  복제본을 가지고 있지 않습니다.



Process

1. 3개 Replica Set 구성 및 테스트 데이타 등록

1.1 저장소 디렉토리 구성

D:\DB\MONGO> mkdir firstset1 , firstset2, firstarbiter

D:\DB\MONGO> mkdir secondset1, secondset2, secondarbiter

D:\DB\MONGO> mkdir thirdset1, thirdset2, thirdarbiter
D:\DB\MONGO> mkdir config1,  config2, config3

테스트로 D:\DB\MONGO\ 폴더에 관리자 권한으로 저장 디렉토리를 생성

1.2 mongod 3개의 인스턴스를 시작

mongod --dbpath D:\DB\MONGO\firstset1 --port 10001 --replSet firstset --oplogSize 700 --rest

mongod --dbpath D:\DB\MONGO\firstset2 --port 10002 --replSet firstset --oplogSize 700 --rest

mongod --dbpath D:\DB\MONGO\firstarbiter --port 10003 --replSet firstset --oplogSize 700 --rest

- 몽고DB 설치 참조  http://judydba.tistory.com/129  
- oplog :  마스터가 수행한 연산 기록을 oplog(operatorion log)이라고 하며, 특수한 데이타베이스의 oplog.$main 컬렉션에 저장.  msql에서 보면 트랜잭션 로그 같다고 보면 된다. oplog는 제한 컬렉션에 저장된다는 점인데  새로운 연산이 oplog에 저장될때 자동적으로 오래된 연산을 대체 한다. 64비트 인스턴스라고 하면 가용량의 5% 정도를 oplog 용도로 사용 한다. 테스트 환경에서는 700M로 로그 제한 한다. 
 
1.3 mongo shell 접속

C:\>mongo localhost:10001/admin

MongoDB shell version: 2.0.2

connecting to: localhost:10001/admin


1.4 first replica-set 초기화 

db.runCommand({"replSetInitiate" : {"_id" : "firstset", "members" : [{"_id" : 1, "host" : "localhost:10001"}, {"_id" : 2, "host" : "localhost:10002"}, {"_id" : 3, "host" : "localhost:10003", arbiterOnly: true }]}})

firstset이라고 하는 replica-set 이름을 지정하며, 세번째 호스트를 arbiter노드로 지정

1.5 데이타를 등록

PRIMARY> use test

switched to db test
 

PRIMARY>  people = ["Marc", "Bill", "George", "Eliot", "Matt", "Trey", "Tracy", "Greg", "Steve", "Kristina", "Katie", "Jeff"];

PRIMARY> for(var i=0; i<1000000; i++){

     name = people[Math.floor(Math.random()*people.length)];

     user_id = i;

     boolean = [true, false][Math.floor(Math.random()*2)];

     added_at = new Date();

     number = Math.floor(Math.random()*10001);

     db.test_collection.save({"name":name, "user_id":user_id, "boolean": boolean, "added_at":added_at, "number":number });

test db를 생성하고, test_collection에 데이타를 입력 한다.  


2. Config instance와 single shard 생성

config server는 어떤 데이타가 어떤 샤드에 있는지, 클러스터 설정을 저장한다. mongos 어떤 데이터도 영구 저장하지 않기 때문에 샤드 설정 받을 곳이 필요하다. 

2.1 config servers 실행

mongod --configsvr --dbpath D:\DB\MONGO\config1 --port 20001

mongod --configsvr --dbpath D:\DB\MONGO\config2 --port 20002

mongod --configsvr --dbpath D:\DB\MONGO\config3 --port 20003


2.2 mongos 실행

mongos --configdb localhost:20001,localhost:20002,localhost:20003 --port 27018 --chunkSize 1

27018 port로 mongos 인스턴스를 실행한다.  

2.3 샤드를 추가

D:\DB\MONGO>mongo localhost:27018/admin

MongoDB shell version: 2.0.2

connecting to: localhost:27018/admin

mongos> db.runCommand( { addshard : "firstset/localhost:10001,localhost:10002,localhost:10003" } )

{ "shardAdded" : "firstset", "ok" : 1 }

mongos>



3. 두번째, 세번째 복제셋 생성 

3.1 두번째 mongod instance 실행

mongod --dbpath D:\DB\MONGO\secondset1 --port 10004 --replSet secondset --oplogSize 700 --rest

mongod --dbpath D:\DB\MONGO\secondset2 --port 10005 --replSet secondset --oplogSize 700 --rest

mongod --dbpath D:\DB\MONGO\secondarbiter --port 10006 --replSet secondset --oplogSize 700 --rest


3.2  second replica-set 초기화  

mongo localhost:10004/admin
db.runCommand({"replSetInitiate" : {"_id" : "secondset", "members" : [{"_id" : 1, "host" : "localhost:10004"}, {"_id" : 2, "host" : "localhost:10005"}, {"_id" : 3, "host" : "localhost:10006", arbiterOnly: true}]}}) 



3.3 두번째 샤드 클러스터 복제셋 추가

mongo localhost:27018/admin

db.runCommand( { addshard : "secondset/localhost:10004,localhost:10005,localhost:10006" } )

db.runCommand({listshards:1})


 3.4 세번째 리플리카 mongod instance 실행

mongod --dbpath D:\DB\MONGO\thirdset1 --port 10007 --replSet thirdset --oplogSize 700 --rest

mongod --dbpath D:\DB\MONGO\thirdset2 --port 10008 --replSet thirdset --oplogSize 700 --rest

mongod --dbpath D:\DB\MONGO\thirdarbiter --port 10009 --replSet thirdset --oplogSize 700 --rest


3.5 복제 설정 초기화

mongo localhost:10007/admin


db.runCommand({"replSetInitiate" : {"_id" : "thirdset", "members" : [{"_id" : 1, "host" : "localhost:10007"}, {"_id" : 2, "host" : "localhost:10008"}, {"_id" : 3, "host" : "localhost:10009",  arbiterOnly: true  }]}})



3.6 세번째 샤드 클러스터 복제셋 구성

mongo localhost:27018/admin

db.runCommand( { addshard : "thirdset/localhost:10007,localhost:10008,localhost:10009" } )

db.runCommand({listshards:1})



4. 샤딩 활성화

5.1 데이타베이스 레벨 샤딩 설정

mongo localhost:27018/admin 

mongos> use admin

switched to db admin

mongos> show dbs;

config  0.0625GB

test    0.203125GB

mongos> db.runCommand( { enablesharding : "test" } )

{ "ok" : 1 }


5.2 샤딩키 인덱스 생성

use test
db.test_collection.ensureIndex({number:1})


5.3 Collection의 샤드키 설정

use admin

-- test.test_collection의 number를 키 설정

db.runCommand( { shardcollection : "test.test_collection", key : {"number":1} })


5.4 마무리

use test


db.stats()

db.printShardingStatus()


'Etc' 카테고리의 다른 글

몽고DB 책 소개  (0) 2012.05.16
DB 개체 스크립트 하기  (0) 2012.04.25
몽고DB 활용 사례  (0) 2012.03.19
몽고DB Sharding 설정 및 테스트  (16) 2012.02.29
SQL 설치 유용한 스크립트  (0) 2012.02.24

몽고DB 활용 사례

'Etc' 카테고리의 다른 글

DB 개체 스크립트 하기  (0) 2012.04.25
몽고DB Replicated Shard Cluster + Arbitor  (0) 2012.03.19
몽고DB Sharding 설정 및 테스트  (16) 2012.02.29
SQL 설치 유용한 스크립트  (0) 2012.02.24
journal 폴더가 왜 생기는 걸까?  (0) 2012.02.21

테스트 환경 : Win7 64bit, SSD 128G, Memory 8G

 
1. DB 폴더 생성(관리자 권한 실행)

D:\DB\MONGO>mkdir SHARD1, SHARD2, CONFIG

 
2. 샤딩 서비스 실행

가. 설정 서버 실행

D:\DB\MONGO>mongod --dbpath D:\DB\MONGO\CONFIG --port 20000

 
나. 라우팅 서버 실행

D:\DB\MONGO>mongos --port 30000 --configdb localhost:20000

 
다. 샤딩 인스턴스 1, 2 실행

D:\DB\MONGO>mongod --dbpath D:\DB\MONGO\SHARD1 --port 10000
D:\DB\MONGO>mongod --dbpath D:\DB\MONGO\SHARD2 --port 10001  

 
3. 샤딩 구성

가. mongos 라우팅 인스턴스 접속

C:\Users\judydba>mongo localhost:30000/admin

MongoDB shell version: 2.0.2

connecting to: localhost:30000/admin


 
나. 샤드 구성
addshard 명령어로 샤드를 추가

mongos> db.runCommand( {addshard : "localhost:10000", allowLocal:true})

{ "shardAdded" : "shard0000", "ok" : 1 }

mongos> db.runCommand( {addshard : "localhost:10001", allowLocal:true})

{ "shardAdded" : "shard0001", "ok" : 1 }

※ allowLocal 키는 localhost에 샤드를 실행할 때만 필요합니다. 몽고디비는 실수로 로컬에 클러스터를 설정하는 사태를 막기 위해. allowLocal:true는 생략 가능
 

다. 데이터 샤딩
데이타 분산을 위한 데이터베이스와 컬렉션 수준으로 명시적 설정 
testdb의 test collection을 분산.
분산을 위한 샤드 키는 seq 설정

mongos> db.runCommand({ "enablesharding" : "testdb" })

{ "ok" : 1 }

mongos> db.runCommand({ "shardcollection" : "testdb.test", "key" : {"seq" : 1}})

{ "collectionsharded" : "testdb.test", "ok" : 1 }

 
라. 샤드 구성 확인
청크 사이즈  64M

mongos> use config

switched to db config

mongos> db.shards.find();

{ "_id" : "shard0000", "host" : "localhost:10000" }

{ "_id" : "shard0001", "host" : "localhost:10001" }

mongos> db.databases.find()

{ "_id" : "admin", "partitioned" : false, "primary" : "config" }

{ "_id" : "testdb", "partitioned" : true, "primary" : "shard0000" }

mongos> db.chunks.find()

{ "_id" : "testdb.test-seq_MinKey", "lastmod" : { "t" : 1000, "i" : 0 }, "ns" :

"testdb.test", "min" : { "seq" : { $minKey : 1 } }, "max" : { "seq" : { $maxKey

: 1 } }, "shard" : "shard0000" }
 

mongos> db.printShardingStatus()

--- Sharding Status ---

  sharding version: { "_id" : 1, "version" : 3 }

  shards:

        {  "_id" : "shard0000",  "host" : "localhost:10000" }

        {  "_id" : "shard0001",  "host" : "localhost:10001" }

  databases:

        {  "_id" : "admin",  "partitioned" : false,  "primary" : "config" }

        {  "_id" : "testdb",  "partitioned" : true,  "primary" : "shard0000" }

                testdb.test chunks:

                                shard0000       1

                        { "seq" : { $minKey : 1 } } -->> { "seq" : { $maxKey : 1

 } } on : shard0000 { "t" : 1000, "i" : 0 }

 
 
4. 테스트
500000 데이타를 입력

mongos> use testdb
switched to db testdb

mongos> for(i=0; i<500000; i++) { db.test.insert({"_id" : i, "seq" : i+5000, "date": new Date() }); }


5. 청크 정보 확인

mongos> use config

switched to db config

mongos> db.chunks.find()

{ "_id" : "testdb.test-seq_MinKey", "lastmod" : { "t" : 2000, "i" : 1 }, "ns" :

"testdb.test", "min" : { "seq" : { $minKey : 1 } }, "max" : { "seq" : 5000 }, "s

hard" : "shard0000" }

{ "_id" : "testdb.test-seq_5000.0", "lastmod" : { "t" : 1000, "i" : 3 }, "ns" :

"testdb.test", "min" : { "seq" : 5000 }, "max" : { "seq" : 17024 }, "shard" : "s

hard0000" }

{ "_id" : "testdb.test-seq_17024.0", "lastmod" : { "t" : 2000, "i" : 2 }, "ns" :

 "testdb.test", "min" : { "seq" : 17024 }, "max" : { "seq" : 419135 }, "shard" :

 "shard0001" }

{ "_id" : "testdb.test-seq_419135.0", "lastmod" : { "t" : 2000, "i" : 3 }, "ns"

: "testdb.test", "min" : { "seq" : 419135 }, "max" : { "seq" : { $maxKey : 1 } }

, "shard" : "shard0001" }
 

mongos> db.printShardingStatus()

--- Sharding Status ---

  sharding version: { "_id" : 1, "version" : 3 }

  shards:

        {  "_id" : "shard0000",  "host" : "localhost:10000" }

        {  "_id" : "shard0001",  "host" : "localhost:10001" }

  databases:

        {  "_id" : "admin",  "partitioned" : false,  "primary" : "config" }

        {  "_id" : "testdb",  "partitioned" : true,  "primary" : "shard0000" }

                testdb.test chunks:

                                shard0000       2

                                shard0001       2

                        { "seq" : { $minKey : 1 } } -->> { "seq" : 5000 } on : s

hard0000 { "t" : 2000, "i" : 1 }

                        { "seq" : 5000 } -->> { "seq" : 17024 } on : shard0000 {

 "t" : 1000, "i" : 3 }

                        { "seq" : 17024 } -->> { "seq" : 419135 } on : shard0001

 { "t" : 2000, "i" : 2 }

                        { "seq" : 419135 } -->> { "seq" : { $maxKey : 1 } } on :

 shard0001 { "t" : 2000, "i" : 3 }

데이타가 증가할 수록 moveChunk 폴더가 생기면서 데이타가 분리되었음을 확인가능함.

shard0000, shard0001 청크가 2개씩 존재하며, 각 샤드키로 분산되어 있다.

shard0000 : seq 1 ~ 50000
shard0000 : seq 5000~17024
shard0001 : seq 17024 ~ 419135
shard0001 : seq 419135 ~ Max

 


'Etc' 카테고리의 다른 글

몽고DB Replicated Shard Cluster + Arbitor  (0) 2012.03.19
몽고DB 활용 사례  (0) 2012.03.19
SQL 설치 유용한 스크립트  (0) 2012.02.24
journal 폴더가 왜 생기는 걸까?  (0) 2012.02.21
몽고DB Config 설정하기(Win7)  (0) 2012.02.20

얼마전부터 SQL Server Virtual Labs를 통한 SQL2012를 학습중인데, 학습하던 중 BareMetal-ScriptingPackage를 알게 되었다.  SQL 설치 및 구성 등등을 위한 스크립트를 제공해주는데 DBA에게 유용해보인다.^%^

http://sqlbaremetal.codeplex.com/ 

아래와 같은 기능을 script로 제공해준다. 

Install and configure:
- A domain based network with multiple member servers
- Multiple servers and instances of SQL Server 2008 R2
- Multiple servers and instances of SQL Server code name "Denali"
- Installing SQL Server code name "Denali" on Windows Server core

Configure and Deploy:
- Microsoft Business Intelligence with Sharepoint 2010 and Office client integration
- Mission Critical platform using SQL Server 2008 R2 and SQL Server code name "Denali"

Consume and try:
- Implement SQL Server 2008 R2 Failover Clustering
- Implement SQL Server 2008 R2 Peer to Peer Replication
- Implement SQL Server 2008 R2 Database Mirroring
- Implement AlwaysOn in SQL Server code name "Denali"
- Discover and implement new features in SQL Server code name "Denali"


특히, 유용했던 스크립트는 Window Server 설치 이후 방화벽 오픈을 위해 GUI를 통해서 그동한 오픈해 주었는데 제공해주는 Script를 이용하여 클릭한번이면 끝!! 얼마나 간편한가.ㅎㅎ

BareMetal-ScriptingPackage\VMPlugins\Scripts\Firewall\SQLServerFirewallconfig.cmd

@echo off

@echo This scripts sets the default firewall configurations for SQL Server components

echo.

echo Setting the core components for a database instance 


echo Default Instance

netsh advfirewall firewall add rule name="SQLServer" dir=in action=allow protocol=TCP localport=1433 profile=DOMAIN

 

echo Dedicated Admin Connection

netsh advfirewall firewall add rule name="SQL DAC" dir=in action=allow protocol=TCP localport=1434 profile=DOMAIN




 

'Etc' 카테고리의 다른 글

몽고DB 활용 사례  (0) 2012.03.19
몽고DB Sharding 설정 및 테스트  (16) 2012.02.29
journal 폴더가 왜 생기는 걸까?  (0) 2012.02.21
몽고DB Config 설정하기(Win7)  (0) 2012.02.20
몽고DB 책 소개  (0) 2012.02.17

현상

db folder에 총 3개의 파일 생성.



언제 생겼나?
1.9.2+ 버젼 이후에 64bit 플랫폼 환경에서는 기본 설정되어 있다.1.9.2버젼 이전 및 32bit 플랫폼에서는 설정 off 상태이다. Storage engine에서 빠른 크래쉬 복구 및 내구성을 지원하기 위해 1.7.5+부터 지원되기 시작했다.


동작
journal/lsn 폴더에 순차적인 번호로 추가되며, write-ahead redo logs 파일이다. 서버 종료시 모든 파일은 정리되며, 가동시 재 생성됩니다.

Journal disable

C:\>"C:\mongodb\bin\mongod.exe" --config  C:\mongodb\mongodb.conf  --logappend --directoryperdb --nojournal

 
Journal enable

C:\>"C:\mongodb\bin\mongod.exe" --config  C:\mongodb\mongodb.conf  --logappend --directoryperdb --journal

 
몽고DB 활용가이드 발췌
: 저널링(journaling)은 단일 서버에서의 데이터 안전성을 확보해준다. 모든 연산은 로그(저널)에 기록되고 여기에 기록된 내용은 디스크에 정기적으로 이전 된다. 장치가 멈추지었지만 하드웨어에는 이상 없을 때에 서버를 재시작하면 저널을 사용해서 데이터를 스스로 복구한다. (MSSQL의 트랜잭션 로그와 비슷한 개념 같네... 흠흠..)

몽고DBA를 꿈꾸는 주디아줌마^^ 

'Etc' 카테고리의 다른 글

몽고DB Sharding 설정 및 테스트  (16) 2012.02.29
SQL 설치 유용한 스크립트  (0) 2012.02.24
몽고DB Config 설정하기(Win7)  (0) 2012.02.20
몽고DB 책 소개  (0) 2012.02.17
몽고DB 어드민 관리툴  (1) 2011.08.18

몽고DB 환경설정을 -f, --config으로  설정할 수 있다.

1. 환경설정 파일 생성
   mongodb.conf 파일을 생성하여 아래와 같이 적용한다. 확장자를 꼭 확인해야 한다. 메모장에서  생성하여 저장하면 기본적으로 .txt로 생성된다. 

dbpath = /mdb

bind_ip = 127.0.0.1

port = 5586
logpath = C:\mongodb\log\log.txt  ## 로그 경로 

noauth = true # use 'true' for options that don't take an argument

verbose = true # to disable, comment out.
 


2. 환경 설정 파일 실행하기(관리자 권한으로 실행)

  
 

'Etc' 카테고리의 다른 글

SQL 설치 유용한 스크립트  (0) 2012.02.24
journal 폴더가 왜 생기는 걸까?  (0) 2012.02.21
몽고DB 책 소개  (0) 2012.02.17
몽고DB 어드민 관리툴  (1) 2011.08.18
SQL to Mongo Mapping Chart  (0) 2011.08.18

몽고DB 책 소개


몽고DB를 다룬 한글 번역서가 2권이 출간되었네요. 출산휴가로 5개월간 쉬었더니 드디어 몽고DB를 다룬 한글책이 하나 더 출간되었군여^^

책 제목 : 몽고DB 활용가이드

 


몽고DB 시리즈 책들은 정말 얇네요^^. 가격이 11,700원으로 아주 저렴합니다. 관리적인 부분 및 팁 관련 부족했는데 원서보다는 한글서를 본다는게 너무 기쁘네요^^

http://www.yes24.com/24/goods/6066215


이전에 출간된 몽고DB 완벽가이드 http://www.yes24.com/24/goods/5161478도 확인할 수 있습니다.


몽고DB 책(원서) 아마존 사이트에서 확인할 수 있는데, 정말 많이 나왔네요^^
http://www.amazon.com/s/ref=nb_sb_noss_1/185-0927693-9101820?url=search-alias%3Daps&field-keywords=mongodb



'Etc' 카테고리의 다른 글

journal 폴더가 왜 생기는 걸까?  (0) 2012.02.21
몽고DB Config 설정하기(Win7)  (0) 2012.02.20
몽고DB 어드민 관리툴  (1) 2011.08.18
SQL to Mongo Mapping Chart  (0) 2011.08.18
몽고DB와 MSSQL2008 INSERT 속도 테스트  (5) 2011.08.05

몽고DB 어드민 관리툴


그동안 관리툴이 없는 줄 알고 ㅠㅠ 콘솔로 열심히 했다. 알고 보니 편한 UI 툴이 있구만.ㅋㅋㅋ

http://www.mongodb.org/display/DOCS/Admin+UIs

상용프로그램과 무료 프로그램이 있는데, 아직 개발시작 단계라 무료 라인센스 툴을 사용했는데, 의외로 아주 잘 되어 있는 것 같다.


내가 사용하는 무료 툴 JMongoBrowser-windows-all_1-0-2 이다. 위의 링크에서 다운로드 한다.

1) 접속 화면


접속 주소 및 DB명을 명시하면 사용가능 하다.

2) 관리자 관리 화면





권한/DB/컬렉션 생성, 조회, 삭제 모두 가능하다.  종료까지 가능하나네~~ 완전 편해. 아직 몽고DB의 실체를 알지 못하지만 NOSQL의 장점이 로그기능의 Data를 기록하는데 정말 편한 것 같다.



'Etc' 카테고리의 다른 글

몽고DB Config 설정하기(Win7)  (0) 2012.02.20
몽고DB 책 소개  (0) 2012.02.17
SQL to Mongo Mapping Chart  (0) 2011.08.18
몽고DB와 MSSQL2008 INSERT 속도 테스트  (5) 2011.08.05
Index Rebuild 스터디 발표 내용^^  (0) 2011.08.02