Skip to content

Instantly share code, notes, and snippets.

View mongodb_3.2.x_logging.md

MongoDB 3.2.x Logging

The main log file is the mongod.log. You can specify the log file location when you are starting the mongod process but if you have installed on Ubuntu from a package then you log file will normally be located in /var/log/mongodb/mongod.log.

You can tail the log file using:

tail -f /var/log/mongodb/mongod.log

From the Mongo shell you can also view the log file using:

show logs

@leommoore
leommoore / mongodb_3.2.x_sharding.md
Last active May 7, 2019
MongoDB 3.2.x Sharding
View mongodb_3.2.x_sharding.md

#MongoDB 3.2.x Sharding Sharding is used when the database is too large to run on a single server and you need to spread the load across multiple servers. The name itself refers to the breaking (sharding) of the data into seperate groups of data which will reside on different servers.

##Configuration Server Start the server on your server (myserver0)

mongod --configsvr --dbpath /data

On myserver1 start the shard giving the configuration server as the --configdb option

@leommoore
leommoore / mongodb_3.2.x_replica_sets_on_aws_ec2.md
Last active Mar 15, 2022
MongoDB 3.2.x Replica Sets on AWS EC2
View mongodb_3.2.x_replica_sets_on_aws_ec2.md

#MongoDB 3.2.x Replica Sets on AWS EC2 A MongoDB replica set provides a mechanism to allow for a reliable database services. The basic replica set consists of three servers, a primary, a secondary and an arbitrator. The primary and secondary both hold a copy of the data. The arbitrator is normally a low spec server which just monitors the other servers and help with the failover process. In production, there can be more than three servers.

To setup mongo as a replica set on Amazon Web Services EC2 you need to first setup a security group with ssh on port 22 and mongodb on port 27017. You then need to create three servers. Select Ubuntu 14.04 LTS x64 and a micro (or bigger depending on your database size, ideally you should have enough memory to match your database size) instance for the primary and secondary and a nano instance for the arbitrator.

##Adjust the File System on each Server The operating system by default will update the last access time on a file. In a high data throughput database application

View mongodb_3.2.x.md

#MongoDB 3.2.x

##Install MongoDB To install MongoDB on ubuntu from precompiled version.

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-3.2.5.tgz
gzip -d mongodb-linux-x86_64-ubuntu1404-3.2.5.tgz
tar -xvf mongodb-linux-x86_64-ubuntu1404-3.2.5.tar

Then check put what is in the bin directory

View tmux.md

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
View linux_partitions.md

#Linux Partitions The best time to partition is when you are doing a fresh install.

  1. In Ubuntu, when you are prompted to erase the disk, select 'Something Else' and click 'Continue'. You will see a single device /dev/sda.
  2. Click the 'New Partition Table..' button. Read the warning and click 'Continue'
  3. Select the free space and click on the '+' button next to Change to create a partition.
  4. Main System Partition - Can be as little as 15-20Gb or larger if necessary. Choose the Gb figure and multiply by 1024 and enter the figure in the size box. Leave 'Primary','Beginning of this space' and 'Ext4 journaling file system'. Select '/' under the mount point and click 'OK'
  5. Select the remaining space and click '+' again. Click on the 'Use as' dropdown menu and select 'swap area'. Set the partition type as Logical, but set its location as 'End of this space'. The size should be approximately the same as the memory or at least 1Gb. Choose a figure and multiply by 1024 to get the Mb figure
@leommoore
leommoore / letsencrypt_ubuntu_nginx.md
Last active Aug 8, 2018
Letsencrypt Ubuntu 14.04 Nginx
View letsencrypt_ubuntu_nginx.md

#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
@leommoore
leommoore / SSH_Two_Factor_Authentication.md
Last active Nov 9, 2020
SSH Two Factor Authentication
View SSH_Two_Factor_Authentication.md

SSH Two Factor Authentication

Install ssh server

sudo apt-get install openssh-server

Configure SSH server

First make a backup copy of the original config

sudo cp -a /etc/ssh/sshd_config /etc/ssh/sshd_config_backup

View setup_dev.md
#Terminal
sudo apt-get install terminator

#Java 8
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

#Browser

sudo apt-get install chromium-browser

@leommoore
leommoore / windows_node_gyp_compile_problems.md
Last active Nov 8, 2017
Windows node-gyp Compile Problems
View windows_node_gyp_compile_problems.md

#Windows node_gyp Compile Problems

When you are compiling node-gyp components during the npm install process you may hit problems when it tries to figure out the version of Microsoft C++ that you have available.

##Typical Problems

fatal error C1083: Cannot open include file: 'vcruntime.h': No such file or directory