Skip to content

Instantly share code, notes, and snippets.

View fernandoaleman's full-sized avatar

Fernando Aleman fernandoaleman

View GitHub Profile
@fernandoaleman
fernandoaleman / check_mysql_memory_usage.sh
Created April 22, 2020 13:02
Check MySQL memory usage
#!/bin/sh
# you might want to add some user authentication here
mysql -e "show variables; show status" | awk '
{
VAR[$1]=$2
}
END {
MAX_CONN = VAR["max_connections"]
MAX_USED_CONN = VAR["Max_used_connections"]
BASE_MEM=VAR["key_buffer_size"] + VAR["query_cache_size"] + VAR["innodb_buffer_pool_size"] + VAR["innodb_additional_mem_pool_size"] + VAR["innodb_log_buffer_size"]
@fernandoaleman
fernandoaleman / .rubocop.yml
Last active July 29, 2020 18:33 — forked from jhass/.rubocop.yml
My preferred Rubocop config
---
# Commonly used screens these days easily fit more than 80 characters.
Layout/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
Max: 20
@fernandoaleman
fernandoaleman / my.cnf
Last active February 29, 2024 20:01 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
# Optimized my.cnf configuration for MySQL/MariaSQL
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated January 2020 ~
#
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@fernandoaleman
fernandoaleman / mysql2-catalina.md
Last active July 11, 2023 02:11
Install mysql2 on MacOS Catalina

Problem

Installing mysql2 gem errors on MacOS Catalina with MySQL 5.7.

Solution

Make sure openssl is installed on Mac via Homebrew.

brew install openssl

MySQL Master-Slave Replication on CentOS 7

Install and configure MySQL with master-slave replication. The benefits of this include high availability, backups, disaster recovery and reporting.

For tutorial purposes, we will be using one master node and one slave node.

Master Node: 10.0.0.10
Slave Node:  10.0.0.11
@fernandoaleman
fernandoaleman / reduce-lvm-partition-centos-7.md
Last active April 1, 2024 13:19
Reduce an LVM partition on CentOS 7

Reduce LVM Partition on CentOS 7

Sometimes when creating a new CentOS 7 server, the drive is partioned with the root, boot and swap, and then all the rest of the space is given to the home directory.

Here, we are going to reduce the size of the /home partition and allocate the remaining space back to the root partition.

List Block Devices

List the current block devices

@fernandoaleman
fernandoaleman / install-rabbitmq-centos-7.md
Last active April 22, 2024 19:00
Install RabbitMQ on CentOS 7

Install RabbitMQ on CentOS 7

sudo yum -y install epel-release
sudo yum -y update

Install Erlang

Download repository

@fernandoaleman
fernandoaleman / .travis.yml
Last active November 9, 2018 13:39
Sample chef cookbook .travis.yml file
sudo: required
dist: trusty
addons:
apt:
sources:
- chef-current-trusty
packages:
- chefdk
@fernandoaleman
fernandoaleman / mysql2-mojave.md
Last active February 7, 2024 19:19
Install mysql2 on MacOS Mojave

For MacOS Catalina, visit Install mysql2 on MacOS Catalina

Problem

Installing mysql2 gem errors on MacOS Mojave.

Solution

Make sure openssl is installed on Mac via Homebrew.

@fernandoaleman
fernandoaleman / updating-chef-node.md
Last active October 1, 2018 16:55
Updating Chef node

Problem

An existing chef node node-1 needs to be renamed node-01.

Solution

  1. knife node edit node-1
    • Change the node_name to node-01.
  2. knife node delete node-1
  3. knife client delete node-1