#MongoDB 3.2.x Security
##Network Ports The standard ports used by mongo are:
Process | Role | Default Port |
---|
#MongoDB 3.2.x Security
##Network Ports The standard ports used by mongo are:
Process | Role | Default Port |
---|
#Letsencrypt Ubuntu 14.04 Nginx Letsencrypt (https://letsencrypt.org) is an initative which aims to increase the use of encryption for websites. It basically allows people to apply for free certificates provided that they prove the they control the requested domain.
Note: As of 8th March 2016 letsencrypt is still in public beta.
##Installation To install the client, clone the repostiory from github.
git clone https://github.com/letsencrypt/letsencrypt.git
#MongoDB Indexes There are 5 different index types supported in MongoDB.
##Create Index
#MongoDB - Basics
##Installation The Debian package management tool (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import the 10gen public GPG Key:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
Create a /etc/apt/sources.list.d/10gen.list file using the following command.
echo 'deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' | sudo tee /etc/apt/sources.list.d/10gen.list
#SSL Basics
Secure Socket Layer (SSL) is a mechanism to allow information to be securely communicated. Specifically, it is a cryptographic protocol that enables two parties such as a web server and a browser to exchange information securely by encrypting it before sending and decrypting it upon receipt. It is based on the X.509 standards.
##Symmetric and Asymmetric Encryption Encrypting and decrypting requires a secret like a password, which is known as a key. There are two types of key, symmetric and asymmetric. If a symmetric key is used it means that the same key is used to encrypt and decrypt the message. Asymmetric keys consist of a private and public key. The message sender encrypts the message using their private (secret) key and the message receiver can decrypt the message using the senders public key.
Asymmetric keys require more processing resources than symmetric keys. The problem is that to communicate using symmetric keys both parties have to have the symmetric keys first and the question is
function btoa(str) { | |
if ((typeof str) !== 'string') { | |
str = JSON.stringify(str); | |
} | |
var buffer; | |
if (str instanceof Buffer) { | |
buffer = str; |
#MongoDB - Mongo Shell
###Single Task You can run commands in MongoDB from the command prompt by feeding the command into the mongo shell using:
mongo server1/admin --eval "db.runCommand({logRotate:1})"
mongo localhost:30000/admin --eval "db.runCommand({logRotate:1})"
This example will rotate the log file without remaining in the mongo shell. Note: admin refers to the admin database. Executing the command returns:
#Node - Installing and Compiling Node.js
##Simple Install Ubuntu
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
##Compile and Install
#MongoDB - JavaScript
Since a query may return a large number of records which is too large for the client, the find
returns a cursor instead of the data. This cursor can be assigned to a variable.
var vendorCursor = db.vendors.find();
You can see the size of the cursor using:
vendorCursor.size();
You can check to see if there is more data after the current cursor point in the data set using:
#Ubuntu - Installing Java
##Java 8 sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer
##To install the JDK
sudo apt-get install python-software-properties