태그 보관물: mongodb

Cassandra와 Hadoop, HBase, MongoDB와의 차이점..

아래는 http://www.datastax.com/faq#intro-3에 있는 내용이다. 설명이 간단 명료해서 쉽게 차이점을 이해할 수 있다. ^^

How does Cassandra differ from Hadoop?

The primary difference between Cassandra and Hadoop is that Cassandra targets real-time/operational data, while Hadoop has been designed for batch-based analytic work.

There are many different technical differences between Cassandra and Hadoop, including Cassandra’s underlying data structure (based on Google’s Bigtable), its fault-tolerant, peer-to-peer architecture, multi-data center capabilities, tunable data consistency, all nodes being the same (no concept of a namenode, etc.) and much more.

How does Cassandra differ from HBase?

HBase is an open-source, column-oriented data store modeled after Google Bigtable, and is designed to offer Bigtable-like capabilities on top of data stored in Hadoop. However, while HBase shared the Bigtable design with Cassandra, its foundational architecture is much different.

A Cassandra cluster is much easier to setup and configure than a comparable HBase cluster. HBase’s reliance on the Hadoop namenode equates to there being a single point of failure in HBase, whereas with Cassandra, because all nodes are the same, there is no such issue.

In internal performance tests conducted at DataStax (using the Yahoo Cloud Serving Benchmark – YCSB), Cassandra offered literally 5X better performance in writes and 4X better performance on reads than HBase.

How does Cassandra differ from MongoDB?

MongoDB is a document-oriented database that is built upon a master-slave/sharding architecture. MongoDB is designed to store/manage collections of JSON-styled documents.

By contrast, Cassandra uses a peer-to-peer, write/read-anywhere styled architecture that is based on a combination of Google BigTable and Amazon Dynamo. This allows Cassandra to avoid the various complications and pitfalls of master/slave and sharding architectures.
Moreover, Cassandra offers linear performance increases as new nodes are added to a cluster, scales to terabyte-petabyte data volumes, and has no single point of failure.

몽고디비(MongoDB)에 id/pw 추가해서 기본인증 사용하기

관리자 디비(Admin db)에 사용자를 추가해서 추가된 사용자를 확인하는 예제이다.

1. 사용자 추가

>use admin
>db.addUser("adminID", "admin-pw")
>db.addUser("readOnlyUser", "readOnlyPassword", true)

2. 사용자 보기
콘소렝서 show users 나 db.system.users.find() 로 사용자 추가를 확인할 수 있다. 패스워드는 당근 해싱되서 들어간다.

> show users
{
"_id" : ObjectId("4de4c6f08d34658ccb0fa37f"),
"user" : "admin",
"readOnly" : false,
"pwd" : "e66ebf8257615e47e4e6e6e375063a30"
}
{
"_id" : ObjectId("4de4c7dd8d34658ccb0fa380"),
"user" : "readOnlyUser",
"readOnly" : true,
"pwd" : "d2c06e3c0eda49f8a019d217e34683e8"
}
> db.system.users.find()
{ "_id" : ObjectId("4de4c6f08d34658ccb0fa37f"), "user" : "admin", "readOnly" : false, "pwd" : "e66ebf8257615e47e4e6e6e375063a30" }
{ "_id" : ObjectId("4de4c7dd8d34658ccb0fa380"), "user" : "readOnlyUser", "readOnly" : true, "pwd" : "d2c06e3c0eda49f8a019d217e34683e8" }

3. db에서 기본인증 사용하기
/etc/mongodb.conf 에서 auth=true로 해서 재시작 하면 된다.

우분투(Ubuntu)에서 몽고디비(MongoDB) 설치하고 사용하기

우분투(Ubuntu)에서 몽고디비(MongoDB)를 설치하는 과정을 살펴보자.

1. 설치

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

/etc/apt/sources.list에 아래 추가

deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen

패키지 캐시 업데이트 및 설치

sudo apt-get update
sudo apt-get install mongodb-10gen

2. 설정

/etc/init.d# vim /etc/mongodb.conf

3. 재시작

/etc/init.d# ./mongodb restart

* Reference
http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages