Skip to content

Instantly share code, notes, and snippets.

View federico-garcia's full-sized avatar

Federico Garcia federico-garcia

  • Propelus
View GitHub Profile
@federico-garcia
federico-garcia / mongoDB.md
Last active April 15, 2020 12:51
MongoDB guide

Running mongodb

docker run -d -v $(pwd)/data/single:/data/db -v $(pwd)/config/single/mongod.conf:/etc/mongod.conf -p 27017:27017 --name mongo-server mongo:3.4 mongod -f /etc/mongod.conf

mongod - the server itself
mongo - mongodb cli (you can run js scripts)

default data directory: /data/db default DB: test default port: 27017 (config parameter net:port anf net:bindIp)

Redis

Redis stands for REmote DIctionary Server. By default, redis stores all data in memory. It's a key-structure database. redis-server is the actual datastore. redis-cli is the command line interface that performs any redis command. By default, redis binds to port 6379.

Starting the redis server

redis-server

While you can build a complete system using Redis only, I think most people will find that it supplements their more generic data solution - whether that be a traditional relational database, a document-oriented system, or something else. It’s the kind of solution you use to implement specific features.

tmux

Creating a new session

tmux
tmux new-session -s'my rails project'

The default prefix is ctrl+b, I will refer to this as the PREFIX, then you need to enter the command.

Leaving the current session (deattaching from session, it will continue running on the server).

Contributing to open source projects

Fork the project to your github account

Clone the project to you local environment

git clone ssh_string local_directory