Ads 468x60px

Pages

Tampilkan postingan dengan label mongo. Tampilkan semua postingan
Tampilkan postingan dengan label mongo. Tampilkan semua postingan

Sabtu, 01 Maret 2014

Mongo findAndModify

HERE
Implementing queues is a good use case for findAndModify


Which of these statements are true?

{
findAndModify: <string>,
query: <document>,
sort: <document>,
remove: <boolean>,
update: <document>,
new: <boolean>,
fields: <document>,
upsert: <boolean>
}



Read More..

Minggu, 16 Februari 2014

Mongo M101P MongoDB for Developers week 3


Handling blobs (4 min)


GRIDFS
documents limited to 16MB in mongodb
breaks up large files into chunks and store them into a collection and meta data into another
By default GridFS limits chunk size to 256k
GridFS uses two collections to store files. One collection stores the file chunks, and the other stores file metadata.
collection
videos.chunks
videos.files
videos_meta?



When to denormalize (2 min)



Trees (2.5 min)



Benefits of embedding (2 min)


PERFORMANCE!

Multikeys (4 min)



Many to many relations (5 min)



One to many relations (5 min)



One to one relations (4 min)




Living without transactions (4 min)



Living without constraints (3 min)


Alternative schema for Blog (3 min)




Mongo design for Blog (4.5 min)



Relational normalization (5 min)


relational strives for 3rd normal form
denormalized

Goals of Normalization:

  • frees database of modification anomalies (recall Andrews email example)
  • minimize redesign when extending
  • avoid any bias toward a particular access pattern (NOT A MONGO CONCERN)
"When you are not biased toward a particular access pattern you are equally bad at all of them"...Andrew Erlichson



Mongodb schema design (3 min)


mongo does not join in journal
joins are hard to scale
think about what data you want to use together
mongo has no constraints
atomic operations on documents

Quiz: MongoDB Schema Design







Whats the single most important factor in designing your application schema within MongoDB?
Read More..

Selasa, 11 Februari 2014

Mongo dba week 7 security backups


Additional Resources (2.5 min)



  • Docs - mongodb.org
  • Driver docs - 
  • Bug database / feature request database [JIRA]
  • Support forums (in Google Groups) - mongodb-user
  • IRC - channel: freenode.net/#mongodb
  • Source code on github
  • Blog
  • Twitter (@mongodb)
  • Mongo Meetup Groups (MMUGs) - look on meetup.com




Hardware Tips (7.5 min)


Additional Features (4.5 min)


Geospatial Indexes (5 min)


location
latitude and longitude things
built on top of b-tree structures
uses variation of geo-hash codes

Data Recovery with MMS (4 min)


Quiz: Data Recovery with MMS Backup





You rack up $3.50 in MMS charges from a small backup restoration. What are your out-of-pocket costs?

Installing MMS Backup (3.5 min)


Introduction to MMS Backup ( min)


Backup Strategies (3 min)


Quiz: Backup Strategies






Which are true statements?

Backups (12 min)


Intra-cluster Security (4 min)



Security and Clients (6.5 min)




--auth : runs it in a security mode.
to authenticate:
NOTE: users are added per-database
db.addUser(...) - system.users (which is used to create credentials in mongodb)
db.addUser( { user: "", pwd: "", roles: [] } ) - 2.4+
db.auth(username,password) - to authenticate in the shell
Types of users:
admin users - created in the admin database.  has privileges across all databases
regular users - access a specific database, read/write or read only.

Start by adding an administrative user:
> use admin
switched to db admin
> db.addUser("the_admin", "testpassword" )
{
"user" : "the_admin",
"readOnly" : false,
"pwd" : "8b7c802b3626405fd30fa921fcf41cf9",
"_id" : ObjectId("52851114c2e7840b9b05b49f")

}
> db
admin
> show collections
system.indexes
system.users
> db.system.users.find()
{ "_id" : ObjectId("52851114c2e7840b9b05b49f"), "user" : "the_admin", "readOnly" : false, "pwd" : "8b7c802b3626405fd30fa921fcf41cf9" }

passwords are hashed (not stored in plain text [i.e. a message digest])


Once the admin user has been added to the admin database, the rule that you can connect from the localhost no longer applies.  Meaning that we will have to authenticate or it wont let us in (even if we are on localhost).
> show dbs
Thu Nov 14 11:07:59.449 JavaScript execution failed: listDatabases failed:{ "ok" : 0, "errmsg" : "unauthorized" } at src/mongo/shell/mongo.js:L46
> // now we authenticate to do useful things
> db.auth("the_admin", "testpassword" )
1
> show dbs
admin 0.0625GB
local 0.03125GB

test (empty)





Quiz: Security and Clients







Which are true?



Security (5 min)


Introduction ( min)

Read More..