Skip to content

Instantly share code, notes, and snippets.

@dungmanh88
dungmanh88 / Install repo
Created September 27, 2016 03:58
Install repo
ELREPO: https://elrepo.org/tiki/tiki-index.php
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
EPELREPO:
yum -y install epel-release
REMIREPO: http://rpms.famillecollet.com/
rpm --import http://rpms.remirepo.net/RPM-GPG-KEY-remi
@dungmanh88
dungmanh88 / Get hardware information
Created September 27, 2016 03:52
Get hardware information
dmidecode -t processor | grep -i version
dmidecode -t process | grep -i cache
dmidecode -t processor | grep -i count
dmidecode -t processor | grep -i capable
lscpu
uname -r
cat /etc/issue
cat /etc/redhat-*
free -m
dmidecode -t memory | grep -i "Number of devices"
@dungmanh88
dungmanh88 / Resolve e1000e
Last active September 27, 2016 03:46
Resolve e1000e
lspci | egrep -i 'ethernet|network'
if you are using Intel 82574L, you should upgrade module.
Follow https://elrepo.org/tiki/tiki-index.php
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
sudo lsmod|grep e1000e
Output:
e1000e 230782 0
@dungmanh88
dungmanh88 / Mount and umount an encrypted device
Created September 27, 2016 01:13
Mount/umount an encrypted device
sudo blkid ### Get device
sudo cryptsetup luksOpen <device> <map-name>
sudo mount /dev/mapper/<map-name> /mnt/
sudo umount /mnt
sudo cryptsetup luksClose <map-name>
@dungmanh88
dungmanh88 / Change password with encrypted home directory in Ubuntu
Created September 27, 2016 01:10
Change password with encrypted home directory in Ubuntu
sudo passwd username
ecryptfs-mount-private ### Enter old password
ecryptfs-rewrap-passphrase ~/.ecryptfs/wrapped-passphrase ### Enter new password
ecryptfs-unwrap-passphrase ### Recheck passphrase with new password. Passphrase is unchanged when you change your login password
Passwords and Keys > Change password of login keyring
@dungmanh88
dungmanh88 / Diff MySQL configuration files and server variables
Created September 26, 2016 18:12
Diff MySQL configuration files and server variables
Just compare in mysqld section
pt-config-diff /etc/my.cnf.d/server.cnf h=localhost --user=root --ask-pass
pt-config-diff /etc/my.cnf.d/server.cnf /etc/my.cnf.d/server1.cnf
@dungmanh88
dungmanh88 / Use mysql advisor
Created September 26, 2016 18:10
Use mysql advisor
pt-variable-advisor localhost --user=root --ask-pass
perl mysqltuner.pl
@dungmanh88
dungmanh88 / Use mysqltuner.pl
Created September 26, 2016 18:03
Use mysqltuner.pl
wget http://mysqltuner.pl/ -O mysqltuner.pl
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/basic_passwords.txt -O basic_passwords.txt
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/vulnerabilities.csv -O vulnerabilities.csv
chmod u+x mysqltuner.pl
perl mysqltuner.pl
@dungmanh88
dungmanh88 / Open port for galera node
Last active October 1, 2016 15:26
Open port for galera node
port 3306 for mysqld
port 4567 for replication traffic
port 4444 for joiner get SST from donor
@dungmanh88
dungmanh88 / 1 - Debug mysqld server
Last active November 15, 2016 07:35
Debug mysqld - mariadb galera server
mysqladmin status
service mysql status
service mysqld status
ps -ef | grep mysqld | grep -v grep
mysql -uroot -p -A -e"SHOW VARIABLES;" > MySQLCurrentSettings.txt
tail -f /var/log/mysqld/mysql_error.log
tail -f /var/log/mysqld/mysql_slow.log
pt-summary
pt-mysql-summary --user=root --ask-pass
pt-variable-advisor localhost --user=root --ask-pass